diff options
-rw-r--r-- | board/coral/board.c | 11 | ||||
-rw-r--r-- | board/eve/board.c | 14 | ||||
-rw-r--r-- | board/grunt/board.c | 4 | ||||
-rw-r--r-- | board/kahlee/board.c | 4 | ||||
-rw-r--r-- | board/nami/board.c | 16 | ||||
-rw-r--r-- | board/nautilus/board.c | 14 | ||||
-rw-r--r-- | board/poppy/board.c | 14 | ||||
-rw-r--r-- | board/reef/board.c | 11 | ||||
-rw-r--r-- | board/yorp/board.c | 4 | ||||
-rw-r--r-- | board/zoombini/board.c | 6 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.h | 6 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.h | 6 | ||||
-rw-r--r-- | driver/usb_mux_it5205.h | 4 |
13 files changed, 84 insertions, 30 deletions
diff --git a/board/coral/board.c b/board/coral/board.c index e54138b904..ec9d76cd62 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -191,7 +191,7 @@ struct i2c_stress_test i2c_stress_tests[] = { #ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC { .port = NPCX_I2C_PORT0_0, - .addr = 0x50, + .addr = ANX74XX_I2C_ADDR1, .i2c_test = &anx74xx_i2c_stress_test_dev, }, #endif @@ -200,7 +200,7 @@ struct i2c_stress_test i2c_stress_tests[] = { #ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC { .port = NPCX_I2C_PORT0_1, - .addr = 0x16, + .addr = PS8751_I2C_ADDR1, .i2c_test = &ps8xxx_i2c_stress_test_dev, }, #endif @@ -241,13 +241,13 @@ const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = 0x50, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, .drv = &anx74xx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, [USB_PD_PORT_PS8751] = { .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, @@ -281,8 +281,7 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); static int ps8751_tune_mux(const struct usb_mux *mux) { /* 0x98 sets lower EQ of DP port (4.5db) */ - i2c_write8(NPCX_I2C_PORT0_1, 0x16, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, - 0x98); + tcpc_write(mux->port_addr, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98); return EC_SUCCESS; } diff --git a/board/eve/board.c b/board/eve/board.c index 820fac31fe..1ab87d7d9d 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -210,8 +210,18 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, - {I2C_PORT_TCPC1, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, + { + .i2c_host_port = I2C_PORT_TCPC0, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, + .drv = &anx74xx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, + { + .i2c_host_port = I2C_PORT_TCPC1, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, + .drv = &anx74xx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/grunt/board.c b/board/grunt/board.c index be997ffd49..9c26df0e4a 100644 --- a/board/grunt/board.c +++ b/board/grunt/board.c @@ -161,13 +161,13 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = 0x50, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, .drv = &anx74xx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, [USB_PD_PORT_PS8751] = { .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, diff --git a/board/kahlee/board.c b/board/kahlee/board.c index 670fc528c8..f9098decc2 100644 --- a/board/kahlee/board.c +++ b/board/kahlee/board.c @@ -187,13 +187,13 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) == const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [0] = { .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, [1] = { .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, diff --git a/board/nami/board.c b/board/nami/board.c index 40722559cf..83fbaf52b5 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -183,8 +183,20 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {NPCX_I2C_PORT0_0, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, - //{NPCX_I2C_PORT0_1, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, + { + .i2c_host_port = NPCX_I2C_PORT0_0, + .i2c_slave_addr = PS8751_I2C_ADDR1, + .drv = &ps8xxx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, + /* + { + .i2c_host_port = NPCX_I2C_PORT0_1, + .i2c_slave_addr = PS8751_I2C_ADDR1, + .drv = &ps8xxx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, + */ }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/nautilus/board.c b/board/nautilus/board.c index 5f0c75514e..b9bffe939a 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -167,8 +167,18 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {NPCX_I2C_PORT0_0, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, - {NPCX_I2C_PORT0_1, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, + { + .i2c_host_port = NPCX_I2C_PORT0_0, + .i2c_slave_addr = PS8751_I2C_ADDR1, + .drv = &ps8xxx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, + { + .i2c_host_port = NPCX_I2C_PORT0_1, + .i2c_slave_addr = PS8751_I2C_ADDR1, + .drv = &ps8xxx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/poppy/board.c b/board/poppy/board.c index bf33c32f1f..78e5ef584f 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -225,8 +225,18 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ 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_0, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, + { + .i2c_host_port = NPCX_I2C_PORT0_0, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, + .drv = &anx74xx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, + { + .i2c_host_port = NPCX_I2C_PORT0_0, + .i2c_slave_addr = PS8751_I2C_ADDR1, + .drv = &ps8xxx_tcpm_drv, + .pol = TCPC_ALERT_ACTIVE_LOW, + }, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/reef/board.c b/board/reef/board.c index 8ff7d1b3f5..868656559e 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -184,7 +184,7 @@ struct i2c_stress_test i2c_stress_tests[] = { #ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC { .port = NPCX_I2C_PORT0_0, - .addr = 0x50, + .addr = ANX74XX_I2C_ADDR1, .i2c_test = &anx74xx_i2c_stress_test_dev, }, #endif @@ -193,7 +193,7 @@ struct i2c_stress_test i2c_stress_tests[] = { #ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC { .port = NPCX_I2C_PORT0_1, - .addr = 0x16, + .addr = PS8751_I2C_ADDR1, .i2c_test = &ps8xxx_i2c_stress_test_dev, }, #endif @@ -246,13 +246,13 @@ const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = 0x50, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, .drv = &anx74xx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, [USB_PD_PORT_PS8751] = { .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, @@ -286,8 +286,7 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); static int ps8751_tune_mux(const struct usb_mux *mux) { /* 0x98 sets lower EQ of DP port (4.5db) */ - i2c_write8(NPCX_I2C_PORT0_1, 0x16, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, - 0x98); + tcpc_write(mux->port_addr, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98); return EC_SUCCESS; } diff --git a/board/yorp/board.c b/board/yorp/board.c index 43363eff72..eb8eb7022c 100644 --- a/board/yorp/board.c +++ b/board/yorp/board.c @@ -292,13 +292,13 @@ void lid_angle_peripheral_enable(int enable) const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX74XX] = { .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = 0x50, + .i2c_slave_addr = ANX74XX_I2C_ADDR1, .drv = &anx74xx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, [USB_PD_PORT_PS8751] = { .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 7f818363c0..a3ac8f611f 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -355,14 +355,14 @@ struct keyboard_scan_config keyscan_config = { const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { { .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &tcpci_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, { .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &tcpci_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, @@ -370,7 +370,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { #ifdef BOARD_ZOOMBINI { .i2c_host_port = I2C_PORT_TCPC2, - .i2c_slave_addr = 0x16, + .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &tcpci_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, diff --git a/driver/tcpm/anx74xx.h b/driver/tcpm/anx74xx.h index 11ae964af7..95138540b2 100644 --- a/driver/tcpm/anx74xx.h +++ b/driver/tcpm/anx74xx.h @@ -10,6 +10,12 @@ #ifndef __CROS_EC_USB_PD_TCPM_ANX74XX_H #define __CROS_EC_USB_PD_TCPM_ANX74XX_H +/* I2C interface */ +#define ANX74XX_I2C_ADDR1 0x50 +#define ANX74XX_I2C_ADDR2 0x72 +#define ANX74XX_I2C_ADDR3 0x7C +#define ANX74XX_I2C_ADDR4 0x80 + #define ANX74XX_REG_IRQ_POL_LOW 0x00 #define ANX74XX_REG_IRQ_POL_HIGH 0x02 diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h index 5789cb733c..a9660843ee 100644 --- a/driver/tcpm/ps8xxx.h +++ b/driver/tcpm/ps8xxx.h @@ -8,6 +8,12 @@ #ifndef __CROS_EC_USB_PD_TCPM_PS8XXX_H #define __CROS_EC_USB_PD_TCPM_PS8XXX_H +/* I2C interface */ +#define PS8751_I2C_ADDR1 0x16 +#define PS8751_I2C_ADDR2 0x36 +#define PS8751_I2C_ADDR3 0x56 +#define PS8751_I2C_ADDR4 0x96 + #define PS8751_BIST_TIMER_FREQ 15000000 #define PS8751_BIST_DELAY_MS 50 diff --git a/driver/usb_mux_it5205.h b/driver/usb_mux_it5205.h index 0cebeed71a..2c26f7ca41 100644 --- a/driver/usb_mux_it5205.h +++ b/driver/usb_mux_it5205.h @@ -8,7 +8,9 @@ #ifndef __CROS_EC_USB_MUX_IT5205_H #define __CROS_EC_USB_MUX_IT5205_H -/* 8 bit i2c slave address is 0xb0 or 0x90 depends on address setting pin. */ +/* I2C interface */ +#define IT5205_I2C_ADDR1 (0x48 << 1) +#define IT5205_I2C_ADDR2 (0x58 << 1) /* Chip ID registers */ #define IT5205_REG_CHIP_ID3 0x4 |