diff options
author | Jett Rink <jettrink@chromium.org> | 2018-01-23 15:35:41 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-25 19:23:47 -0800 |
commit | f4602ec472c5477b1dd1e8963f6d36bd735ebba8 (patch) | |
tree | b68f2d71a73b764f1e3aa93a7566fd762cb8b778 /common/usbc_ppc.c | |
parent | f71edad1e7da32c1a9f2f4208da2ce57d0cfd100 (diff) | |
download | chrome-ec-f4602ec472c5477b1dd1e8963f6d36bd735ebba8.tar.gz |
usbc: Moving PPC init after setting TCPC resistors.
We don't want the PPC to connect the CC lines from the
TCPC to the USB connector until the TCPC resistors are
set in a valid state (SINK initially).
If we connect the CC lines (happens in the ppc_init) before
setting the resistor values, some TCPC will be toggling the
CC line between Rp/Rd since it doesn't detect a cable yet.
In the dead battery charging case, connecting the toggling
CC lines to the charger can rail the CC lines to 3.3 V signaling
to the charger to disconnect Vbus, thus browning out the board.
BRANCH=none
BUG=b:71865251
TEST=Grunt powers on via usbc p0 with and without USB hub.
Change-Id: I8e78aa2af42075398fab89a2dccef5e7df27b260
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/882305
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/usbc_ppc.c')
-rw-r--r-- | common/usbc_ppc.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/common/usbc_ppc.c b/common/usbc_ppc.c index 9614660468..3c6d437152 100644 --- a/common/usbc_ppc.c +++ b/common/usbc_ppc.c @@ -16,6 +16,22 @@ /* Simple wrappers to dispatch to the drivers. */ +int ppc_init(int port) +{ + int rv; + + if (port >= ppc_cnt) + return EC_ERROR_INVAL; + + rv = ppc_chips[port].drv->init(port); + if (rv) + CPRINTS("p%d: PPC init failed! (%d)", port, rv); + else + CPRINTS("p%d: PPC init'd.", port); + + return rv; +} + int ppc_is_sourcing_vbus(int port) { if ((port < 0) || (port >= ppc_cnt)) { @@ -60,20 +76,6 @@ int ppc_is_vbus_present(int port, int *vbus_present) } #endif /* defined(CONFIG_USB_PD_VBUS_DETECT_PPC) */ -static void ppc_init(void) -{ - int i; - int rv; - - for (i = 0; i < ppc_cnt; i++) { - rv = ppc_chips[i].drv->init(i); - if (rv) - CPRINTS("p%d: PPC init failed! (%d)", i, rv); - else - CPRINTS("p%d: PPC init'd.", i); - } -} -DECLARE_HOOK(HOOK_INIT, ppc_init, HOOK_PRIO_INIT_I2C + 1); #ifdef CONFIG_CMD_PPC_DUMP static int command_ppc_dump(int argc, char **argv) |