diff options
author | Ayushee Shah <ayushee.shah@intel.com> | 2020-12-09 16:15:08 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-16 21:12:30 +0000 |
commit | 397999bf301d88e04d65a9c2c1bbee1c074405a5 (patch) | |
tree | 4367fcaf20c7a6914d19c63c848b74c28138e3be | |
parent | 13975210ee624e3cfec2802d83fde06f7834cf2d (diff) | |
download | chrome-ec-397999bf301d88e04d65a9c2c1bbee1c074405a5.tar.gz |
TBT: Enter Thunderbolt mode if the cable response timesout
If the passive superspeed cable doesn't support Intel SVID, then the
Thunderbolt cable speed should be set to Passive Gen 2 cable.
Ref: USB Type-C Cable and Connector Specification, Fig F-1.
This commit, checks if the cable is superspeed before returning the
thunderbolt cable speed and sets the overridable maximum speed
supported by the board to TBT_SS_TBT_GEN3.
BUG=b:172364575
BRANCH=None
TEST=Tested on Voxel, able to enter Thunderbolt mode if the cable fails
to respond to Discover SVID SOP'
Signed-off-by: Ayushee Shah <ayushee.shah@intel.com>
Change-Id: Ib5137670c08cbe17166f5a90241ddbcb77e059f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2582988
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 21 | ||||
-rw-r--r-- | common/usb_pd_policy.c | 3 | ||||
-rw-r--r-- | common/usbc/tbt_alt_mode.c | 3 | ||||
-rw-r--r-- | include/usb_pd.h | 10 |
4 files changed, 15 insertions, 22 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index b0347067ce..8f2643ff1d 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -757,7 +757,7 @@ void set_tbt_compat_mode_ready(int port) * Ref: USB Type-C Cable and Connector Specification * Figure F-1 TBT3 Discovery Flow */ -bool is_tbt_cable_superspeed(int port) +static bool is_tbt_cable_superspeed(int port) { struct pd_discovery *disc; @@ -791,10 +791,15 @@ bool is_tbt_cable_superspeed(int port) enum tbt_compat_cable_speed get_tbt_cable_speed(int port) { - union tbt_mode_resp_cable cable_mode_resp = { - .raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME) }; - enum tbt_compat_cable_speed max_tbt_speed = - board_get_max_tbt_speed(port); + union tbt_mode_resp_cable cable_mode_resp; + enum tbt_compat_cable_speed max_tbt_speed; + + if (!is_tbt_cable_superspeed(port)) + return TBT_SS_RES_0; + + cable_mode_resp.raw_value = + pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME); + max_tbt_speed = board_get_max_tbt_speed(port); /* * Ref: USB Type-C Cable and Connector Specification, @@ -872,13 +877,9 @@ enum tbt_compat_rounded_support get_tbt_rounded_support(int port) return cable_mode_resp.tbt_rounded; } -/* Return the current cable speed received from Cable Discover Mode command */ __overridable enum tbt_compat_cable_speed board_get_max_tbt_speed(int port) { - union tbt_mode_resp_cable cable_mode_resp = { - .raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME) }; - - return cable_mode_resp.tbt_cable_speed; + return TBT_SS_TBT_GEN3; } /* * ############################################################################ diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 5ad4188e54..b480981a2d 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -487,7 +487,8 @@ static int process_am_discover_ident_sop_prime(int port, int cnt, * Disable Thunderbolt-compatible mode if the cable does not support * superspeed. */ - if (is_tbt_compat_enabled(port) && !is_tbt_cable_superspeed(port)) + if (is_tbt_compat_enabled(port) && + get_tbt_cable_speed(port) < TBT_SS_U31_GEN1) disable_tbt_compat_mode(port); return dfp_discover_svids(payload); diff --git a/common/usbc/tbt_alt_mode.c b/common/usbc/tbt_alt_mode.c index 144126baa1..23261adb5e 100644 --- a/common/usbc/tbt_alt_mode.c +++ b/common/usbc/tbt_alt_mode.c @@ -405,8 +405,7 @@ static bool tbt_mode_is_supported(int port, int vdo_count) if (!disc->identity.idh.modal_support) return false; - if (!(is_tbt_cable_superspeed(port) && - get_tbt_cable_speed(port) >= TBT_SS_U31_GEN1)) + if (get_tbt_cable_speed(port) < TBT_SS_U31_GEN1) return false; /* diff --git a/include/usb_pd.h b/include/usb_pd.h index 52557778cd..19ae64b45f 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -2168,14 +2168,6 @@ uint32_t pd_get_tbt_mode_vdo(int port, enum tcpm_transmit_type type); void set_tbt_compat_mode_ready(int port); /** - * Checks if the attached cable supports superspeed - * - * @param port USB-C port number - * @return True if cable is superspeed, false otherwise - */ -bool is_tbt_cable_superspeed(int port); - -/** * Returns Thunderbolt-compatible cable speed according to the port if, * port supports lesser speed than the cable * @@ -2197,7 +2189,7 @@ int enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop, uint32_t *payload); /** - * Return maximum allowed speed for Thunderbolt-compatible mode + * Return maximum speed supported by the port to enter into Thunderbolt mode * * NOTE: Chromebooks require that all USB-C ports support the same features, * so the maximum speed returned by this function should be set to the lowest |