diff options
author | Jan Dabros <jsd@semihalf.com> | 2021-08-13 13:49:00 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-25 17:45:27 +0000 |
commit | e85e80744d3f5777077d6970dc8a2a854ccf21ee (patch) | |
tree | eb1665feb59736fe5fbca24054a2fa54b81eb688 /board | |
parent | 533ecaa1932a70f1ad0e54fe7f9691532ba75e8e (diff) | |
download | chrome-ec-e85e80744d3f5777077d6970dc8a2a854ccf21ee.tar.gz |
servo_v4p1: Manage USB2/USB3 terminations based on data role
Previously servo_v4p1 was running with USB2 and USB3 paths always on.
This was completely ignoring data role of servo. Especially, we
shouldn't apply device terminations on USB2/USB3 lines once servo is
acting as DFP. While in this mode the only allowed configuration is to
establish FASTBOOT, that is direct connection between DUT and HOST.
Make use of the CONFIG_USBC_SS_MUX_UFP_ONLY, since USB3 muxer on servo
should be enabled only when servo is UFP.
BUG=b:137887386,b:182419010
BRANCH=main
TEST=Perform "cc snkdts" and "cc srcdts" sequence couple of time and
verify presence of all expected USB2 & USB3 devices on the DUT
side.
TEST=Another test may be to unplug and re-plug CHG connector to servo
and verify presence of all expected USB2 & USB3 devices on the DUT.
Signed-off-by: Jan Dabros <jsd@semihalf.com>
Change-Id: I54a637b67cf62f20658c8c4522a8d8ccc011d863
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3094249
Tested-by: Lukasz Hajec <lha@semihalf.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Commit-Queue: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/servo_v4p1/board.h | 1 | ||||
-rw-r--r-- | board/servo_v4p1/usb_pd_policy.c | 42 |
2 files changed, 39 insertions, 4 deletions
diff --git a/board/servo_v4p1/board.h b/board/servo_v4p1/board.h index 2462abb081..daf450ded2 100644 --- a/board/servo_v4p1/board.h +++ b/board/servo_v4p1/board.h @@ -214,6 +214,7 @@ #define CONFIG_USB_PD_ONLY_FIXED_PDOS #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USBC_SS_MUX +#define CONFIG_USBC_SS_MUX_UFP_ONLY /* Don't automatically change roles */ #undef CONFIG_USB_PD_INITIAL_DRP_STATE diff --git a/board/servo_v4p1/usb_pd_policy.c b/board/servo_v4p1/usb_pd_policy.c index e24e9dc266..645d326074 100644 --- a/board/servo_v4p1/usb_pd_policy.c +++ b/board/servo_v4p1/usb_pd_policy.c @@ -13,6 +13,7 @@ #include "host_command.h" #include "i2c.h" #include "ioexpanders.h" +#include "pathsel.h" #include "registers.h" #include "system.h" #include "task.h" @@ -802,10 +803,43 @@ __override int pd_check_data_swap(int port, __override void pd_execute_data_swap(int port, enum pd_data_role data_role) { - /* - * TODO(b/137887386): Turn on the fastboot/DFU path when data swap to - * DFP? - */ + if (port == CHG) + return; + + switch (data_role) { + case PD_ROLE_DFP: + if (cc_config & CC_FASTBOOT_DFP) { + dut_to_host(); + } else { + /* Disable USB2 lines from DUT */ + gpio_set_level(GPIO_FASTBOOT_DUTHUB_MUX_EN_L, 1); + uservo_to_host(); + } + break; + case PD_ROLE_UFP: + /* Ensure that FASTBOOT is disabled */ + gpio_set_level(GPIO_FASTBOOT_DUTHUB_MUX_SEL, 1); + + /* Enable USB2 lines */ + gpio_set_level(GPIO_FASTBOOT_DUTHUB_MUX_EN_L, 0); + + /* + * By default, uServo port will be enabled. Only if the user + * explicitly enable CC_FASTBOOT_DFP then uServo is disabled. + */ + if (!(cc_config & CC_FASTBOOT_DFP)) + uservo_to_host(); + break; + case PD_ROLE_DISCONNECTED: + /* Disable USB2 lines */ + gpio_set_level(GPIO_FASTBOOT_DUTHUB_MUX_EN_L, 1); + + if (!(cc_config & CC_FASTBOOT_DFP)) + uservo_to_host(); + break; + default: + CPRINTS("C%d: %s: Invalid data_role:%d", port, __func__, data_role); + } } __override void pd_check_pr_role(int port, |