summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-04-15 10:21:40 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-21 01:49:39 +0000
commit378f043758d4022bd6d19541446362f634418dde (patch)
tree87a2c321cc72de40f565a1b60d4a53e092c628e0 /driver
parent721eea946601251afe92c5affb94bb7e208b5336 (diff)
downloadchrome-ec-378f043758d4022bd6d19541446362f634418dde.tar.gz
BB retimer: Add 'USB2_connection' bit
USB2_CONNECTION bit is set to 1 if the cable is either Passive or a Gen3 active cable with USB2.0 support. Hence, added a function that indicates if the cable supports USB2 connection. Ref: Burnside Bridge spec Table 13: Connection state register BUG=b:152544514 BRANCH=None TEST=Tested on volteer by connecting a dock using a Gen3 Active cable with a USB2.0 connected to the dock, able to set USB2_connection bit. Change-Id: I125182b23becaa7d00011f6eadb1916b48c79803 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2139278 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/retimer/bb_retimer.c58
-rw-r--r--driver/retimer/bb_retimer.h1
2 files changed, 48 insertions, 11 deletions
diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c
index 54da07c110..98b28dc663 100644
--- a/driver/retimer/bb_retimer.c
+++ b/driver/retimer/bb_retimer.c
@@ -109,6 +109,46 @@ static void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
}
}
+static void retimer_set_state_dfp(int port, mux_state_t mux_state,
+ uint32_t *set_retimer_con)
+{
+ if (mux_state & USB_PD_MUX_USB_ENABLED) {
+ /*
+ * Bit 4: USB2_CONNECTION (ignored if BIT5=0).
+ * 0 - No USB2 Connection
+ * 1 - USB2 connection
+ *
+ * For passive cable, USB2_CONNECTION = 1
+ * For active cable, USB2_CONNECTION =
+ * According to Active cable VDO2 Bit 5, USB 2.0 support.
+ */
+ if (is_usb2_cable_support(port))
+ *set_retimer_con |= BB_RETIMER_USB_2_CONNECTION;
+ }
+}
+
+static void retimer_set_state_ufp(mux_state_t mux_state,
+ uint32_t *set_retimer_con)
+{
+ if (mux_state & USB_PD_MUX_USB_ENABLED) {
+ /*
+ * Bit 4: USB2_CONNECTION (ignored if BIT5=0).
+ * 0 - No USB2 Connection
+ * 1 - USB2 connection
+ *
+ * Don't care
+ */
+
+ /*
+ * Bit 7: USB_DATA_ROLE for the Burnside Bridge side of
+ * connection (ignored if BIT5=0).
+ * 0 - DFP
+ * 1 - UFP
+ */
+ *set_retimer_con |= BB_RETIMER_USB_DATA_ROLE;
+ }
+}
+
/**
* Driver interface functions
*/
@@ -141,19 +181,9 @@ static int retimer_set_state(const struct usb_mux *me, mux_state_t mux_state)
* 0 - No USB3.1 Connection
* 1 - USB3.1 connection
*/
- if (mux_state & USB_PD_MUX_USB_ENABLED) {
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
set_retimer_con |= BB_RETIMER_USB_3_CONNECTION;
- /*
- * Bit 7: USB_DATA_ROLE for the Burnside Bridge side of
- * connection (ignored if BIT5=0).
- * 0 - DFP
- * 1 - UFP
- */
- if (pd_get_data_role(port) == PD_ROLE_UFP)
- set_retimer_con |= BB_RETIMER_USB_DATA_ROLE;
- }
-
/*
* Bit 8: DP_CONNECTION
* 0 – No DP connection
@@ -275,6 +305,12 @@ static int retimer_set_state(const struct usb_mux *me, mux_state_t mux_state)
set_retimer_con |= BB_RETIMER_TBT_CABLE_SPEED_SUPPORT(
cable_resp.tbt_cable_speed);
}
+
+ if (pd_get_data_role(port) == PD_ROLE_DFP)
+ retimer_set_state_dfp(port, mux_state, &set_retimer_con);
+ else
+ retimer_set_state_ufp(mux_state, &set_retimer_con);
+
/* Writing the register4 */
return bb_retimer_write(me, BB_RETIMER_REG_CONNECTION_STATE,
set_retimer_con);
diff --git a/driver/retimer/bb_retimer.h b/driver/retimer/bb_retimer.h
index af9911567b..6e1c726c95 100644
--- a/driver/retimer/bb_retimer.h
+++ b/driver/retimer/bb_retimer.h
@@ -23,6 +23,7 @@
#define BB_RETIMER_DATA_CONNECTION_PRESENT BIT(0)
#define BB_RETIMER_CONNECTION_ORIENTATION BIT(1)
#define BB_RETIMER_RE_TIMER_DRIVER BIT(2)
+#define BB_RETIMER_USB_2_CONNECTION BIT(4)
#define BB_RETIMER_USB_3_CONNECTION BIT(5)
#define BB_RETIMER_USB_DATA_ROLE BIT(7)
#define BB_RETIMER_DP_CONNECTION BIT(8)