diff options
author | Ayushee <ayushee.shah@intel.com> | 2019-10-30 11:44:47 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-31 01:49:46 +0000 |
commit | 960c81613c021763fad4c2f352f5c03b4b552107 (patch) | |
tree | 326fc88dae55d7ea4b61ac02f7d9034f05672f66 | |
parent | 6d26f78208fbaab8a41264b52bee36eee3668bcc (diff) | |
download | chrome-ec-960c81613c021763fad4c2f352f5c03b4b552107.tar.gz |
Burnside bridge retimer: Add USB4 mode bits
Intel burnside bridge retimer supports the ability to train the
link and operate both USB4 Gen2(10Gbps) and USB4 Gen3(20Gbps)
Adding the following fields in the configuration register
of the retimer to USB4 mode:
1. Active cable - Active/passive cable
2. Cable type - Optical or Electrical
3. Active link training - Unidirectional or bidirectional link
training
4. USB4 cable speed - 10Gbps/20Gbps active/passive cable
5. USB4 Generation - 3rd Generation or 4th Generation
Thunderbolt cable
BRANCH=None
BUG=b:140819518
TEST=Able to configure the retimer in USB4 mode on TGLRVP
Change-Id: I3d6bfd92eccc4881dac2b892926aafc2281e2a12
Signed-off-by: Ayushee <ayushee.shah@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1926383
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
-rw-r--r-- | driver/retimer/bb_retimer.c | 58 | ||||
-rw-r--r-- | driver/retimer/bb_retimer.h | 1 |
2 files changed, 37 insertions, 22 deletions
diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index f2e378f11e..61a84c4116 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -18,7 +18,8 @@ #define BB_RETIMER_WRITE_SIZE (BB_RETIMER_REG_SIZE + 2) #define BB_RETIMER_MUX_DATA_PRESENT (USB_PD_MUX_USB_ENABLED \ | USB_PD_MUX_DP_ENABLED \ - | USB_PD_MUX_TBT_COMPAT_ENABLED) + | USB_PD_MUX_TBT_COMPAT_ENABLED \ + | USB_PD_MUX_USB4_ENABLED) #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) @@ -193,7 +194,8 @@ static int retimer_set_state(int port, mux_state_t mux_state) if (pd_is_debug_acc(port)) set_retimer_con |= BB_RETIMER_DEBUG_ACCESSORY_MODE; - if (mux_state & USB_PD_MUX_TBT_COMPAT_ENABLED) { + if (mux_state & (USB_PD_MUX_TBT_COMPAT_ENABLED | + USB_PD_MUX_USB4_ENABLED)) { cable_resp = get_cable_tbt_vdo(port); dev_resp = get_dev_tbt_vdo(port); @@ -210,15 +212,27 @@ static int retimer_set_state(int port, mux_state_t mux_state) * 0 - TBT not configured * 1 - TBT configured */ - set_retimer_con |= BB_RETIMER_TBT_CONNECTION; + if (mux_state & USB_PD_MUX_TBT_COMPAT_ENABLED) { + set_retimer_con |= BB_RETIMER_TBT_CONNECTION; - /* - * Bit 17: TBT_TYPE - * 0 - Type-C to Type-C Cable - * 1 - Type-C Legacy TBT Adapter - */ - if (dev_resp.tbt_adapter == TBT_ADAPTER_TBT2_LEGACY) - set_retimer_con |= BB_RETIMER_TBT_TYPE; + /* + * Bit 17: TBT_TYPE + * 0 - Type-C to Type-C Cable + * 1 - Type-C Legacy TBT Adapter + */ + if (dev_resp.tbt_adapter == TBT_ADAPTER_TBT2_LEGACY) + set_retimer_con |= BB_RETIMER_TBT_TYPE; + + /* + * Bits 29-28: TBT_GEN_SUPPORT + * 00b - 3rd generation TBT (10.3125 and 20.625Gb/s) + * 01b - 4th generation TBT (10.00005Gb/s, 10.3125Gb/s, + * 20.0625Gb/s, 20.000Gb/s) + * 10..11b - Reserved + */ + set_retimer_con |= BB_RETIMER_TBT_CABLE_GENERATION( + cable_resp.tbt_rounded); + } /* * Bit 18: CABLE_TYPE @@ -247,23 +261,23 @@ static int retimer_set_state(int port, mux_state_t mux_state) } /* - * Bits 27-25: TBT_CABLE_SPEED_SUPPORT - * 000b - No Functionality - * 001b - USB3.1 gen1 cable - * 010b - 10Gb/s - * 011b -10Gb/s and 20Gb/s + * Bit 23: USB4 Connection + * 0 - USB4 not configured + * 1 - USB4 Configured */ - set_retimer_con |= BB_RETIMER_TBT_CABLE_SPEED_SUPPORT( - cable_resp.tbt_cable_speed); + if (mux_state & USB_PD_MUX_USB4_ENABLED) + set_retimer_con |= BB_RETIMER_USB4_ENABLED; /* - * Bits 29-28: TBT_GEN_SUPPORT - * 00b - 3rd generation TBT (10.3125 and 20.625Gb/s) - * 01b - 4th generation TBT (10.0, 10.3125, 20.0, 20.625) + * Bit 27-25: TBT/USB4 Cable speed + * 000b - No functionality + * 001b - USB3.1 Gen1 Cable + * 010b - 10Gb/s + * 011b - 10Gb/s and 20Gb/s * 10..11b - Reserved */ - set_retimer_con |= BB_RETIMER_TBT_CABLE_GENERATION( - cable_resp.tbt_rounded); + set_retimer_con |= BB_RETIMER_TBT_CABLE_SPEED_SUPPORT( + cable_resp.tbt_cable_speed); } /* Writing the register4 */ return bb_retimer_write(port, BB_RETIMER_REG_CONNECTION_STATE, diff --git a/driver/retimer/bb_retimer.h b/driver/retimer/bb_retimer.h index d7445c5029..4ca3b49f8f 100644 --- a/driver/retimer/bb_retimer.h +++ b/driver/retimer/bb_retimer.h @@ -35,6 +35,7 @@ #define BB_RETIMER_TBT_CABLE_TYPE BIT(18) #define BB_RETIMER_TBT_ACTIVE_LINK_TRAINING BIT(20) #define BB_RETIMER_ACTIVE_PASSIVE BIT(22) +#define BB_RETIMER_USB4_ENABLED BIT(23) #define BB_RETIMER_TBT_CABLE_SPEED_SUPPORT(x) (((x) & 0x7) << 25) #define BB_RETIMER_TBT_CABLE_GENERATION(x) (((x) & 0x3) << 28) |