summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-06-25 14:56:28 -0600
committerCommit Bot <commit-bot@chromium.org>2020-07-01 23:21:16 +0000
commite8bd3c057ceb1c881ccd5112b577d94cd730b7d6 (patch)
tree615a5ead4a1577e875fce7022132d2af0cc945d9
parent0891b0f1d64c440fbb79f4c1beaf974e65b9c6f6 (diff)
downloadchrome-ec-e8bd3c057ceb1c881ccd5112b577d94cd730b7d6.tar.gz
bb_retimer: add power up timing
Ensure the Burnside Bridge is held in reset when the AP is off and add a delay to reset de-assertion to meet Burnside Bridge requirements. BUG=b:159743964 BRANCH=none TEST=make buildall TEST=Verify BB initialization is skipped when the AP is off (verified with extra debug) TEST=Verify operation of USB, DP, and USB4 devices on Burnside bridge. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I4a4f05aaf84bf93b3c3032998bc811591c8fbf35 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2271697 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--driver/retimer/bb_retimer.c14
-rw-r--r--driver/usb_mux/usb_mux.c14
2 files changed, 25 insertions, 3 deletions
diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c
index 8855f049b1..b815bf1de4 100644
--- a/driver/retimer/bb_retimer.c
+++ b/driver/retimer/bb_retimer.c
@@ -6,6 +6,7 @@
*/
#include "bb_retimer.h"
+#include "chipset.h"
#include "common.h"
#include "console.h"
#include "i2c.h"
@@ -95,6 +96,12 @@ static void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
if (on_off) {
gpio_set_level(control->usb_ls_en_gpio, 1);
+ /*
+ * Tpw, minimum time from VCC to RESET_N de-assertion is 100us.
+ * For boards that don't provide a load switch control, the
+ * retimer_init() function ensures power is up before calling
+ * this function.
+ */
msleep(1);
gpio_set_level(control->retimer_rst_gpio, 1);
msleep(10);
@@ -417,6 +424,13 @@ static int retimer_init(const struct usb_mux *me)
int rv;
uint32_t data;
+ /* Burnside Bridge is powered by main AP rail */
+ if (chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF)) {
+ /* Ensure reset is asserted while chip is not powered */
+ bb_retimer_power_handle(me, 0);
+ return EC_ERROR_NOT_POWERED;
+ }
+
bb_retimer_power_handle(me, 1);
rv = bb_retimer_read(me, BB_RETIMER_REG_VENDOR_ID, &data);
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 911558905d..cfc91352bc 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -149,16 +149,24 @@ static inline void exit_low_power_mode(int port)
void usb_mux_init(int port)
{
+ int rv;
+
ASSERT(port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
if (port >= board_get_usb_pd_port_count()) {
return;
}
- configure_mux(port, USB_MUX_INIT, NULL);
+ rv = configure_mux(port, USB_MUX_INIT, NULL);
- /* Device is always out of LPM after initialization. */
- flags[port] &= ~USB_MUX_FLAG_IN_LPM;
+ /*
+ * Mux may fail initialization if it's not powered. Mark this port
+ * as in LPM mode to try initialization again.
+ */
+ if (rv == EC_ERROR_NOT_POWERED)
+ flags[port] |= USB_MUX_FLAG_IN_LPM;
+ else
+ flags[port] &= ~USB_MUX_FLAG_IN_LPM;
}
/*