diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-05-31 16:45:32 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-06-10 21:20:17 -0700 |
commit | 3a668749460466ff002b5dd2cbf00529f97e5974 (patch) | |
tree | 4f62d4856086362ebc646215c0d4ac31cdaf8b08 /board | |
parent | c89e3557f808c504d8feece4d28a96450089b05f (diff) | |
download | chrome-ec-3a668749460466ff002b5dd2cbf00529f97e5974.tar.gz |
TCPC: Make tcpc_config handle other bus types
Currently, tcpc_config assumes TCPCs are on I2C bus. ITE's EC has an
embedded TCPC.
This patch adds bus_type field to struct tcpc_config_t so that a TCPC
location on other type of bus can be specified.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=none
BRANCH=none
TEST=buildall
Change-Id: Ieac733011700b351e6323f46070dcf46d9e1154b
Reviewed-on: https://chromium-review.googlesource.com/1640305
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/atlas/board.c | 14 | ||||
-rw-r--r-- | board/chell/board.c | 19 | ||||
-rw-r--r-- | board/cheza/board.c | 21 | ||||
-rw-r--r-- | board/coral/board.c | 18 | ||||
-rw-r--r-- | board/elm/board.c | 9 | ||||
-rw-r--r-- | board/eve/board.c | 18 | ||||
-rw-r--r-- | board/fizz/board.c | 10 | ||||
-rw-r--r-- | board/flapjack/board.c | 8 | ||||
-rw-r--r-- | board/glados/board.c | 18 | ||||
-rw-r--r-- | board/glkrvp/chg_usb_pd.c | 20 | ||||
-rw-r--r-- | board/glkrvp_ite/chg_usb_pd.c | 20 | ||||
-rw-r--r-- | board/hatch/board.c | 15 | ||||
-rw-r--r-- | board/helios/board.c | 15 | ||||
-rw-r--r-- | board/kohaku/board.c | 16 | ||||
-rw-r--r-- | board/kukui/board.c | 9 | ||||
-rw-r--r-- | board/nami/board.c | 14 | ||||
-rw-r--r-- | board/nautilus/board.c | 18 | ||||
-rw-r--r-- | board/nocturne/board.c | 19 | ||||
-rw-r--r-- | board/oak/board.c | 18 | ||||
-rw-r--r-- | board/pdeval-stm32f072/board.c | 9 | ||||
-rw-r--r-- | board/poppy/board.c | 18 | ||||
-rw-r--r-- | board/rainier/board.c | 9 | ||||
-rw-r--r-- | board/rammus/board.c | 20 | ||||
-rw-r--r-- | board/reef/board.c | 18 | ||||
-rw-r--r-- | board/reef_it8320/board.c | 10 | ||||
-rw-r--r-- | board/reef_mchp/board.c | 18 | ||||
-rw-r--r-- | board/scarlet/board.c | 9 | ||||
-rw-r--r-- | board/strago/board.c | 9 |
28 files changed, 300 insertions, 119 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c index 618838714c..78fbcd53f2 100644 --- a/board/atlas/board.c +++ b/board/atlas/board.c @@ -169,16 +169,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { { /* left port */ - .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = I2C_ADDR_TCPC, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = I2C_ADDR_TCPC, + }, .drv = &ps8xxx_tcpm_drv, /* Alert is active-low, push-pull */ .flags = 0, }, { /* right port */ - .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = I2C_ADDR_TCPC, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = I2C_ADDR_TCPC, + }, .drv = &ps8xxx_tcpm_drv, /* Alert is active-low, push-pull */ .flags = 0, diff --git a/board/chell/board.c b/board/chell/board.c index a3f7875166..14b1e56d2c 100644 --- a/board/chell/board.c +++ b/board/chell/board.c @@ -122,8 +122,23 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv}, - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR, + }, + .drv = &tcpci_tcpm_drv, + }, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR + 2, + }, + .drv = &tcpci_tcpm_drv, + + }, }; /* SPI devices */ diff --git a/board/cheza/board.c b/board/cheza/board.c index 5d9413b4a2..d13f06e61f 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -257,10 +257,23 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { /* Alert is active-low, open-drain */ - [USB_PD_PORT_ANX3429] = {I2C_PORT_TCPC0, 0x50, &anx74xx_tcpm_drv, - TCPC_FLAGS_ALERT_OD}, - /* Alert is active-low, push-pull */ - [USB_PD_PORT_PS8751] = {I2C_PORT_TCPC1, 0x16, &ps8xxx_tcpm_drv, 0}, + [USB_PD_PORT_ANX3429] = { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = 0x50, + }, + .drv = &anx74xx_tcpm_drv, + .flags = TCPC_FLAGS_ALERT_OD, + }, + [USB_PD_PORT_PS8751] = { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = 0x16, + }, + .drv = &ps8xxx_tcpm_drv, + }, }; /* diff --git a/board/coral/board.c b/board/coral/board.c index ccd63c5022..2872b7357d 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -242,18 +242,20 @@ 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 = ANX74XX_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = ANX74XX_I2C_ADDR1, + }, .drv = &anx74xx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, [USB_PD_PORT_PS8751] = { - .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/elm/board.c b/board/elm/board.c index 312caa6509..cdd0a0f998 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -121,7 +121,14 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /* TCPC */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &anx7688_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR, + }, + .drv = &anx7688_tcpm_drv, + }, }; struct pi3usb9281_config pi3usb9281_chips[] = { diff --git a/board/eve/board.c b/board/eve/board.c index bb8bef1b55..c7eb7e6c57 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -215,18 +215,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] = { { - .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = ANX74XX_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = ANX74XX_I2C_ADDR1, + }, .drv = &anx74xx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, { - .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = ANX74XX_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = ANX74XX_I2C_ADDR1, + }, .drv = &anx74xx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/fizz/board.c b/board/fizz/board.c index 69759eb68e..693c26c9b4 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -191,8 +191,14 @@ 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] = { - /* Alert is active-low, push-pull */ - {NPCX_I2C_PORT0_0, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv, 0}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = I2C_ADDR_TCPC0, + }, + .drv = &ps8xxx_tcpm_drv, + }, }; static int ps8751_tune_mux(int port) diff --git a/board/flapjack/board.c b/board/flapjack/board.c index d8ede41890..c8524dca4e 100644 --- a/board/flapjack/board.c +++ b/board/flapjack/board.c @@ -283,7 +283,13 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC0, MT6370_TCPC_I2C_ADDR, &mt6370_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = MT6370_TCPC_I2C_ADDR, + }, + .drv = &mt6370_tcpm_drv}, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/glados/board.c b/board/glados/board.c index 48e1acac8b..c24c3ebef6 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -129,8 +129,22 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv}, - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR, + }, + .drv = &tcpci_tcpm_drv, + }, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR + 2, + }, + .drv = &tcpci_tcpm_drv, + }, }; /* SPI devices */ diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c index 020b628083..bba185202f 100644 --- a/board/glkrvp/chg_usb_pd.c +++ b/board/glkrvp/chg_usb_pd.c @@ -31,10 +31,22 @@ enum glkrvp_charge_ports { }; const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - /* Alert is active-low, push-pull */ - {NPCX_I2C_PORT7_0, 0xA0, &tcpci_tcpm_drv, 0}, - /* Alert is active-low, push-pull */ - {NPCX_I2C_PORT7_0, 0xA4, &tcpci_tcpm_drv, 0}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT7_0, + .addr = 0xa0, + }, + .drv = &tcpci_tcpm_drv, + }, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT7_0, + .addr = 0xa4, + }, + .drv = &tcpci_tcpm_drv, + }, }; BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT); diff --git a/board/glkrvp_ite/chg_usb_pd.c b/board/glkrvp_ite/chg_usb_pd.c index 5fb88a919a..01c8f43f1e 100644 --- a/board/glkrvp_ite/chg_usb_pd.c +++ b/board/glkrvp_ite/chg_usb_pd.c @@ -31,10 +31,22 @@ enum glkrvp_charge_ports { }; const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - /* Alert is active-low, push-pull */ - {IT83XX_I2C_CH_B, 0xA0, &tcpci_tcpm_drv, 0}, - /* Alert is active-low, push-pull */ - {IT83XX_I2C_CH_B, 0xA4, &tcpci_tcpm_drv, 0}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = IT83XX_I2C_CH_B, + .addr = 0xa0, + }, + .drv = &tcpci_tcpm_drv, + }, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = IT83XX_I2C_CH_B, + .addr = 0xa4, + }, + .drv = &tcpci_tcpm_drv, + }, }; BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT); diff --git a/board/hatch/board.c b/board/hatch/board.c index 14f8855ab8..4737239042 100644 --- a/board/hatch/board.c +++ b/board/hatch/board.c @@ -127,16 +127,21 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* USB-C TPCP Configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_TCPC_0] = { - .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = AN7447_TCPC0_I2C_ADDR, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = AN7447_TCPC0_I2C_ADDR, + }, .drv = &anx7447_tcpm_drv, .flags = TCPC_FLAGS_RESET_ACTIVE_HIGH, }, [USB_PD_PORT_TCPC_1] = { - .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - .flags = 0, }, }; diff --git a/board/helios/board.c b/board/helios/board.c index 79c41d08db..55359affdb 100644 --- a/board/helios/board.c +++ b/board/helios/board.c @@ -122,16 +122,21 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* USB-C TPCP Configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_TCPC_0] = { - .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = AN7447_TCPC0_I2C_ADDR, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = AN7447_TCPC0_I2C_ADDR, + }, .drv = &anx7447_tcpm_drv, .flags = TCPC_FLAGS_RESET_ACTIVE_HIGH, }, [USB_PD_PORT_TCPC_1] = { - .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - .flags = 0, }, }; diff --git a/board/kohaku/board.c b/board/kohaku/board.c index ba9ef38e62..23b6124ad7 100644 --- a/board/kohaku/board.c +++ b/board/kohaku/board.c @@ -112,16 +112,20 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* USB-C TPCP Configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_TCPC_0] = { - .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - .flags = 0, }, [USB_PD_PORT_TCPC_1] = { - .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - .flags = 0, }, }; diff --git a/board/kukui/board.c b/board/kukui/board.c index 534a994258..65e98ea788 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -123,7 +123,14 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC0, MT6370_TCPC_I2C_ADDR, &mt6370_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = MT6370_TCPC_I2C_ADDR, + }, + .drv = &mt6370_tcpm_drv, + }, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/nami/board.c b/board/nami/board.c index fc56150239..59fc0b4c1c 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -245,15 +245,21 @@ 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] = { [USB_PD_PORT_PS8751] = { - .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, /* Alert is active-low, push-pull */ .flags = 0, }, [USB_PD_PORT_ANX7447] = { - .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = AN7447_TCPC3_I2C_ADDR, /* Verified on v1.1 */ + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_1, + .addr = AN7447_TCPC3_I2C_ADDR, + }, .drv = &anx7447_tcpm_drv, /* Alert is active-low, push-pull */ .flags = 0, diff --git a/board/nautilus/board.c b/board/nautilus/board.c index 5bb202982e..b0071bc84c 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -168,18 +168,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] = { { - .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, { - .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/nocturne/board.c b/board/nocturne/board.c index f8e188b36c..02d4a1f6dc 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -313,19 +313,20 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { { - .i2c_host_port = I2C_PORT_USB_C0, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_USB_C0, + .addr = PS8751_I2C_ADDR1, + }, .drv = &tcpci_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, - { - .i2c_host_port = I2C_PORT_USB_C1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_USB_C1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &tcpci_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/oak/board.c b/board/oak/board.c index 845eeebe10..4e7d317a4b 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -113,8 +113,22 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); #endif const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv}, - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2, &tcpci_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR, + }, + .drv = &tcpci_tcpm_drv, + }, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR + 2, + }, + .drv = &tcpci_tcpm_drv, + }, }; struct mutex pericom_mux_lock; diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c index a306d853ac..5a632ced06 100644 --- a/board/pdeval-stm32f072/board.c +++ b/board/pdeval-stm32f072/board.c @@ -58,7 +58,14 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC, AN7447_TCPC3_I2C_ADDR, &anx7447_tcpm_drv} + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = AN7447_TCPC3_I2C_ADDR, + }, + .drv = &anx7447_tcpm_drv, + }, }; uint16_t tcpc_get_alert_status(void) diff --git a/board/poppy/board.c b/board/poppy/board.c index c65d65260c..3c27da46ba 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -210,18 +210,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] = { { - .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = ANX74XX_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = ANX74XX_I2C_ADDR1, + }, .drv = &anx74xx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, { - .i2c_host_port = NPCX_I2C_PORT0_0, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/rainier/board.c b/board/rainier/board.c index 1065bbf6ef..890aa8be80 100644 --- a/board/rainier/board.c +++ b/board/rainier/board.c @@ -127,7 +127,14 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); /******************************************************************************/ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = FUSB302_I2C_SLAVE_ADDR, + }, + .drv = &fusb302_tcpm_drv, + }, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/rammus/board.c b/board/rammus/board.c index 03aabe7514..472bb81ebc 100644 --- a/board/rammus/board.c +++ b/board/rammus/board.c @@ -163,18 +163,20 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_PS8751] = { - .i2c_host_port = I2C_PORT_TCPC1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, [USB_PD_PORT_ANX7447] = { - .i2c_host_port = I2C_PORT_TCPC0, - .i2c_slave_addr = AN7447_TCPC3_I2C_ADDR, /* Verified on v1.1 */ + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = AN7447_TCPC3_I2C_ADDR, /* Verified on v1.1 */ + }, .drv = &anx7447_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; @@ -237,7 +239,7 @@ static void ps8751_i2c_remap(void) * use the same i2c bus. Thus, reconfig the ps8751 i2c port * to i2c_0_0. */ - tcpc_config[USB_PD_PORT_PS8751].i2c_host_port = I2C_PORT_TCPC0; + tcpc_config[USB_PD_PORT_PS8751].i2c_info.port = I2C_PORT_TCPC0; } void board_tcpc_init(void) diff --git a/board/reef/board.c b/board/reef/board.c index 15e1627651..579627d536 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -247,18 +247,20 @@ 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 = ANX74XX_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_0, + .addr = ANX74XX_I2C_ADDR1, + }, .drv = &anx74xx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, [USB_PD_PORT_PS8751] = { - .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = PS8751_I2C_ADDR1, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = NPCX_I2C_PORT0_1, + .addr = PS8751_I2C_ADDR1, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c index 03ce723338..47c63c0599 100644 --- a/board/reef_it8320/board.c +++ b/board/reef_it8320/board.c @@ -94,8 +94,14 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {-1, -1, &it83xx_tcpm_drv, 0}, - {-1, -1, &it83xx_tcpm_drv, 0}, + { + .bus_type = EC_BUS_TYPE_EMBEDDED, + .drv = &it83xx_tcpm_drv + }, + { + .bus_type = EC_BUS_TYPE_EMBEDDED, + .drv = &it83xx_tcpm_drv + }, }; void board_pd_vconn_ctrl(int port, int cc_pin, int enabled) diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c index 11266a9ca0..21a64bd60b 100644 --- a/board/reef_mchp/board.c +++ b/board/reef_mchp/board.c @@ -361,18 +361,20 @@ 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 = MCHP_I2C_PORT0, - .i2c_slave_addr = 0x50, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = MCHP_I2C_PORT0, + .addr = 0x50, + }, .drv = &anx74xx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, [USB_PD_PORT_PS8751] = { - .i2c_host_port = MCHP_I2C_PORT2, - .i2c_slave_addr = 0x16, + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = MCHP_I2C_PORT2, + .addr = 0x16, + }, .drv = &ps8xxx_tcpm_drv, - /* Alert is active-low, push-pull */ - .flags = 0, }, }; diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 80a3a73c4e..4e100b3ed7 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -123,7 +123,14 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC0, + .addr = FUSB302_I2C_SLAVE_ADDR, + }, + .drv = &fusb302_tcpm_drv, + }, }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { diff --git a/board/strago/board.c b/board/strago/board.c index 57dff8a71a..f1852bb9ab 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -106,7 +106,14 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR, &tcpci_tcpm_drv}, + { + .bus_type = EC_BUS_TYPE_I2C, + .i2c_info = { + .port = I2C_PORT_TCPC, + .addr = CONFIG_TCPC_I2C_BASE_ADDR, + }, + .drv = &tcpci_tcpm_drv, + }, }; /* SPI master ports */ |