diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2019-12-22 14:00:09 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-10 22:48:47 +0000 |
commit | 56404bba566db371763f93737fcafc1cfd9ca5d2 (patch) | |
tree | 65c8605cd2d2416d586eb9344dabb6c4c7ba3d60 /common/usb_common.c | |
parent | bccc832b7dbc056f464d549dd5f347277670d1b3 (diff) | |
download | chrome-ec-56404bba566db371763f93737fcafc1cfd9ca5d2.tar.gz |
TCPMv1: Correct the TBT3 Discovery and Entry Flow
Ref: USB Type-C Cable and Connector Specification 2.0
F.2 TBT3 Discovery and Entry Flow
- Corrected the TBT3 Discovery flow
- Corrected the TBT3 Entry Flow
- Enabled the Active cable TBT3 mode entry
- Refactored TBT & Cable VDO code on TCPMv1 so that same VDO
structures can be used for TCPMv2
- Corrected getting the cable version
- Cleaned up the code for super speed cable detection
BUG=b:146006708, b:140643923, b:147134610
BRANCH=none
TEST=Make buildall -j
Able to detect Thunderbolt-compatible devices on TGLRVP
Change-Id: I65f82e241d0cc2187050913e7d16942fdaa0ebd4
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1981276
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/usb_common.c')
-rw-r--r-- | common/usb_common.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/common/usb_common.c b/common/usb_common.c index 4ea06f38f8..8afd3b7b64 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -694,6 +694,23 @@ __overridable int pd_custom_vdm(int port, int cnt, uint32_t *payload, } #ifdef CONFIG_USB_PD_ALT_MODE_DFP +/* + * Before entering into alternate mode, state of the USB-C MUX + * needs to be in safe mode. + * Ref: USB Type-C Cable and Connector Specification + * Section E.2.2 Alternate Mode Electrical Requirements + */ +void usb_mux_set_safe_mode(int port) +{ + usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ? + TYPEC_MUX_SAFE : TYPEC_MUX_NONE, + USB_SWITCH_CONNECT, pd_get_polarity(port)); + + /* Isolate the SBU lines. */ + if (IS_ENABLED(CONFIG_USBC_PPC_SBU)) + ppc_set_sbu(port, 0); +} + __overridable const struct svdm_response svdm_rsp = { .identity = NULL, .svids = NULL, @@ -708,13 +725,8 @@ __overridable void svdm_safe_dp_mode(int port) /* make DP interface safe until configure */ dp_flags[port] = 0; dp_status[port] = 0; - usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ? - TYPEC_MUX_SAFE : TYPEC_MUX_NONE, - USB_SWITCH_CONNECT, pd_get_polarity(port)); - /* Isolate the SBU lines. */ - if (IS_ENABLED(CONFIG_USBC_PPC_SBU)) - ppc_set_sbu(port, 0); + usb_mux_set_safe_mode(port); } __overridable int svdm_enter_dp_mode(int port, uint32_t mode_caps) @@ -947,14 +959,6 @@ __overridable int svdm_gfu_attention(int port, uint32_t *payload) #ifdef CONFIG_USB_PD_TBT_COMPAT_MODE __overridable int svdm_tbt_compat_enter_mode(int port, uint32_t mode_caps) { - /* - * Before entering into alternate mode, state of the USB-C MUX needs to - * be in safe mode Ref: USB Type-C Cable and Connector Specification - * Section E.2.2 Alternate Mode Electrical Requirements - */ - usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ? - TYPEC_MUX_SAFE : TYPEC_MUX_NONE, USB_SWITCH_CONNECT, - pd_get_polarity(port)); return 0; } |