summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2021-09-30 15:49:09 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-15 08:53:25 +0000
commitaebcdcde3839c41ba0a68d34e32bf7dd49fe08e9 (patch)
tree4a28628f914f012ca5094009126d66229986802a
parentbdeea873c4f4fb93d0ec0d78421e428ecbcc4635 (diff)
downloadchrome-ec-aebcdcde3839c41ba0a68d34e32bf7dd49fe08e9.tar.gz
cherry: powercycle VBUS after AP XHCI done
Implement VBUS cycle according to USB Type-C Spec R2.0: 10.3.1 Hub Downstream Facing Port State Descriptions 10.3.1.1 DSPORT.Powered-off A hub may provide power to its downstream ports all of the time to support power applications from a USB port. Such hubs must ensure that Enhanced SuperSpeed devices on its downstream-facing ports attempt Enhanced SuperSpeed connection once upstream VBUS is seen by the hub. The recommended method to achieve this is to cycle VBUS off for a duration or by actively discharging so that it is seen to be off by the downstream device. BUG=b:200772411 TEST=manually BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I674391622698b6e241b0a97063b3abbc8550e365 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195205 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--baseboard/cherry/baseboard.c16
-rw-r--r--board/cherry/gpio.inc2
2 files changed, 15 insertions, 3 deletions
diff --git a/baseboard/cherry/baseboard.c b/baseboard/cherry/baseboard.c
index 7013dc9790..e50d4114c9 100644
--- a/baseboard/cherry/baseboard.c
+++ b/baseboard/cherry/baseboard.c
@@ -49,10 +49,11 @@
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_tc_sm.h"
static void bc12_interrupt(enum gpio_signal signal);
static void ppc_interrupt(enum gpio_signal signal);
-static void usb_a0_interrupt(enum gpio_signal signal);
+static void xhci_init_done_interrupt(enum gpio_signal signal);
#include "gpio_list.h"
@@ -245,13 +246,24 @@ const int usb_port_enable[] = {
};
BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
-__maybe_unused void usb_a0_interrupt(enum gpio_signal signal)
+__maybe_unused void xhci_init_done_interrupt(enum gpio_signal signal)
{
enum usb_charge_mode mode = gpio_get_level(signal) ?
USB_CHARGE_MODE_ENABLED : USB_CHARGE_MODE_DISABLED;
for (int i = 0; i < USB_PORT_COUNT; i++)
usb_charge_set_mode(i, mode, USB_ALLOW_SUSPEND_CHARGE);
+
+ /*
+ * Trigger hard reset to cycle Vbus on Type-C ports, recommended by
+ * USB 3.2 spec 10.3.1.1.
+ */
+ if (gpio_get_level(signal)) {
+ for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
+ if (tc_is_attached_src(i))
+ pd_dpm_request(i, DPM_REQUEST_HARD_RESET_SEND);
+ }
+ }
}
/* USB Mux */
diff --git a/board/cherry/gpio.inc b/board/cherry/gpio.inc
index 3a64f56d47..8213d74cea 100644
--- a/board/cherry/gpio.inc
+++ b/board/cherry/gpio.inc
@@ -59,7 +59,7 @@ GPIO_INT(SPI0_CS, PIN(M, 5), GPIO_INT_FALLING,
spi_event) /* SPI slave Chip Select -- AP_SPI_EC_CS_L */
#ifndef BOARD_CHERRY
GPIO_INT(AP_XHCI_INIT_DONE, PIN(J, 5), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V,
- usb_a0_interrupt)
+ xhci_init_done_interrupt)
#endif
/* Power Sequencing Signals */