diff options
-rw-r--r-- | baseboard/intelrvp/retimer.c | 2 | ||||
-rw-r--r-- | baseboard/volteer/baseboard.c | 16 | ||||
-rw-r--r-- | baseboard/volteer/baseboard.h | 5 | ||||
-rw-r--r-- | board/tglrvpu_ite/board.h | 4 | ||||
-rw-r--r-- | board/volteer/gpio.inc | 7 | ||||
-rw-r--r-- | driver/retimer/bb_retimer.c | 14 | ||||
-rw-r--r-- | include/usb_mux.h | 3 |
7 files changed, 41 insertions, 10 deletions
diff --git a/baseboard/intelrvp/retimer.c b/baseboard/intelrvp/retimer.c index 2759e13dde..e31b1a0851 100644 --- a/baseboard/intelrvp/retimer.c +++ b/baseboard/intelrvp/retimer.c @@ -16,6 +16,7 @@ struct usb_retimer usb_retimers[CONFIG_USB_PD_PORT_MAX_COUNT] = { .driver = &bb_usb_retimer, .i2c_port = I2C_PORT0_BB_RETIMER, .i2c_addr_flags = I2C_PORT0_BB_RETIMER_ADDR, + .shared_nvm = USB_PORT0_BB_RETIMER_SHARED_NVM, .usb_ls_en_gpio = GPIO_USB_C0_LS_EN, .retimer_rst_gpio = GPIO_USB_C0_RETIMER_RST, .force_power_gpio = GPIO_USB_C0_RETIMER_FORCE_PWR, @@ -25,6 +26,7 @@ struct usb_retimer usb_retimers[CONFIG_USB_PD_PORT_MAX_COUNT] = { .driver = &bb_usb_retimer, .i2c_port = I2C_PORT1_BB_RETIMER, .i2c_addr_flags = I2C_PORT1_BB_RETIMER_ADDR, + .shared_nvm = USB_PORT1_BB_RETIMER_SHARED_NVM, .usb_ls_en_gpio = GPIO_USB_C1_LS_EN, .retimer_rst_gpio = GPIO_USB_C1_RETIMER_RST, .force_power_gpio = GPIO_USB_C1_RETIMER_FORCE_PWR, diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c index de403eaaa2..05c391e1c6 100644 --- a/baseboard/volteer/baseboard.c +++ b/baseboard/volteer/baseboard.c @@ -5,6 +5,7 @@ /* Volteer family-specific configuration */ #include "adc_chip.h" +#include "bb_retimer.h" #include "charge_manager.h" #include "charge_state.h" #include "driver/bc12/pi3usb9201.h" @@ -361,6 +362,21 @@ struct usb_mux usb_muxes[] = { }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); +struct usb_retimer usb_retimers[] = { + [USBC_PORT_C0] = { + /* USB-C port 0 doesn't have a retimer */ + }, + [USBC_PORT_C1] = { + .driver = &bb_usb_retimer, + .i2c_port = I2C_PORT_USB_1_MIX, + .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, + .shared_nvm = false, + .usb_ls_en_gpio = GPIO_USB_C1_LS_EN, + .retimer_rst_gpio = GPIO_USB_C1_RT_RST_ODL, + .force_power_gpio = GPIO_USB_C1_RT_FORCE_PWR, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(usb_retimers) == USBC_PORT_COUNT); static void baseboard_tcpc_init(void) { diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h index b2ff5e6c61..38f29a3eac 100644 --- a/baseboard/volteer/baseboard.h +++ b/baseboard/volteer/baseboard.h @@ -140,6 +140,11 @@ #define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */ #define PD_VCONN_SWAP_DELAY 5000 /* us */ +/* Retimer */ +#define CONFIG_USBC_MUX_RETIMER +#define CONFIG_USBC_RETIMER_INTEL_BB +#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40 + /* * SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C * cables only support up to 60W. diff --git a/board/tglrvpu_ite/board.h b/board/tglrvpu_ite/board.h index 408c8a078d..f574f42c3c 100644 --- a/board/tglrvpu_ite/board.h +++ b/board/tglrvpu_ite/board.h @@ -77,13 +77,13 @@ #define I2C_PORT1_BB_RETIMER_ADDR 0x43 /* BB retimer nvm is shared between port 0 & 1 */ - #define BB_RETIMER_SHARED_NVM 1 + #define BB_RETIMER_SHARED_NVM true #else /* BOARD_TGLRVPY_ITE */ #define I2C_PORT0_BB_RETIMER_ADDR 0x42 #define I2C_PORT1_BB_RETIMER_ADDR 0x41 /* BB retimers have respective nvm for port 0 & 1 */ - #define BB_RETIMER_SHARED_NVM 0 + #define BB_RETIMER_SHARED_NVM false #endif /* BOARD_TGLRVPU_ITE */ #define USB_PORT0_BB_RETIMER_SHARED_NVM BB_RETIMER_SHARED_NVM #define USB_PORT1_BB_RETIMER_SHARED_NVM BB_RETIMER_SHARED_NVM diff --git a/board/volteer/gpio.inc b/board/volteer/gpio.inc index 5f6c213adf..0324f94bb9 100644 --- a/board/volteer/gpio.inc +++ b/board/volteer/gpio.inc @@ -88,6 +88,13 @@ GPIO(EC_PCH_INT_ODL, PIN(D, 6), GPIO_ODR_HIGH) /* TODO - b/140557015 - /* USB and USBC Signals */ GPIO(EN_PP3300_AG, PIN(8, 5), GPIO_OUT_LOW) +/* TODO - b/145560203 route USB_C1_RT_RST_ODL to EC */ +UNIMPLEMENTED(USB_C1_RT_RST_ODL) +/* Don't have a load switch for retimer */ +UNIMPLEMENTED(USB_C1_LS_EN) +/* Retimer Force Power enable is connected to AP */ +UNIMPLEMENTED(USB_C1_RT_FORCE_PWR) + /* Misc Signals */ /* This selects between an LED module on the motherboard and one on the daughter * board, to be controlled by LED{1,2,3}. Select the one on the motherboard by diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index 9a0caf5c4e..64112b6769 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -86,14 +86,11 @@ static void bb_retimer_power_handle(int port, int on_off) gpio_set_level(retimer->force_power_gpio, 1); /* - * If BB retimer NVM is shared between two ports allow 40ms - * time for both retimers to be initialized. Else allow 20ms - * to initialize. + * If BB retimer NVM is shared between multiple ports, allow + * 40ms time for all the retimers to be initialized. + * Else allow 20ms to initialize. */ - if ((USB_PORT0_BB_RETIMER_SHARED_NVM && - (port == TYPE_C_PORT_0)) || - (USB_PORT1_BB_RETIMER_SHARED_NVM && - (port == TYPE_C_PORT_1))) + if (retimer->shared_nvm) msleep(40); else msleep(20); @@ -250,7 +247,8 @@ static int console_command_bb_retimer(int argc, char **argv) /* Get port number */ port = strtoi(argv[1], &e, 0); - if (*e || port < 0 || port > board_get_usb_pd_port_count()) + if (*e || port < 0 || port > board_get_usb_pd_port_count() || + !usb_retimers[port].driver) return EC_ERROR_PARAM1; /* Validate r/w selection */ diff --git a/include/usb_mux.h b/include/usb_mux.h index c628cfc869..2b2d091470 100644 --- a/include/usb_mux.h +++ b/include/usb_mux.h @@ -188,6 +188,9 @@ struct usb_retimer { const int i2c_port; const uint16_t i2c_addr_flags; + /* NVM flag if shared with multiple retimers */ + const bool shared_nvm; + /* Retimer control GPIOs */ const enum gpio_signal gpio_enable; /* Retimer enable */ const enum gpio_signal gpio_dp_enable; /* DP Mode enable */ |