summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-11-12 20:53:51 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-20 09:53:12 +0000
commit1291eb4b1dafead1d6910ea0032ebbb3f31a612d (patch)
tree6190ef1923310dc72ee0f04bf7eb2dff57eb615c /board
parent042dcf8c8a402407d181aa65ae92b9c131381007 (diff)
downloadchrome-ec-1291eb4b1dafead1d6910ea0032ebbb3f31a612d.tar.gz
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>
Diffstat (limited to 'board')
-rw-r--r--board/plankton/board.c15
-rw-r--r--board/plankton/board.h3
-rw-r--r--board/plankton/usb_pd_policy.c4
3 files changed, 22 insertions, 0 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c
index ddabdc9297..de836dfc0d 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -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();
diff --git a/board/plankton/board.h b/board/plankton/board.h
index 46495178e0..50abc6faab 100644
--- a/board/plankton/board.h
+++ b/board/plankton/board.h
@@ -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 */
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c
index d5274ba0b5..b2fb708888 100644
--- a/board/plankton/usb_pd_policy.c
+++ b/board/plankton/usb_pd_policy.c
@@ -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;
}