diff options
author | Ayushee Shah <ayushee.shah@intel.com> | 2021-03-03 12:28:57 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-09 22:13:41 +0000 |
commit | ccdd357e921b74553fb4006a34a6abf2fc009e55 (patch) | |
tree | c723406085806154b7f4615b060c350a345829da /common | |
parent | 0e5fa530e2f1eba6e16188be65ac39974a151a17 (diff) | |
download | chrome-ec-ccdd357e921b74553fb4006a34a6abf2fc009e55.tar.gz |
TBT/USB4: Add support for non-Thunderbolt typec cables
Passive cables that don't support Intel SVID should enter into
Thunderbolt/USB4 mode at speed from Discover Identity SOP',
USB Highest Speed field and and active cables that don't support
Intel SVID shouldn't enter into Thunderbolt mode.
Ref: TBT4 PD Discovery Flow Application Notes Revision 0.9, Figure 2
BUG=b:180950931
BRANCH=None
TEST=1. With USB4 Gen3 cables not supporting Intel SVID, able to enter
into USB4/TBT mode at 40Gbps.
2. With USB4 Gen 2 cables not supporting Intel SVID, able to enter
into USB/TBT mode at 20Gbps.
Change-Id: I2c94cf84706dc345306a038b15f49b70aa13515a
Signed-off-by: Ayushee Shah <ayushee.shah@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2733450
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index 297f6c3ad2..4039b394c2 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -809,10 +809,25 @@ static bool is_tbt_cable_superspeed(int port) USB_R20_SS_U31_GEN1_GEN2; } +static enum tbt_compat_cable_speed usb_rev30_to_tbt_speed(enum usb_rev30_ss ss) +{ + switch (ss) { + case USB_R30_SS_U32_U40_GEN1: + return TBT_SS_U31_GEN1; + case USB_R30_SS_U32_U40_GEN2: + return TBT_SS_U32_GEN1_GEN2; + case USB_R30_SS_U40_GEN3: + return TBT_SS_TBT_GEN3; + default: + return TBT_SS_U32_GEN1_GEN2; + } +} + enum tbt_compat_cable_speed get_tbt_cable_speed(int port) { union tbt_mode_resp_cable cable_mode_resp; enum tbt_compat_cable_speed max_tbt_speed; + enum tbt_compat_cable_speed cable_tbt_speed; if (!is_tbt_cable_superspeed(port)) return TBT_SS_RES_0; @@ -822,17 +837,28 @@ enum tbt_compat_cable_speed get_tbt_cable_speed(int port) max_tbt_speed = board_get_max_tbt_speed(port); /* - * Ref: USB Type-C Cable and Connector Specification, - * figure F-1 TBT3 Discovery Flow. - * If cable doesn't have Intel SVID, limit Thunderbolt cable speed to - * Passive Gen 2 cable speed. + * Ref: TBT4 PD Discovery Flow Application Notes Revision 0.9, Figure 2 + * For passive cable, if cable doesn't support USB_VID_INTEL, enter + * Thunderbolt alternate mode with speed from USB Highest Speed field of + * the Passive Cable VDO + * For active cable, if the cable doesn't support USB_VID_INTEL, do not + * enter Thunderbolt alternate mode. */ - if (!cable_mode_resp.raw_value) - return max_tbt_speed < TBT_SS_U32_GEN1_GEN2 ? - max_tbt_speed : TBT_SS_U32_GEN1_GEN2; + if (!cable_mode_resp.raw_value) { + struct pd_discovery *disc; + + if (get_usb_pd_cable_type(port) == IDH_PTYPE_ACABLE) + return TBT_SS_RES_0; + + disc = pd_get_am_discovery(port, TCPC_TX_SOP_PRIME); + cable_tbt_speed = + usb_rev30_to_tbt_speed(disc->identity.product_t1.p_rev30.ss); + } else { + cable_tbt_speed = cable_mode_resp.tbt_cable_speed; + } - return max_tbt_speed < cable_mode_resp.tbt_cable_speed ? - max_tbt_speed : cable_mode_resp.tbt_cable_speed; + return max_tbt_speed < cable_tbt_speed ? + max_tbt_speed : cable_tbt_speed; } int enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop, |