summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyushee Shah <ayushee.shah@intel.com>2021-03-03 12:28:57 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-10 23:46:31 +0000
commit48c699413c4172bd36785d918096eb6d0ffe04a4 (patch)
treea70c5f99c575c67cd0e2303d180df420c4a8bf06
parentf7011904a602ef96d8912f37858aa6a2a03ff697 (diff)
downloadchrome-ec-48c699413c4172bd36785d918096eb6d0ffe04a4.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> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2750040 Tested-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usb_pd_alt_mode_dfp.c44
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,