diff options
author | Zick Wei <zick.wei@quanta.corp-partner.google.com> | 2021-07-01 18:03:34 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-13 06:29:17 +0000 |
commit | a7a14e0ec726c2ce731d31e9ea42cf8137aa063c (patch) | |
tree | 8590a54180ddcd7f7aa747e6a85e4a3b5f9d3382 | |
parent | 80cc4fe762c3b36e0bcf884d3fc4b3e001352232 (diff) | |
download | chrome-ec-a7a14e0ec726c2ce731d31e9ea42cf8137aa063c.tar.gz |
redrix: config USBC port
Remove USBC2 port and config USBC1 port to follow schematic,
redrix use TCPC: NCT3807 on both USBC0 and USBC1 port.
BUG=b:190822765
BRANCH=none
TEST=make BOARD=redrix
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: I27cb5b1c33b1dca565a68e6d8f1e3dc20f542bb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3000305
Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r-- | board/redrix/board.h | 15 | ||||
-rw-r--r-- | board/redrix/ec.tasklist | 4 | ||||
-rw-r--r-- | board/redrix/gpio.inc | 40 | ||||
-rw-r--r-- | board/redrix/i2c.c | 26 | ||||
-rw-r--r-- | board/redrix/usbc_config.c | 123 | ||||
-rw-r--r-- | board/redrix/usbc_config.h | 5 |
6 files changed, 68 insertions, 145 deletions
diff --git a/board/redrix/board.h b/board/redrix/board.h index 84eb12dc3d..c79576769b 100644 --- a/board/redrix/board.h +++ b/board/redrix/board.h @@ -85,13 +85,12 @@ #define CONFIG_IO_EXPANDER_NCT38XX #define CONFIG_IO_EXPANDER_PORT_COUNT 2 -#define CONFIG_USB_PD_TCPM_PS8815 #define CONFIG_USBC_RETIMER_INTEL_BB #define CONFIG_USBC_PPC_SYV682X #define CONFIG_USBC_PPC_NX20P3483 -/* TODO: b/177608416 - measure and check these values on brya */ +/* TODO: b/193452481 - measure and check these values on redrix */ #define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ #define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */ #define PD_VCONN_SWAP_DELAY 5000 /* us */ @@ -148,16 +147,16 @@ #define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 -#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0 +#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0 #define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1 -#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0 #define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0 +#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0 #define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1 -#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0 +#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0 #define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1 #define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 @@ -170,7 +169,7 @@ * see b/174768555#comment22 */ #define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56 -#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x57 +#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57 /* Enabling Thunderbolt-compatible mode */ #define CONFIG_USB_PD_TBT_COMPAT_MODE @@ -230,7 +229,7 @@ enum sensor_id { enum ioex_port { IOEX_C0_NCT38XX = 0, - IOEX_C2_NCT38XX, + IOEX_C1_NCT38XX, IOEX_PORT_COUNT }; diff --git a/board/redrix/ec.tasklist b/board/redrix/ec.tasklist index ef0aa84584..290c17c748 100644 --- a/board/redrix/ec.tasklist +++ b/board/redrix/ec.tasklist @@ -15,7 +15,6 @@ TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ @@ -26,6 +25,5 @@ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C2, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), TASK_STACK_SIZE) \ + TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, TASK_STACK_SIZE) \ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, TASK_STACK_SIZE) diff --git a/board/redrix/gpio.inc b/board/redrix/gpio.inc index f4011e2249..6baf8f45cf 100644 --- a/board/redrix/gpio.inc +++ b/board/redrix/gpio.inc @@ -26,16 +26,13 @@ GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_ GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_BOTH, bc12_interrupt) -GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_BOTH, tcpc_alert_event) +GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_BOTH, tcpc_alert_event) GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_BOTH, ppc_interrupt) GPIO_INT(USB_C0_RT_INT_ODL, PIN(B, 1), GPIO_INT_BOTH, retimer_interrupt) -GPIO_INT(USB_C1_BC12_INT_ODL, PIN(5, 0), GPIO_INT_BOTH, bc12_interrupt) -GPIO_INT(USB_C1_PPC_INT_ODL, PIN(F, 5), GPIO_INT_BOTH, ppc_interrupt) -GPIO_INT(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INT_BOTH, retimer_interrupt) GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_BOTH, tcpc_alert_event) -GPIO_INT(USB_C2_BC12_INT_ODL, PIN(8, 3), GPIO_INT_BOTH, bc12_interrupt) -GPIO_INT(USB_C2_PPC_INT_ODL, PIN(7, 0), GPIO_INT_BOTH, ppc_interrupt) -GPIO_INT(USB_C2_RT_INT_ODL, PIN(4, 1), GPIO_INT_BOTH, retimer_interrupt) +GPIO_INT(USB_C1_BC12_INT_ODL, PIN(8, 3), GPIO_INT_BOTH, bc12_interrupt) +GPIO_INT(USB_C1_PPC_INT_ODL, PIN(7, 0), GPIO_INT_BOTH, ppc_interrupt) +GPIO_INT(USB_C1_RT_INT_ODL, PIN(4, 1), GPIO_INT_BOTH, retimer_interrupt) /* USED GPIOs: */ GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) @@ -51,12 +48,12 @@ GPIO(EC_I2C_MISC_SCL_R, PIN(B, 3), GPIO_INPUT) GPIO(EC_I2C_MISC_SDA_R, PIN(B, 2), GPIO_INPUT) GPIO(EC_I2C_SENSOR_SCL, PIN(B, 5), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(EC_I2C_SENSOR_SDA, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V) -GPIO(EC_I2C_USB_C0_C2_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_RT_SCL, PIN(D, 1), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_RT_SDA, PIN(D, 0), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_TCPC_SCL, PIN(9, 0), GPIO_INPUT) -GPIO(EC_I2C_USB_C0_C2_TCPC_SDA, PIN(8, 7), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_RT_SCL, PIN(D, 1), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_RT_SDA, PIN(D, 0), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_TCPC_SCL, PIN(9, 0), GPIO_INPUT) +GPIO(EC_I2C_USB_C0_TCPC_SDA, PIN(8, 7), GPIO_INPUT) GPIO(EC_I2C_USB_C1_MIX_SCL, PIN(E, 4), GPIO_INPUT) GPIO(EC_I2C_USB_C1_MIX_SDA, PIN(E, 3), GPIO_INPUT) GPIO(EC_I2C_USB_C1_TCPC_SCL, PIN(F, 3), GPIO_INPUT) @@ -76,10 +73,8 @@ GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW) GPIO(IMVP9_VRRDY_OD, PIN(4, 3), GPIO_INPUT) GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW) GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH) -GPIO(USB_C0_C2_TCPC_RST_ODL, PIN(A, 7), GPIO_OUT_LOW) -GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW) -GPIO(USB_C1_RST_ODL, PIN(9, 6), GPIO_ODR_LOW) -GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), GPIO_ODR_LOW) +GPIO(USB_C0_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW) +GPIO(USB_C1_TCPC_RST_ODL, PIN(A, 0), GPIO_ODR_LOW) GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW) /* UART alternate functions */ @@ -135,11 +130,10 @@ UNUSED(PIN(6, 6)) /* GPO66/ARM_L_x86 */ */ GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW) -IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_LOW) -IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_ODR_HIGH) +IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH) +IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW) IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW) -IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 2), GPIO_ODR_LOW) -IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_LOW) -IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_ODR_HIGH) -IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 7), GPIO_ODR_HIGH) +IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 4), GPIO_ODR_HIGH) +IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_LOW) +IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 7), GPIO_ODR_LOW) diff --git a/board/redrix/i2c.c b/board/redrix/i2c.c index bb55b13d0c..b993a7978e 100644 --- a/board/redrix/i2c.c +++ b/board/redrix/i2c.c @@ -20,27 +20,27 @@ const struct i2c_port_t i2c_ports[] = { }, { /* I2C1 */ - .name = "tcpc0,2", - .port = I2C_PORT_USB_C0_C2_TCPC, + .name = "tcpc0", + .port = I2C_PORT_USB_C0_TCPC, .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C0_C2_TCPC_SCL, - .sda = GPIO_EC_I2C_USB_C0_C2_TCPC_SDA, + .scl = GPIO_EC_I2C_USB_C0_TCPC_SCL, + .sda = GPIO_EC_I2C_USB_C0_TCPC_SDA, }, { /* I2C2 */ - .name = "ppc0,2", - .port = I2C_PORT_USB_C0_C2_PPC, + .name = "ppc0", + .port = I2C_PORT_USB_C0_PPC, .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SCL, - .sda = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SDA, + .scl = GPIO_EC_I2C_USB_C0_PPC_BC_SCL, + .sda = GPIO_EC_I2C_USB_C0_PPC_BC_SDA, }, { /* I2C3 */ - .name = "retimer0,2", - .port = I2C_PORT_USB_C0_C2_MUX, + .name = "retimer0", + .port = I2C_PORT_USB_C0_MUX, .kbps = 1000, - .scl = GPIO_EC_I2C_USB_C0_C2_RT_SCL, - .sda = GPIO_EC_I2C_USB_C0_C2_RT_SDA, + .scl = GPIO_EC_I2C_USB_C0_RT_SCL, + .sda = GPIO_EC_I2C_USB_C0_RT_SDA, }, { /* I2C4 C1 TCPC */ @@ -60,7 +60,7 @@ const struct i2c_port_t i2c_ports[] = { }, { /* I2C6 */ - .name = "ppc1", + .name = "ppc1,retimer1", .port = I2C_PORT_USB_C1_PPC, .kbps = 400, .scl = GPIO_EC_I2C_USB_C1_MIX_SCL, diff --git a/board/redrix/usbc_config.c b/board/redrix/usbc_config.c index f5d4a0310c..768e6b88cd 100644 --- a/board/redrix/usbc_config.c +++ b/board/redrix/usbc_config.c @@ -10,11 +10,9 @@ #include "compile_time_macros.h" #include "console.h" #include "driver/bc12/pi3usb9201_public.h" -#include "driver/ppc/nx20p348x.h" #include "driver/ppc/syv682x_public.h" #include "driver/retimer/bb_retimer_public.h" #include "driver/tcpm/nct38xx.h" -#include "driver/tcpm/ps8xxx_public.h" #include "driver/tcpm/tcpci.h" #include "ec_commands.h" #include "fw_config.h" @@ -41,7 +39,7 @@ const struct tcpc_config_t tcpc_config[] = { [USBC_PORT_C0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { - .port = I2C_PORT_USB_C0_C2_TCPC, + .port = I2C_PORT_USB_C0_TCPC, .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS, }, .drv = &nct38xx_tcpm_drv, @@ -51,17 +49,7 @@ const struct tcpc_config_t tcpc_config[] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { .port = I2C_PORT_USB_C1_TCPC, - .addr_flags = PS8751_I2C_ADDR1_FLAGS, - }, - .drv = &ps8xxx_tcpm_drv, - .flags = TCPC_FLAGS_TCPCI_REV2_0 | - TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V, - }, - [USBC_PORT_C2] = { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_USB_C0_C2_TCPC, - .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS, + .addr_flags = NCT38XX_I2C_ADDR1_4_FLAGS, }, .drv = &nct38xx_tcpm_drv, .flags = TCPC_FLAGS_TCPCI_REV2_0, @@ -73,22 +61,12 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT); /* USBC PPC configuration */ struct ppc_config_t ppc_chips[] = { [USBC_PORT_C0] = { - .i2c_port = I2C_PORT_USB_C0_C2_PPC, + .i2c_port = I2C_PORT_USB_C0_PPC, .i2c_addr_flags = SYV682X_ADDR0_FLAGS, .drv = &syv682x_drv, }, [USBC_PORT_C1] = { - /* Compatible with Silicon Mitus SM536A0 */ .i2c_port = I2C_PORT_USB_C1_PPC, - .i2c_addr_flags = NX20P3483_ADDR2_FLAGS, - .drv = &nx20p348x_drv, - }, - [USBC_PORT_C2] = { - .i2c_port = I2C_PORT_USB_C0_C2_PPC, - /* - * b/179987870 - * schematics I2C map says ADDR3 - */ .i2c_addr_flags = SYV682X_ADDR2_FLAGS, .drv = &syv682x_drv, }, @@ -103,44 +81,26 @@ static const struct usb_mux usbc0_tcss_usb_mux = { .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }; -static const struct usb_mux usbc2_tcss_usb_mux = { - .usb_port = USBC_PORT_C2, +static const struct usb_mux usbc1_tcss_usb_mux = { + .usb_port = USBC_PORT_C1, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }; -/* - * USB3 DB mux configuration - the top level mux still needs to be set - * to the virtual_usb_mux_driver so the AP gets notified of mux changes - * and updates the TCSS configuration on state changes. - */ -static const struct usb_mux usbc1_usb3_db_retimer = { - .usb_port = USBC_PORT_C1, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, -}; - const struct usb_mux usb_muxes[] = { [USBC_PORT_C0] = { .usb_port = USBC_PORT_C0, .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT_USB_C0_C2_MUX, + .i2c_port = I2C_PORT_USB_C0_MUX, .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, .next_mux = &usbc0_tcss_usb_mux, }, [USBC_PORT_C1] = { - /* PS8815 DB */ .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb3_db_retimer, - }, - [USBC_PORT_C2] = { - .usb_port = USBC_PORT_C2, .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT_USB_C0_C2_MUX, - .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR, - .next_mux = &usbc2_tcss_usb_mux, + .i2c_port = I2C_PORT_USB_C1_MUX, + .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, + .next_mux = &usbc1_tcss_usb_mux, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); @@ -148,22 +108,18 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); /* BC1.2 charger detect configuration */ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { [USBC_PORT_C0] = { - .i2c_port = I2C_PORT_USB_C0_C2_BC12, + .i2c_port = I2C_PORT_USB_C0_BC12, .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, }, [USBC_PORT_C1] = { .i2c_port = I2C_PORT_USB_C1_BC12, - .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS, - }, - [USBC_PORT_C2] = { - .i2c_port = I2C_PORT_USB_C0_C2_BC12, .i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS, }, }; BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); /* - * USB C0 and C2 uses burnside bridge chips and have their reset + * USB C0 and C1 uses burnside bridge chips and have their reset * controlled by their respective TCPC chips acting as GPIO expanders. * * ioex_init() is normally called before we take the TCPCs out of @@ -173,14 +129,14 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); struct ioexpander_config_t ioex_config[] = { [IOEX_C0_NCT38XX] = { - .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC, + .i2c_host_port = I2C_PORT_USB_C0_TCPC, .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS, .drv = &nct38xx_ioexpander_drv, .flags = IOEX_FLAGS_DISABLED, }, - [IOEX_C2_NCT38XX] = { - .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC, - .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS, + [IOEX_C1_NCT38XX] = { + .i2c_host_port = I2C_PORT_USB_C1_TCPC, + .i2c_addr_flags = NCT38XX_I2C_ADDR1_4_FLAGS, .drv = &nct38xx_ioexpander_drv, .flags = IOEX_FLAGS_DISABLED, }, @@ -193,8 +149,8 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable) if (me->usb_port == USBC_PORT_C0) { rst_signal = IOEX_USB_C0_RT_RST_ODL; - } else if (me->usb_port == USBC_PORT_C2) { - rst_signal = IOEX_USB_C2_RT_RST_ODL; + } else if (me->usb_port == USBC_PORT_C1) { + rst_signal = IOEX_USB_C1_RT_RST_ODL; } else { return EC_ERROR_INVAL; } @@ -230,10 +186,8 @@ void board_reset_pd_mcu(void) * TODO(b/193461268): figure out correct timing */ - gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 0); - gpio_set_level(GPIO_USB_C1_RST_ODL, 0); - gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0); - + gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 0); + gpio_set_level(GPIO_USB_C1_TCPC_RST_ODL, 0); /* * delay for power-on to reset-off and min. assertion time @@ -241,9 +195,8 @@ void board_reset_pd_mcu(void) msleep(20); - gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 1); - gpio_set_level(GPIO_USB_C1_RST_ODL, 1); - gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1); + gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 1); + gpio_set_level(GPIO_USB_C1_TCPC_RST_ODL, 1); /* wait for chips to come up */ @@ -266,17 +219,14 @@ static void board_tcpc_init(void) /* Enable PPC interrupts. */ gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C2_PPC_INT_ODL); + gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL); /* Enable TCPC interrupts. */ - gpio_enable_interrupt(GPIO_USB_C0_C2_TCPC_INT_ODL); + gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL); + gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL); /* Enable BC1.2 interrupts. */ gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C2_BC12_INT_ODL); - - gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL); - gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL); gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL); } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET); @@ -285,8 +235,8 @@ uint16_t tcpc_get_alert_status(void) { uint16_t status = 0; - if (gpio_get_level(GPIO_USB_C0_C2_TCPC_INT_ODL) == 0) - status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_2; + if (gpio_get_level(GPIO_USB_C0_TCPC_INT_ODL) == 0) + status |= PD_STATUS_TCPC_ALERT_0; if (gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL) == 0) status |= PD_STATUS_TCPC_ALERT_1; @@ -294,21 +244,10 @@ uint16_t tcpc_get_alert_status(void) return status; } -int ppc_get_alert_status(int port) -{ - if (port == USBC_PORT_C0) - return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0; - else if (port == USBC_PORT_C1) - return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0; - else if (port == USBC_PORT_C2) - return gpio_get_level(GPIO_USB_C2_PPC_INT_ODL) == 0; - return 0; -} - void tcpc_alert_event(enum gpio_signal signal) { switch (signal) { - case GPIO_USB_C0_C2_TCPC_INT_ODL: + case GPIO_USB_C0_TCPC_INT_ODL: schedule_deferred_pd_interrupt(USBC_PORT_C0); break; case GPIO_USB_C1_TCPC_INT_ODL: @@ -328,9 +267,6 @@ void bc12_interrupt(enum gpio_signal signal) case GPIO_USB_C1_BC12_INT_ODL: task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12); break; - case GPIO_USB_C2_BC12_INT_ODL: - task_set_event(TASK_ID_USB_CHG_P2, USB_CHG_EVENT_BC12); - break; default: break; } @@ -343,10 +279,7 @@ void ppc_interrupt(enum gpio_signal signal) syv682x_interrupt(USBC_PORT_C0); break; case GPIO_USB_C1_PPC_INT_ODL: - nx20p348x_interrupt(USBC_PORT_C1); - break; - case GPIO_USB_C2_PPC_INT_ODL: - syv682x_interrupt(USBC_PORT_C2); + syv682x_interrupt(USBC_PORT_C1); break; default: break; diff --git a/board/redrix/usbc_config.h b/board/redrix/usbc_config.h index 7319bcb5e2..dcaa52d7a9 100644 --- a/board/redrix/usbc_config.h +++ b/board/redrix/usbc_config.h @@ -3,17 +3,16 @@ * found in the LICENSE file. */ -/* Brya board-specific USB-C configuration */ +/* Redrix board-specific USB-C configuration */ #ifndef __CROS_EC_USBC_CONFIG_H #define __CROS_EC_USBC_CONFIG_H -#define CONFIG_USB_PD_PORT_MAX_COUNT 3 +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, - USBC_PORT_C2, USBC_PORT_COUNT }; |