diff options
Diffstat (limited to 'board/brya/usbc_config.c')
-rw-r--r-- | board/brya/usbc_config.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/board/brya/usbc_config.c b/board/brya/usbc_config.c index 4c84b814aa..802296a66c 100644 --- a/board/brya/usbc_config.c +++ b/board/brya/usbc_config.c @@ -184,6 +184,18 @@ struct ioexpander_config_t ioex_config[] = { .drv = &nct38xx_ioexpander_drv, .flags = IOEX_FLAGS_DISABLED, }, + [IOEX_ID_1_C0_NCT38XX] = { + .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC, + .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS, + .drv = &nct38xx_ioexpander_drv, + .flags = IOEX_FLAGS_DISABLED, + }, + [IOEX_ID_1_C2_NCT38XX] = { + .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC, + .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS, + .drv = &nct38xx_ioexpander_drv, + .flags = IOEX_FLAGS_DISABLED, + }, }; BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT); @@ -208,7 +220,10 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) else rst_signal = IOEX_USB_C0_RT_RST_ODL; } else if (me->usb_port == USBC_PORT_C2) { - rst_signal = IOEX_USB_C2_RT_RST_ODL; + if (get_board_id() == 1) + rst_signal = IOEX_ID_1_USB_C2_RT_RST_ODL; + else + rst_signal = IOEX_USB_C2_RT_RST_ODL; } else { return EC_ERROR_INVAL; } @@ -288,17 +303,29 @@ void board_reset_pd_mcu(void) msleep(50); } -static void board_tcpc_init(void) +static void enable_ioex(int ioex) { - int i; + ioex_config[ioex].flags &= ~IOEX_FLAGS_DISABLED; + ioex_init(ioex); +} +static void board_tcpc_init(void) +{ /* Don't reset TCPCs after initial reset */ if (!system_jumped_late()) { board_reset_pd_mcu(); - for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; ++i) { - ioex_config[i].flags &= ~IOEX_FLAGS_DISABLED; - ioex_init(i); + /* + * These IO expander pins are implemented using the + * C0/C2 TCPC, so they must be set up after the TCPC has + * been taken out of reset. + */ + if (get_board_id() == 1) { + enable_ioex(IOEX_ID_1_C0_NCT38XX); + enable_ioex(IOEX_ID_1_C2_NCT38XX); + } else { + enable_ioex(IOEX_C0_NCT38XX); + enable_ioex(IOEX_C2_NCT38XX); } } |