diff options
author | Ayushee <ayushee.shah@intel.com> | 2020-10-14 15:00:33 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-05 20:54:15 +0000 |
commit | 7fcb1a8a8dc0cb59e432118eac4ce366132a65f7 (patch) | |
tree | d0c2b35cfd9f7ad4a42efb4aaa2034c4ca4e5c44 | |
parent | cb5058d798c53a8cb46c7cf67c2cf77f76670f3a (diff) | |
download | chrome-ec-7fcb1a8a8dc0cb59e432118eac4ce366132a65f7.tar.gz |
BB retimer: Update USB4 related bits
This CL updates the following bits:
Bit 4: USB3 bit - If active cable V3, according to Discover Idenitity
SOP response, Product VDO 2 B5. else set to 1
Bit 16: Thunderbolt support - According to B3:B5 of Discover Identity
SOP response.
Bit 19: VPro Support - If host is vPro capable and according to Discover
Mode SOP response B26/B31.
This CL also updates the thunderbolt related bits for the retimer if the
thunderbolt mode SOP' and SOP'' is entered.
BUG=b:156749387
BRANCH=None
TEST=Able to update the retimer bits on entering USB4 mode
Signed-off-by: Ayushee <ayushee.shah@intel.com>
Change-Id: Ic083001dee73d854379f1f3dfd85bebe5ee6ef5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2473597
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 1 | ||||
-rw-r--r-- | driver/retimer/bb_retimer.c | 24 | ||||
-rw-r--r-- | include/usb_pd_vdo.h | 3 |
3 files changed, 24 insertions, 4 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index a2dc62afd8..cee2a9e4e7 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -683,6 +683,7 @@ bool is_usb2_cable_support(int port) pd_get_am_discovery(port, TCPC_TX_SOP_PRIME); return disc->identity.idh.product_type == IDH_PTYPE_PCABLE || + pd_get_vdo_ver(port, TCPC_TX_SOP_PRIME) < VDM_VER20 || disc->identity.product_t2.a2_rev30.usb_20_support == USB2_SUPPORTED; } diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index 64ffa2b4dd..7c5eacdb8b 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -133,8 +133,11 @@ static void retimer_set_state_dfp(int port, mux_state_t mux_state, union tbt_mode_resp_cable cable_resp; union tbt_mode_resp_device dev_resp; enum idh_ptype cable_type = get_usb_pd_cable_type(port); + struct pd_discovery *disc; - if (mux_state & USB_PD_MUX_USB_ENABLED) { + if (mux_state & USB_PD_MUX_USB_ENABLED || + mux_state & USB_PD_MUX_TBT_COMPAT_ENABLED || + mux_state & USB_PD_MUX_USB4_ENABLED) { /* * Bit 4: USB2_CONNECTION (ignored if BIT5=0). * 0 - No USB2 Connection @@ -173,7 +176,8 @@ static void retimer_set_state_dfp(int port, mux_state_t mux_state, (cable_type == IDH_PTYPE_ACABLE)) *set_retimer_con |= BB_RETIMER_ACTIVE_PASSIVE; - if (mux_state & USB_PD_MUX_TBT_COMPAT_ENABLED) { + if (mux_state & USB_PD_MUX_TBT_COMPAT_ENABLED || + mux_state & USB_PD_MUX_USB4_ENABLED) { cable_resp.raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME); dev_resp.raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP); @@ -246,7 +250,18 @@ static void retimer_set_state_dfp(int port, mux_state_t mux_state, */ *set_retimer_con |= BB_RETIMER_TBT_CABLE_GENERATION( cable_resp.tbt_rounded); - } else if (mux_state & USB_PD_MUX_USB4_ENABLED) { + } + if (mux_state & USB_PD_MUX_USB4_ENABLED) { + disc = pd_get_am_discovery(port, TCPC_TX_SOP); + + /* + * Bit 16: TBT_CONNECTION + * 0 - Port partner doesn't support TBT3 + * 1 - Port partner supports TBT3 + */ + if (PD_PRODUCT_IS_TBT3(disc->identity.product_t1.raw_value)) + *set_retimer_con |= BB_RETIMER_TBT_CONNECTION; + /* * Bit 27-25: USB4 Cable speed * 000b - No functionality @@ -294,6 +309,9 @@ static void retimer_set_state_ufp(mux_state_t mux_state, * Bit 2: RE_TIMER_DRIVER: * Set according to b20:19 of enter USB. * + * Bit 16: TBT_CONNECTION: + * Set according to b14 of enter USB. + * * Bit 18: CABLE_TYPE: * For Thunderbolt-compat mode, set according to bit 21 of enter mode. * For USB/DP/USB4, set according to bits 20:19 of enter mode. diff --git a/include/usb_pd_vdo.h b/include/usb_pd_vdo.h index e0b1bf65dc..76772ef893 100644 --- a/include/usb_pd_vdo.h +++ b/include/usb_pd_vdo.h @@ -72,7 +72,8 @@ struct product_vdo { * 011b = USB4 Gen3 * 100b…111b = Reserved, Shall Not be used */ -#define PD_PRODUCT_IS_USB4(vdo) ((vdo) >> 27 & 0x1) +#define PD_PRODUCT_IS_USB4(vdo) ((vdo) >> 24 & BIT(3)) +#define PD_PRODUCT_IS_TBT3(vdo) ((vdo) >> 3 & BIT(0)) /*****************************************************************************/ /* |