diff options
author | Ayushee <ayushee.shah@intel.com> | 2020-06-01 23:21:21 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-05 10:15:37 +0000 |
commit | c9e0e383c9279c07ddcfa12c604a259da665bebb (patch) | |
tree | 3267034f24ca5b61bd0bf134663ad0ae6a3d03ac /common/usb_pd_policy.c | |
parent | 86aacabcd3c2e496a43d291d9dee61e29edcc2d0 (diff) | |
download | chrome-ec-c9e0e383c9279c07ddcfa12c604a259da665bebb.tar.gz |
usb_pd: TBT: Refactor limiting the cable speed
Refactored 'get_tbt_cable_speed()' to return thunderbolt-compatible speed
as per the speed supported by DUT's port or cable speed whichever is
lowest.
Also removed 'usb_pd_limit_cable_speed()' to retain cables's actual VDO
response.
BUG=b:157671582
BRANCH=none
TEST=Able to limit thunderbolt cable speed, if the cable speed is higher
than the speed supported by DUT's port.
Signed-off-by: Ayushee <ayushee.shah@intel.com>
Change-Id: I77d3efddb425daa7bd12e9ed21be7088074285bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227088
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_pd_policy.c')
-rw-r--r-- | common/usb_pd_policy.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index e5df19db5d..38bb04f83b 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -211,12 +211,6 @@ union tbt_mode_resp_device get_dev_tbt_vdo(int port) return cable[port].dev_mode_resp; } -enum tbt_compat_cable_speed get_tbt_cable_speed(int port) -{ - /* tbt_cable_speed is zero when uninitialized */ - return cable[port].cable_mode_resp.tbt_cable_speed; -} - enum tbt_compat_rounded_support get_tbt_rounded_support(int port) { /* tbt_rounded_support is zero when uninitialized */ @@ -517,20 +511,6 @@ static enum tcpm_transmit_type get_tcpm_transmit_msg_type(int port) return TCPC_TX_SOP; } -static void usb_pd_limit_cable_speed(int port) -{ - enum tbt_compat_cable_speed max_tbt_speed = - board_get_max_tbt_speed(port); - - /* Cable does not have Intel SVID for Discover SVID */ - if (is_limit_tbt_cable_speed(port)) - cable[port].cable_mode_resp.tbt_cable_speed = - TBT_SS_U32_GEN1_GEN2; - - if (cable[port].cable_mode_resp.tbt_cable_speed > max_tbt_speed) - cable[port].cable_mode_resp.tbt_cable_speed = max_tbt_speed; -} - static int process_am_discover_svids(int port, int cnt, uint32_t *payload) { int prev_svid_cnt = discovery[port].svid_cnt; @@ -547,7 +527,8 @@ static int process_am_discover_svids(int port, int cnt, uint32_t *payload) * figure F-1: TBT3 Discovery Flow * * For USB4 mode if device or cable doesn't have Intel SVID, - * disable Thunderbolt-Compatible mode directly enter USB4 mode. + * disable Thunderbolt-Compatible mode directly enter USB4 mode + * with USB3.2 Gen1/Gen2 speed. * * For Thunderbolt-compatible, check if 0x8087 is received for * Discover SVID SOP. If not, disable Thunderbolt-compatible mode @@ -561,8 +542,8 @@ static int process_am_discover_svids(int port, int cnt, uint32_t *payload) if (!intel_svid) { if (is_usb4_mode_enabled(port)) { disable_tbt_compat_mode(port); - limit_tbt_cable_speed(port); - usb_pd_limit_cable_speed(port); + cable[port].cable_mode_resp.tbt_cable_speed = + TBT_SS_U32_GEN1_GEN2; enable_enter_usb4_mode(port); usb_mux_set_safe_mode(port); if (is_transmit_msg_sop_prime(port)) @@ -599,9 +580,6 @@ static int process_tbt_compat_discover_modes(int port, /* Store Discover Mode SOP' response */ cable[port].cable_mode_resp.raw_value = payload[1]; - /* Limits cable speed if applicable */ - usb_pd_limit_cable_speed(port); - /* * Enter Mode SOP' (Cable Enter Mode) and Enter USB SOP' is * skipped for passive cables. |