diff options
author | Vic Yang <victoryang@chromium.org> | 2014-09-19 11:15:45 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-23 06:28:38 +0000 |
commit | cc0843d2704cc0f2352f3ea207d0c59e42a6f934 (patch) | |
tree | 27c3a104447c6e6b0253310e8412fd764ff7bd86 /board/plankton | |
parent | 9ac7415b3cf459a7287babf995364d56afa70b81 (diff) | |
download | chrome-ec-cc0843d2704cc0f2352f3ea207d0c59e42a6f934.tar.gz |
Plankton: Add console command to reset USB hub
This command resets the USB hub through the IO expander.
BUG=None
TEST=Reset the hub on Plankton.
BRANCH=None
Change-Id: Ia77a1e326adc6aba65438534158a4c461479727a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/218758
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/plankton')
-rw-r--r-- | board/plankton/board.c | 17 | ||||
-rw-r--r-- | board/plankton/board.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c index 05fde4bbd9..cb60dcd353 100644 --- a/board/plankton/board.c +++ b/board/plankton/board.c @@ -11,6 +11,7 @@ #include "gpio.h" #include "hooks.h" #include "i2c.h" +#include "ioexpander_pca9534.h" #include "registers.h" #include "task.h" #include "timer.h" @@ -198,3 +199,19 @@ DECLARE_CONSOLE_COMMAND(usbc_action, cmd_usbc_action, "<5v|12v|20v|dev|usb|dp|flip|pol0|pol1>", "Set Plankton type-C port state", NULL); + +static int cmd_usb_hub_reset(int argc, char *argv[]) +{ + int ret; + + ret = pca9534_config_pin(I2C_PORT_MASTER, 0x40, 7, PCA9534_OUTPUT); + if (ret) + return ret; + ret = pca9534_set_level(I2C_PORT_MASTER, 0x40, 7, 0); + if (ret) + return ret; + usleep(100 * MSEC); + return pca9534_set_level(I2C_PORT_MASTER, 0x40, 7, 1); +} +DECLARE_CONSOLE_COMMAND(hub_reset, cmd_usb_hub_reset, + NULL, "Reset USB hub", NULL); diff --git a/board/plankton/board.h b/board/plankton/board.h index e5a036e7fe..323143bcd3 100644 --- a/board/plankton/board.h +++ b/board/plankton/board.h @@ -24,6 +24,7 @@ #define CONFIG_ADC #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_IO_EXPANDER_PCA9534 #undef CONFIG_WATCHDOG_HELP #undef CONFIG_LID_SWITCH #undef CONFIG_TASK_PROFILING |