diff options
-rw-r--r-- | baseboard/octopus/baseboard.c | 3 | ||||
-rw-r--r-- | baseboard/octopus/variant_usbc_ec_tcpcs.c | 5 | ||||
-rw-r--r-- | baseboard/octopus/variant_usbc_standalone_tcpcs.c | 4 | ||||
-rw-r--r-- | board/ampton/board.c | 38 | ||||
-rw-r--r-- | board/ampton/gpio.inc | 2 |
5 files changed, 46 insertions, 6 deletions
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c index 7dc7c47e07..30a450e991 100644 --- a/baseboard/octopus/baseboard.c +++ b/baseboard/octopus/baseboard.c @@ -212,7 +212,8 @@ void baseboard_tcpc_init(void) mux->hpd_update(port, 0, 0); } } -DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 1); +/* Called after the cbi_init (via +2) */ +DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 2); int board_set_active_charge_port(int port) { diff --git a/baseboard/octopus/variant_usbc_ec_tcpcs.c b/baseboard/octopus/variant_usbc_ec_tcpcs.c index ead689bf80..cb137ee06f 100644 --- a/baseboard/octopus/variant_usbc_ec_tcpcs.c +++ b/baseboard/octopus/variant_usbc_ec_tcpcs.c @@ -60,6 +60,7 @@ static void board_it83xx_hpd_status(int port, int hpd_lvl, int hpd_irq) } } +/* This configuration might be override by each boards */ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ITE_0] = { /* Driver uses I2C_PORT_USB_MUX as I2C port */ @@ -102,8 +103,8 @@ void variant_tcpc_init(void) gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL); gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL); } -/* Called after the baseboard_tcpc_init (via +2) */ -DECLARE_HOOK(HOOK_INIT, variant_tcpc_init, HOOK_PRIO_INIT_I2C + 2); +/* Called after the baseboard_tcpc_init (via +3) */ +DECLARE_HOOK(HOOK_INIT, variant_tcpc_init, HOOK_PRIO_INIT_I2C + 3); uint16_t tcpc_get_alert_status(void) { diff --git a/baseboard/octopus/variant_usbc_standalone_tcpcs.c b/baseboard/octopus/variant_usbc_standalone_tcpcs.c index ec2c65bd23..09cac5f575 100644 --- a/baseboard/octopus/variant_usbc_standalone_tcpcs.c +++ b/baseboard/octopus/variant_usbc_standalone_tcpcs.c @@ -116,8 +116,8 @@ void variant_tcpc_init(void) gpio_enable_interrupt(GPIO_USB_C0_MUX_INT_ODL); gpio_enable_interrupt(GPIO_USB_C1_MUX_INT_ODL); } -/* Called after the baseboard_tcpc_init (via +2) */ -DECLARE_HOOK(HOOK_INIT, variant_tcpc_init, HOOK_PRIO_INIT_I2C + 2); +/* Called after the baseboard_tcpc_init (via +3) */ +DECLARE_HOOK(HOOK_INIT, variant_tcpc_init, HOOK_PRIO_INIT_I2C + 3); uint16_t tcpc_get_alert_status(void) { diff --git a/board/ampton/board.c b/board/ampton/board.c index 7f4b7b07b3..065aea53f2 100644 --- a/board/ampton/board.c +++ b/board/ampton/board.c @@ -60,6 +60,31 @@ int ppc_get_alert_status(int port) #include "gpio_list.h" /* Must come after other header files. */ /******************************************************************************/ +/* USB-C MUX Configuration */ + +#define USB_PD_PORT_ITE_0 0 +#define USB_PD_PORT_ITE_1 1 + +struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { + [USB_PD_PORT_ITE_0] = { + /* Use PS8751 as mux only */ + .port_addr = MUX_PORT_AND_ADDR( + I2C_PORT_USBC0, PS8751_I2C_ADDR1), + .flags = USB_MUX_FLAG_NOT_TCPC, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, + [USB_PD_PORT_ITE_1] = { + /* Use PS8751 as mux only */ + .port_addr = MUX_PORT_AND_ADDR( + I2C_PORT_USBC1, PS8751_I2C_ADDR1), + .flags = USB_MUX_FLAG_NOT_TCPC, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + } +}; + +/******************************************************************************/ /* ADC channels */ const struct adc_t adc_channels[] = { /* Vbus C0 sensing (10x voltage divider). PPVAR_USB_C0_VBUS */ @@ -226,6 +251,14 @@ static void board_update_sensor_config_from_sku(void) } } +static void board_customize_usbc_mux(uint32_t board_version) +{ + if (board_version > 0) { + /* not proto, override the mux setting */ + memcpy(usb_muxes, ampton_usb_muxes, sizeof(ampton_usb_muxes)); + } +} + /* Read CBI from i2c eeprom and initialize variables for board variants */ static void cbi_init(void) { @@ -237,6 +270,11 @@ static void cbi_init(void) ccprints("SKU: %d", sku_id); board_update_sensor_config_from_sku(); + + if (cbi_get_board_version(&val) != EC_SUCCESS) + return; + ccprints("Board version: %d", val); + board_customize_usbc_mux(val); } DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc index a6c293eee2..2988ed44b0 100644 --- a/board/ampton/gpio.inc +++ b/board/ampton/gpio.inc @@ -101,6 +101,7 @@ GPIO(USB_C0_BC12_CHG_DET_L, PIN(A, 0), GPIO_INPUT) /* C0 BC1.2 Detect */ GPIO(USB_C1_BC12_CHG_DET_L, PIN(I, 0), GPIO_INPUT) /* C1 BC1.2 Detect */ GPIO(USB_C0_BC12_VBUS_ON, PIN(J, 4), GPIO_OUT_LOW) /* C0 BC1.2 Power */ GPIO(USB_C1_BC12_VBUS_ON, PIN(J, 5), GPIO_OUT_LOW) /* C1 BC1.2 Power */ +GPIO(USB_C0_PD_RST_ODL, PIN(L, 6), GPIO_ODR_HIGH) /* C0 PD Reset */ GPIO(USB_C1_PD_RST_ODL, PIN(L, 7), GPIO_ODR_HIGH) /* C1 PD Reset */ GPIO(CCD_MODE_ODL, PIN(C, 4), GPIO_INPUT) @@ -122,7 +123,6 @@ GPIO(GPIOG1_NC, PIN(G, 1), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOH0_NC, PIN(H, 0), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOL2_NC, PIN(L, 2), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOL3_NC, PIN(L, 3), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOL6_NC, PIN(L, 6), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOM6_NC, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOD3_NC, PIN(D, 3), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOI1_NC, PIN(I, 1), GPIO_INPUT | GPIO_PULL_DOWN) |