summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}
/*