diff options
Diffstat (limited to 'baseboard/dragonegg/baseboard.c')
-rw-r--r-- | baseboard/dragonegg/baseboard.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/baseboard/dragonegg/baseboard.c b/baseboard/dragonegg/baseboard.c index 14e9dc3923..e3f49ff336 100644 --- a/baseboard/dragonegg/baseboard.c +++ b/baseboard/dragonegg/baseboard.c @@ -8,11 +8,13 @@ #include "charge_state_v2.h" #include "chipset.h" #include "console.h" +#include "driver/ppc/nx20p348x.h" #include "driver/ppc/sn5s330.h" #include "driver/ppc/syv682x.h" #include "driver/tcpm/it83xx_pd.h" #include "driver/tcpm/tcpci.h" #include "driver/tcpm/tcpm.h" +#include "driver/tcpm/tusb422.h" #include "espi.h" #include "gpio.h" #include "hooks.h" @@ -27,6 +29,7 @@ #define USB_PD_PORT_ITE_0 0 #define USB_PD_PORT_ITE_1 1 +#define USB_PD_PORT_TUSB422_2 2 #define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) #define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args) @@ -170,6 +173,13 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { .drv = &it83xx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, + + [USB_PD_PORT_TUSB422_2] = { + .i2c_host_port = I2C_PORT_USBC1C2, + .i2c_slave_addr = TUSB422_I2C_ADDR, + .drv = &tusb422_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, }; /******************************************************************************/ @@ -186,6 +196,12 @@ struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = { .i2c_addr = SYV682X_ADDR0, .drv = &syv682x_drv }, + + [USB_PD_PORT_TUSB422_2] = { + .i2c_port = I2C_PORT_USBC1C2, + .i2c_addr = NX20P3481_ADDR2, + .drv = &nx20p348x_drv, + }, }; unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); @@ -201,6 +217,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, }, + + [USB_PD_PORT_TUSB422_2] = { + .port_addr = 0, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + }, }; /* Power Delivery and charging functions */ @@ -209,18 +231,28 @@ void baseboard_tcpc_init(void) { /* Enable PPC interrupts. */ gpio_enable_interrupt(GPIO_USB_C0_TCPPC_INT_L); + gpio_enable_interrupt(GPIO_USB_C2_TCPPC_INT_ODL); + + /* Enable TCPC interrupts. */ + gpio_enable_interrupt(GPIO_USB_C2_TCPC_INT_ODL); + } DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 1); uint16_t tcpc_get_alert_status(void) { + uint16_t status = 0; /* * Since C0/C1 TCPC are embedded within EC, we don't need the PDCMD * tasks.The (embedded) TCPC status since chip driver code will * handles its own interrupts and forward the correct events to * the PD_C0 task. See it83xx/intc.c */ - return 0; + + if (!gpio_get_level(GPIO_USB_C2_TCPC_INT_ODL)) + status = PD_STATUS_TCPC_ALERT_2; + + return status; } /** @@ -256,7 +288,6 @@ int board_set_active_charge_port(int port) if (!is_valid_port && port != CHARGE_PORT_NONE) return EC_ERROR_INVAL; - if (port == CHARGE_PORT_NONE) { CPRINTSUSB("Disabling all charger ports"); |