summaryrefslogtreecommitdiff
path: root/board/gingerbread
diff options
context:
space:
mode:
Diffstat (limited to 'board/gingerbread')
-rw-r--r--board/gingerbread/board.c43
-rw-r--r--board/gingerbread/gpio.inc4
2 files changed, 45 insertions, 2 deletions
diff --git a/board/gingerbread/board.c b/board/gingerbread/board.c
index 6a2ae0c683..4c4911dbf2 100644
--- a/board/gingerbread/board.c
+++ b/board/gingerbread/board.c
@@ -152,6 +152,20 @@ struct ppc_config_t ppc_chips[] = {
#endif
#ifdef SECTION_IS_RW
+
+/* TUSB1064 set mux board tuning for DP Rx path */
+static int board_tusb1064_dp_rx_eq_set(const struct usb_mux *me,
+ mux_state_t mux_state)
+{
+ int rv = EC_SUCCESS;
+
+ /* DP specific config */
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
+ rv = tusb1064_set_dp_rx_eq(me, TUSB1064_DP_EQ_RX_8_9_DB);
+
+ return rv;
+}
+
/*
* TCPCs: 2 USBC/PD ports
* port 0 -> host port -> STM32G4 UCPD
@@ -178,6 +192,7 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.i2c_port = I2C_PORT_I2C1,
.i2c_addr_flags = TUSB1064_I2C_ADDR0_FLAGS,
.driver = &tusb1064_usb_mux_driver,
+ .board_set = &board_tusb1064_dp_rx_eq_set,
},
[USB_PD_PORT_DP] = {
.usb_port = USB_PD_PORT_DP,
@@ -311,6 +326,34 @@ int dock_get_mf_preference(void)
return mf;
}
+static void board_usb_tc_connect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /*
+ * The EC needs to keep the USB hubs in reset until the host port is
+ * attached so that the USB-EP can be properly enumerated.
+ */
+ if (port == USB_PD_PORT_HOST) {
+ gpio_set_level(GPIO_EC_HUB1_RESET_L, 1);
+ gpio_set_level(GPIO_EC_HUB2_RESET_L, 1);
+ }
+}
+DECLARE_HOOK(HOOK_USB_PD_CONNECT, board_usb_tc_connect, HOOK_PRIO_DEFAULT);
+
+static void board_usb_tc_disconnect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /* Only the host port disconnect is relevant */
+ if (port == USB_PD_PORT_HOST) {
+ gpio_set_level(GPIO_EC_HUB1_RESET_L, 0);
+ gpio_set_level(GPIO_EC_HUB2_RESET_L, 0);
+ }
+}
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+ HOOK_PRIO_DEFAULT);
+
#endif /* SECTION_IS_RW */
static void board_init(void)
diff --git a/board/gingerbread/gpio.inc b/board/gingerbread/gpio.inc
index 5b7b3a9619..6226ff747e 100644
--- a/board/gingerbread/gpio.inc
+++ b/board/gingerbread/gpio.inc
@@ -57,8 +57,8 @@ GPIO(DEBUG_GPIO1, PIN(B, 13), GPIO_OUT_LOW)
* USB CDP enables. */
GPIO(USB3_A1_CDP_EN, PIN(E, 7), GPIO_OUT_LOW)
GPIO(USB3_A2_CDP_EN, PIN(E, 8), GPIO_OUT_LOW)
-GPIO(USB3_P3_CDP_EN, PIN(D, 1), GPIO_OUT_LOW)
-GPIO(USB3_P4_CDP_EN, PIN(E, 12), GPIO_OUT_LOW)
+GPIO(USB3_P3_CDP_EN, PIN(D, 1), GPIO_OUT_HIGH)
+GPIO(USB3_P4_CDP_EN, PIN(E, 12), GPIO_OUT_HIGH)
/* Write protect */
GPIO(EC_FLASH_WP_ODL, PIN(A, 3), GPIO_ODR_HIGH)