summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_pd_alt_mode_dfp.c17
-rw-r--r--common/usb_pd_policy.c30
-rw-r--r--common/usbc/usb_sm.c7
-rw-r--r--driver/retimer/bb_retimer.c2
-rw-r--r--include/usb_pd.h17
5 files changed, 28 insertions, 45 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 79ac93d94e..051fa9740c 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -793,12 +793,23 @@ bool is_tbt_compat_mode(int port, int cnt, const uint32_t *payload)
PD_VDO_RESP_MODE_INTEL_TBT(payload[VDO_INDEX_IDH]);
}
-bool cable_supports_tbt_speed(int port)
+enum tbt_compat_cable_speed get_tbt_cable_speed(int port)
{
struct pd_cable *cable = pd_get_cable_attributes(port);
+ enum tbt_compat_cable_speed max_tbt_speed =
+ board_get_max_tbt_speed(port);
+
+ return cable->cable_mode_resp.tbt_cable_speed > max_tbt_speed ?
+ max_tbt_speed : cable->cable_mode_resp.tbt_cable_speed;
+}
+
+bool cable_supports_tbt_speed(int port)
+{
+ enum tbt_compat_cable_speed tbt_cable_speed =
+ get_tbt_cable_speed(port);
- return (cable->cable_mode_resp.tbt_cable_speed == TBT_SS_TBT_GEN3 ||
- cable->cable_mode_resp.tbt_cable_speed == TBT_SS_U32_GEN1_GEN2);
+ return (tbt_cable_speed == TBT_SS_TBT_GEN3 ||
+ tbt_cable_speed == TBT_SS_U32_GEN1_GEN2);
}
/*
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.
diff --git a/common/usbc/usb_sm.c b/common/usbc/usb_sm.c
index 800181f7b2..fbc227ded5 100644
--- a/common/usbc/usb_sm.c
+++ b/common/usbc/usb_sm.c
@@ -211,13 +211,6 @@ union tbt_mode_resp_device get_dev_tbt_vdo(int port)
return dev_resp;
}
-enum tbt_compat_cable_speed get_tbt_cable_speed(int port)
-{
- enum tbt_compat_cable_speed cable_speed = 0;
-
- return cable_speed;
-}
-
enum tbt_compat_rounded_support get_tbt_rounded_support(int port)
{
enum tbt_compat_rounded_support tbt_round = 0;
diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c
index 518aebd101..ea287a927b 100644
--- a/driver/retimer/bb_retimer.c
+++ b/driver/retimer/bb_retimer.c
@@ -226,7 +226,7 @@ static void retimer_set_state_dfp(int port, mux_state_t mux_state,
* 10..11b - Reserved
*/
*set_retimer_con |= BB_RETIMER_USB4_TBT_CABLE_SPEED_SUPPORT(
- cable_resp.tbt_cable_speed);
+ get_tbt_cable_speed(port));
/*
* Bits 29-28: TBT_GEN_SUPPORT
* 00b - 3rd generation TBT (10.3125 and 20.625Gb/s)
diff --git a/include/usb_pd.h b/include/usb_pd.h
index cdeaafacbe..a81a6184b3 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -2038,14 +2038,6 @@ union tbt_mode_resp_cable get_cable_tbt_vdo(int port);
union tbt_mode_resp_device get_dev_tbt_vdo(int port);
/**
- * Update Mux on entering Thunderbolt-compatible mode
- *
- * @param port USB-C port number
- * @return cable speed
- */
-enum tbt_compat_cable_speed get_tbt_cable_speed(int port);
-
-/**
* Return Thunderbolt rounded support
* Rounded support indicates if the cable can support rounding the
* frequency depending upon the cable generation.
@@ -2100,6 +2092,15 @@ bool is_intel_svid(int port, int prev_svid_cnt);
*/
bool is_tbt_compat_mode(int port, int cnt, const uint32_t *payload);
+/**
+ * Returns Thunderbolt-compatible cable speed according to the port if,
+ * port supports lesser speed than the cable
+ *
+ * @param port USB-C port number
+ * @return thunderbolt-cable cable speed
+ */
+enum tbt_compat_cable_speed get_tbt_cable_speed(int port);
+
/*
* Checks if the cable supports Thunderbolt speed.
*