summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2019-04-02 17:35:02 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-23 00:12:19 +0000
commit5ef014067c4782eee9faaf6bf28b33e7f0777394 (patch)
tree09dc321ec093f7f642f26fc3315f4de0c6f5e126 /board
parenteffce8961057b753c3c67f753857b2d214ac0852 (diff)
downloadchrome-ec-5ef014067c4782eee9faaf6bf28b33e7f0777394.tar.gz
tcpm: Refactor tcpc_config to include a flags field
tcpc_config contained a field for both the alert polarity and open drain/push pull configuration. There is also a possible difference in TCPC reset polarity. Instead of adding yet another field to describe this configuration, it would be better to convert alert polairty, open drain and reset polarity into a single flags field. This CL modifies the tcpc_config struct to use a single flags field and adds defines for what existing flag options can be. BUG=b:130194031 BRANCH=none TEST=make -j buildall Change-Id: Ifb7e7604edb7021fb2d36ee279049eb52fefc99e Signed-off-by: Scott Collyer <scollyer@google.com> Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1551581 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1767512 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/atlas/board.c6
-rw-r--r--board/cheza/board.c7
-rw-r--r--board/coral/board.c6
-rw-r--r--board/eve/board.c6
-rw-r--r--board/fizz/board.c4
-rw-r--r--board/glkrvp/chg_usb_pd.c6
-rw-r--r--board/glkrvp_ite/chg_usb_pd.c6
-rw-r--r--board/nami/board.c6
-rw-r--r--board/nautilus/board.c6
-rw-r--r--board/nocturne/board.c6
-rw-r--r--board/poppy/board.c6
-rw-r--r--board/rammus/board.c6
-rw-r--r--board/reef/board.c6
-rw-r--r--board/reef_mchp/board.c6
14 files changed, 54 insertions, 29 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c
index aec1967d13..972441ca4c 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -171,14 +171,16 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.i2c_host_port = I2C_PORT_TCPC0,
.i2c_slave_addr = I2C_ADDR_TCPC,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
{
/* right port */
.i2c_host_port = I2C_PORT_TCPC1,
.i2c_slave_addr = I2C_ADDR_TCPC,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/cheza/board.c b/board/cheza/board.c
index 66121fc3bb..06b6104df2 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -254,10 +254,11 @@ 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_ALERT_ACTIVE_LOW, TCPC_ALERT_OPEN_DRAIN},
- [USB_PD_PORT_PS8751] = {I2C_PORT_TCPC1, 0x16, &ps8xxx_tcpm_drv,
- TCPC_ALERT_ACTIVE_LOW},
+ TCPC_FLAGS_ALERT_OD},
+ /* Alert is active-low, push-pull */
+ [USB_PD_PORT_PS8751] = {I2C_PORT_TCPC1, 0x16, &ps8xxx_tcpm_drv, 0},
};
/*
diff --git a/board/coral/board.c b/board/coral/board.c
index 2c56f36b0b..be1096b520 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -243,13 +243,15 @@ 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,
.drv = &anx74xx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* 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,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/eve/board.c b/board/eve/board.c
index ea2ca06315..e61048a221 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -214,13 +214,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.i2c_host_port = I2C_PORT_TCPC0,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
.drv = &anx74xx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
{
.i2c_host_port = I2C_PORT_TCPC1,
.i2c_slave_addr = ANX74XX_I2C_ADDR1,
.drv = &anx74xx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/fizz/board.c b/board/fizz/board.c
index b3617155fa..83a39865b7 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -197,8 +197,8 @@ 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, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv,
- TCPC_ALERT_ACTIVE_LOW},
+ /* Alert is active-low, push-pull */
+ {NPCX_I2C_PORT0_0, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv, 0},
};
static int ps8751_tune_mux(int port)
diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c
index e9108d641a..1d112d8e60 100644
--- a/board/glkrvp/chg_usb_pd.c
+++ b/board/glkrvp/chg_usb_pd.c
@@ -31,8 +31,10 @@ enum glkrvp_charge_ports {
};
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
- {NPCX_I2C_PORT7_0, 0xA0, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
- {NPCX_I2C_PORT7_0, 0xA4, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
+ /* 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},
};
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 0b1a188081..d1031a94ff 100644
--- a/board/glkrvp_ite/chg_usb_pd.c
+++ b/board/glkrvp_ite/chg_usb_pd.c
@@ -31,8 +31,10 @@ enum glkrvp_charge_ports {
};
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
- {IT83XX_I2C_CH_B, 0xA0, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
- {IT83XX_I2C_CH_B, 0xA4, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
+ /* 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},
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT);
diff --git a/board/nami/board.c b/board/nami/board.c
index 75bfa139ec..7f2a2fe5e0 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -216,13 +216,15 @@ 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,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* 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 */
.drv = &anx7447_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index c98de155d7..3534e050da 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -171,13 +171,15 @@ 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,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
{
.i2c_host_port = NPCX_I2C_PORT0_1,
.i2c_slave_addr = PS8751_I2C_ADDR1,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 14e6e31dbd..059729e532 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -289,14 +289,16 @@ 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,
.drv = &tcpci_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
{
.i2c_host_port = I2C_PORT_USB_C1,
.i2c_slave_addr = PS8751_I2C_ADDR1,
.drv = &tcpci_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/poppy/board.c b/board/poppy/board.c
index be5b1c80d9..fd798fffa7 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -229,13 +229,15 @@ 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,
.drv = &anx74xx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
{
.i2c_host_port = NPCX_I2C_PORT0_0,
.i2c_slave_addr = PS8751_I2C_ADDR1,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/rammus/board.c b/board/rammus/board.c
index f654eb438f..41c1ecdb9c 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -163,13 +163,15 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.i2c_host_port = I2C_PORT_TCPC1,
.i2c_slave_addr = PS8751_I2C_ADDR1,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* 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 */
.drv = &anx7447_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/reef/board.c b/board/reef/board.c
index a0a9a0ee4c..2ef1ac32ca 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -248,13 +248,15 @@ 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,
.drv = &anx74xx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* 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,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index 733c345359..30d240b4b0 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -362,13 +362,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.i2c_host_port = MCHP_I2C_PORT0,
.i2c_slave_addr = 0x50,
.drv = &anx74xx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
[USB_PD_PORT_PS8751] = {
.i2c_host_port = MCHP_I2C_PORT2,
.i2c_slave_addr = 0x16,
.drv = &ps8xxx_tcpm_drv,
- .pol = TCPC_ALERT_ACTIVE_LOW,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
},
};