summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyushee <ayushee.shah@intel.com>2020-06-22 14:28:16 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-26 09:30:42 +0000
commit5bed938efae6707f38fa2fc134551dcc708af3cf (patch)
treefb9f4483cdd9b1d7abbfca77e12fec2c0703ad73
parentd8c83aa6b30658ccb8d8ef1e46cc5d30dc491ebe (diff)
downloadchrome-ec-5bed938efae6707f38fa2fc134551dcc708af3cf.tar.gz
usb_pd: TBT: Cleanup limiting the cable speed
If the cable doesn't support Intel SVID, thunderbolt cable speed should be set to Passive Gen 2 cable. Ref: USB Type-C Cable and Connector Specification, Fig F-1. This Commit: 1. Removes setting the Thunderbolt cable speed if the Intel SVID is not supported on TCPMv1. 2. If, the cable doesn't support Intel SVID, set the maximum supported Thunderbolt cable speed according to the board's capability or TBT_SS_U32_GEN1_GEN2 cable speed 3. If, the cable supports Intel SVID, set the maximum supported Thunderbolt cable speed according to the board's or cable's capability. BUG=b:157671582 BRANCH=None TEST=Able to enter Thunderbolt-Compat mode for emark cable not supporting Intel SVID. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I1835f16dea755b96db127036350bdf60ba9c0734 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259518 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usb_pd_alt_mode_dfp.c14
-rw-r--r--common/usb_pd_policy.c14
2 files changed, 14 insertions, 14 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 2310c47d0e..b39f37a4e8 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -815,7 +815,17 @@ enum tbt_compat_cable_speed get_tbt_cable_speed(int port)
enum tbt_compat_cable_speed max_tbt_speed =
board_get_max_tbt_speed(port);
- return cable_mode_resp.tbt_cable_speed > max_tbt_speed ?
+ /*
+ * 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.
+ */
+ if (!cable_mode_resp.raw_value)
+ return max_tbt_speed < TBT_SS_U32_GEN1_GEN2 ?
+ max_tbt_speed : TBT_SS_U32_GEN1_GEN2;
+
+ return max_tbt_speed < cable_mode_resp.tbt_cable_speed ?
max_tbt_speed : cable_mode_resp.tbt_cable_speed;
}
@@ -850,7 +860,7 @@ int enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop,
get_usb_pd_cable_type(port) == IDH_PTYPE_PCABLE ?
TBT_ENTER_PASSIVE_CABLE : TBT_ENTER_ACTIVE_CABLE;
- if (cable_mode_resp.tbt_cable_speed == TBT_SS_TBT_GEN3) {
+ if (get_tbt_cable_speed(port) == TBT_SS_TBT_GEN3) {
enter_dev_mode.lsrx_comm =
cable_mode_resp.lsrx_comm;
enter_dev_mode.retimer_type =
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 28f7e8b265..53b460cd97 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -506,7 +506,6 @@ static int process_tbt_compat_discover_modes(int port,
enum tcpm_transmit_type *rtype)
{
int rsize;
- struct pd_discovery *disc;
/* Initialize transmit type to SOP */
*rtype = TCPC_TX_SOP;
@@ -547,22 +546,13 @@ static int process_tbt_compat_discover_modes(int port,
} else {
/* Store Discover Mode SOP response */
cable[port].dev_mode_resp.raw_value = payload[1];
- disc = &discovery[port][TCPC_TX_SOP_PRIME];
if (is_limit_tbt_cable_speed(port)) {
/*
* Passive cable has Nacked for Discover SVID.
- * No need to do Discover modes of cable. Assign the
- * cable discovery attributes and enter into device
- * Thunderbolt-compatible mode.
+ * No need to do Discover modes of cable.
+ * Enter into device Thunderbolt-compatible mode.
*/
- cable[port].cable_mode_resp.tbt_cable_speed =
- cable[port].rev == PD_REV30 &&
- (disc->identity.product_t1.p_rev30.ss >
- USB_R30_SS_U32_U40_GEN2) ?
- TBT_SS_U32_GEN1_GEN2 :
- disc->identity.product_t1.p_rev30.ss;
-
rsize = enter_tbt_compat_mode(port, *rtype, payload);
} else {
/* Discover modes for SOP' */