plankton: reset USB hub on cable plug

If USB hub is connected to the type-C port, we need to reset the hub
whenever a cable plugs in. Otherwise, USB3.0 may fail to enumerate.

BRANCH=None
BUG=None
TEST=Plug/unplug cable and measure hub reset signal.

Change-Id: I60f67c83653d532971ee156914fe6ae0ecdb8d3a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229490
Reviewed-by: Pin-chih Lin <johnylin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Vic Yang
2014-11-12 20:53:51 -08:00
committed by chrome-internal-fetch
parent 042dcf8c8a
commit 1291eb4b1d
3 changed files with 22 additions and 0 deletions

View File

@@ -225,6 +225,21 @@ static int board_usb_hub_reset(void)
return pca9534_set_level(I2C_PORT_MASTER, 0x40, 7, 1);
}
void board_maybe_reset_usb_hub(void)
{
int ret;
int level;
ret = pca9534_config_pin(I2C_PORT_MASTER, 0x40, 6, PCA9534_INPUT);
if (ret)
return;
ret = pca9534_get_level(I2C_PORT_MASTER, 0x40, 6, &level);
if (ret)
return;
if (level == 1)
board_usb_hub_reset();
}
static int cmd_usb_hub_reset(int argc, char *argv[])
{
return board_usb_hub_reset();

View File

@@ -64,6 +64,9 @@ enum board_src_cap {
/* Set USB PD source capability */
void board_set_source_cap(enum board_src_cap cap);
/* Reset USB hub if USB hub is switched to type-C port */
void board_maybe_reset_usb_hub(void);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

View File

@@ -167,6 +167,10 @@ void pd_power_supply_reset(int port)
int pd_board_checks(void)
{
static int was_connected = -1;
if (was_connected != 1 && pd_is_connected(0))
board_maybe_reset_usb_hub();
was_connected = pd_is_connected(0);
return EC_SUCCESS;
}