summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-04-15 11:18:29 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-21 00:30:16 +0000
commit85704376021f00246f31a847b7784b1ba8bb4b97 (patch)
tree56dccbb12d1cb70ab14245d6ebdc11be482541bb
parent7753aff1b0a0f52448e9a3177e23dd984eb85754 (diff)
downloadchrome-ec-85704376021f00246f31a847b7784b1ba8bb4b97.tar.gz
raa489000: Sink VBUS before switching to TCPC side
When the RAA48900 switches from charger IC control to TCPC control, it will disable the ASGATE. In cases where the board is booted without a battery, this can cause a loss in VSYS. This commit has the board attempt to sink VBUS if it's present prior to switching the part to TCPC control. BUG=b:181712325 BRANCH=dedede TEST=Build and flash galith, remove battery, plug in 45W charger, verify that DUT can boot up. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Id5b3269911d3b8222b28886f66ef724e3e82c637 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829115 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/tcpm/raa489000.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/driver/tcpm/raa489000.c b/driver/tcpm/raa489000.c
index ae7a6b57cf..959ee55448 100644
--- a/driver/tcpm/raa489000.c
+++ b/driver/tcpm/raa489000.c
@@ -101,21 +101,6 @@ int raa489000_init(int port)
CPRINTS("c%d: failed to enable vbus detect cmd", port);
- if (device_id > 1) {
- /*
- * A1 silicon has a DEVICE_ID of 1. For B0 and newer, we need
- * allow the TCPC to control VBUS in order to start VBUS ADC
- * sampling. This is a requirement to clear the TCPC
- * initialization status but in POWER_STATUS. Otherwise, the
- * common TCPCI init will fail. (See b/154191301)
- */
- rv = tcpc_read16(port, RAA489000_TCPC_SETTING1, &regval);
- regval |= RAA489000_TCPC_PWR_CNTRL;
- rv = tcpc_write16(port, RAA489000_TCPC_SETTING1, regval);
- if (rv)
- CPRINTS("C%d: failed to set TCPC power control", port);
- }
-
/*
* If VBUS is present, start sinking from it if we haven't already
* chosen a charge port and no battery is connected. This is
@@ -132,6 +117,21 @@ int raa489000_init(int port)
board_set_active_charge_port(port);
}
+ if (device_id > 1) {
+ /*
+ * A1 silicon has a DEVICE_ID of 1. For B0 and newer, we need
+ * allow the TCPC to control VBUS in order to start VBUS ADC
+ * sampling. This is a requirement to clear the TCPC
+ * initialization status but in POWER_STATUS. Otherwise, the
+ * common TCPCI init will fail. (See b/154191301)
+ */
+ rv = tcpc_read16(port, RAA489000_TCPC_SETTING1, &regval);
+ regval |= RAA489000_TCPC_PWR_CNTRL;
+ rv = tcpc_write16(port, RAA489000_TCPC_SETTING1, regval);
+ if (rv)
+ CPRINTS("C%d: failed to set TCPC power control", port);
+ }
+
/* Note: registers may not be ready until TCPCI init succeeds */
rv = tcpci_tcpm_init(port);
if (rv)