summaryrefslogtreecommitdiff
path: root/board/plankton/board.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2015-02-27 14:11:09 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-02 10:06:24 +0000
commit4e5c20fb07aeefdd3705bfb69d7ed40838e744ab (patch)
tree6b09b49836e020826e6ff1113b79cc222739b86f /board/plankton/board.c
parent179fcb3f1d0916f3cacea64c1d78b9644d6fa6ef (diff)
downloadchrome-ec-4e5c20fb07aeefdd3705bfb69d7ed40838e744ab.tar.gz
plankton: always run as UFP when in USB hub mode
When Plankton is in USB hub mode, running as DFP doesn't make sense. In this case, ask for a data swap. BRANCH=None BUG=chrome-os-partner:37079 TEST=With Ryu, check Plankton is always UFP no matter it's sink or source. Change-Id: I7752b8c1255234a5ea726138708fe52c5fcd47b2 Signed-off-by: Vic Yang <victoryang@google.com> Reviewed-on: https://chromium-review.googlesource.com/254713 Tested-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'board/plankton/board.c')
-rw-r--r--board/plankton/board.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c
index b081a0f479..b6c9c666ca 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -217,6 +217,20 @@ DECLARE_CONSOLE_COMMAND(usbc_action, cmd_usbc_action,
"Set Plankton type-C port state",
NULL);
+int board_in_hub_mode(void)
+{
+ int ret;
+ int level;
+
+ ret = pca9534_config_pin(I2C_PORT_MASTER, 0x40, 6, PCA9534_INPUT);
+ if (ret)
+ return -1;
+ ret = pca9534_get_level(I2C_PORT_MASTER, 0x40, 6, &level);
+ if (ret)
+ return -1;
+ return level;
+}
+
static int board_usb_hub_reset(void)
{
int ret;
@@ -233,16 +247,7 @@ static int board_usb_hub_reset(void)
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)
+ if (board_in_hub_mode() == 1)
board_usb_hub_reset();
}