diff --git a/board/snappy/board.c b/board/snappy/board.c index 921edf9d2f..1d4ae01583 100644 --- a/board/snappy/board.c +++ b/board/snappy/board.c @@ -225,8 +225,10 @@ const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); #endif /* CONFIG_CMD_I2C_STRESS_TEST */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, - {NPCX_I2C_PORT0_1, 0x16, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, + {NPCX_I2C_PORT0_0, TCPC_PORT0_I2C_ADDR, &anx74xx_tcpm_drv, + TCPC_ALERT_ACTIVE_LOW}, + {NPCX_I2C_PORT0_1, TCPC_PORT1_I2C_ADDR, &tcpci_tcpm_drv, + TCPC_ALERT_ACTIVE_LOW}, }; uint16_t tcpc_get_alert_status(void) @@ -254,6 +256,16 @@ const enum gpio_signal hibernate_wake_pins[] = { const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); +static int ps8751_tune_mux(const struct usb_mux *mux) +{ + /* Snappy specific signal reconditioning */ + i2c_write8(mux->port_addr, TCPC_PORT1_I2C_ADDR, + PS8751_REG_MUX_USB_C2SS_EQ, 0x50); + i2c_write8(mux->port_addr, TCPC_PORT1_I2C_ADDR, + PS8751_REG_MUX_USB_C2SS_HS_THRESHOLD, 0x80); + return EC_SUCCESS; +} + struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { .port_addr = 0, /* don't care / unused */ @@ -261,9 +273,10 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { .hpd_update = &anx74xx_tcpc_update_hpd_status, }, { - .port_addr = 1, + .port_addr = 1, /* port # not i2c address */ .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8751_tcpc_update_hpd_status, + .board_init = &ps8751_tune_mux, } }; diff --git a/board/snappy/board.h b/board/snappy/board.h index 520f39c020..ed1e60d5ba 100644 --- a/board/snappy/board.h +++ b/board/snappy/board.h @@ -324,6 +324,9 @@ void board_reset_pd_mcu(void); int board_get_version(void); +#define TCPC_PORT0_I2C_ADDR 0x50 +#define TCPC_PORT1_I2C_ADDR 0x16 + void board_set_tcpc_power_mode(int port, int mode); void board_print_tcpc_fw_version(int port); diff --git a/driver/tcpm/ps8751.h b/driver/tcpm/ps8751.h index 71325a7d4b..bd3632bcdb 100644 --- a/driver/tcpm/ps8751.h +++ b/driver/tcpm/ps8751.h @@ -18,6 +18,8 @@ #define PS8751_REG_CTRL_1 0xD0 #define PS8751_REG_CTRL_1_HPD (1 << 0) #define PS8751_REG_CTRL_1_IRQ (1 << 1) +#define PS8751_REG_MUX_USB_C2SS_EQ 0xe7 +#define PS8751_REG_MUX_USB_C2SS_HS_THRESHOLD 0xe8 void ps8751_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq); int ps8751_tcpc_get_fw_version(int port, int *version);