summaryrefslogtreecommitdiff
path: root/common/usb_pd_alt_mode_dfp.c
diff options
context:
space:
mode:
authorAyushee <ayushee.shah@intel.com>2020-04-15 22:17:18 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-29 22:08:40 +0000
commit87063754d48a046ad9a96149996fb3cf1e02f71c (patch)
tree4dfd24ed76b15a4b243f74a7f1be85081a821096 /common/usb_pd_alt_mode_dfp.c
parent0f6844002d1dc543bd5823b2d925a5f25bd9c1de (diff)
downloadchrome-ec-87063754d48a046ad9a96149996fb3cf1e02f71c.tar.gz
BB retimer: Correct setting USB4 cable speed
For DFP, TBT/USB4_cable_speed_support is set according to a. Discover mode SOP' response for Thunderbolt-compat mode and b. Discover ID SOP' response for USB4 mode. Ref: Burnside Bridge spec Table 13: Connection state register BUG=b:152544514 BRANCH=None TEST=make buildall -j Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: Ic031489878dab701177936ea8e2f50d434dba25b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2152287 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_pd_alt_mode_dfp.c')
-rw-r--r--common/usb_pd_alt_mode_dfp.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 6d6859fceb..79ac93d94e 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -862,6 +862,37 @@ __overridable enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
return cable->cable_mode_resp.tbt_cable_speed;
}
+/*
+ * ############################################################################
+ *
+ * USB4 functions
+ *
+ * ############################################################################
+ */
+
+enum usb_rev30_ss get_usb4_cable_speed(int port)
+{
+ struct pd_cable *cable = pd_get_cable_attributes(port);
+
+ /*
+ * TODO: Return USB4 cable speed for USB3.2 Gen 2 cables if DFP isn't
+ * Gen 3 capable.
+ */
+ if ((cable->rev == PD_REV30) &&
+ (get_usb_pd_cable_type(port) == IDH_PTYPE_PCABLE) &&
+ ((cable->attr.p_rev30.ss != USB_R30_SS_U32_U40_GEN2) ||
+ !IS_ENABLED(CONFIG_USB_PD_TBT_GEN3_CAPABLE))) {
+ return cable->attr.p_rev30.ss;
+ }
+
+ /*
+ * Converting Thunderolt-Compatible cable speed to equivalent USB4 cable
+ * speed.
+ */
+ return cable->cable_mode_resp.tbt_cable_speed == TBT_SS_TBT_GEN3 ?
+ USB_R30_SS_U40_GEN3 : USB_R30_SS_U32_U40_GEN2;
+}
+
__overridable void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */