summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-11-18 16:54:54 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-30 23:55:59 +0000
commit23a975d12e3453aac4e9a15048ba43a8989d3073 (patch)
treef0162d7118edfe154f283a4e2206f130ebd21bab /board
parent508e74c84334bc3d2118c7f333320a4f7292ea6f (diff)
downloadchrome-ec-23a975d12e3453aac4e9a15048ba43a8989d3073.tar.gz
i2c: Use declared initializers for i2c_ports: boards a-l
Convert all instances of i2c_ports[] to use declared initializers. This allows the fields to be reordered without breaking code. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ibced584424f1f64718fb55cec0c972dc939bec5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300661 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/ambassador/board.c40
-rw-r--r--board/atlas/board.c45
-rw-r--r--board/bds/board.c6
-rw-r--r--board/coffeecake/board.c8
-rw-r--r--board/coral/board.c45
-rw-r--r--board/corori/board.c35
-rw-r--r--board/dooly/board.c56
-rw-r--r--board/elm/board.c18
-rw-r--r--board/endeavour/board.c32
-rw-r--r--board/eve/board.c40
-rw-r--r--board/fizz/board.c40
-rw-r--r--board/genesis/board.c48
-rw-r--r--board/hammer/board.c18
-rw-r--r--board/herobrine_npcx9/board.c54
-rw-r--r--board/host/board.c40
15 files changed, 437 insertions, 88 deletions
diff --git a/board/ambassador/board.c b/board/ambassador/board.c
index 698acf70bb..a5abbaa130 100644
--- a/board/ambassador/board.c
+++ b/board/ambassador/board.c
@@ -286,11 +286,41 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, GPIO_I2C7_SDA},
+ {
+ .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA
+ },
+ {
+ .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 4881ed6898..64d0789dd9 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -139,16 +139,41 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100,
- GPIO_EC_I2C0_POWER_SCL, GPIO_EC_I2C0_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000,
- GPIO_EC_I2C1_USB_C0_SCL, GPIO_EC_I2C1_USB_C0_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000,
- GPIO_EC_I2C2_USB_C1_SCL, GPIO_EC_I2C2_USB_C1_SDA},
- {"sensor", I2C_PORT_SENSOR, 100,
- GPIO_EC_I2C3_SENSOR_3V3_SCL, GPIO_EC_I2C3_SENSOR_3V3_SDA},
- {"battery", I2C_PORT_BATTERY, 100,
- GPIO_EC_I2C4_BATTERY_SCL, GPIO_EC_I2C4_BATTERY_SDA},
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C0_POWER_SCL,
+ .sda = GPIO_EC_I2C0_POWER_SDA
+ },
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C1_USB_C0_SCL,
+ .sda = GPIO_EC_I2C1_USB_C0_SDA
+ },
+ {
+ .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C2_USB_C1_SCL,
+ .sda = GPIO_EC_I2C2_USB_C1_SDA
+ },
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C3_SENSOR_3V3_SCL,
+ .sda = GPIO_EC_I2C3_SENSOR_3V3_SDA
+ },
+ {
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C4_BATTERY_SCL,
+ .sda = GPIO_EC_I2C4_BATTERY_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/bds/board.c b/board/bds/board.c
index 91da893a52..aedc570d51 100644
--- a/board/bds/board.c
+++ b/board/bds/board.c
@@ -33,7 +33,11 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"lightbar", 5, 400},
+ {
+ .name = "lightbar",
+ .port = 5,
+ .kbps = 400
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/coffeecake/board.c b/board/coffeecake/board.c
index 2939a65125..b344a5f745 100644
--- a/board/coffeecake/board.c
+++ b/board/coffeecake/board.c
@@ -31,7 +31,13 @@ void vbus_event(enum gpio_signal signal);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"charger", I2C_PORT_SY21612, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
+ {
+ .name = "charger",
+ .port = I2C_PORT_SY21612,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/coral/board.c b/board/coral/board.c
index a563071294..17fd01da0e 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -154,16 +154,41 @@ const struct pwm_t pwm_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", NPCX_I2C_PORT0_0, 400,
- GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", NPCX_I2C_PORT0_1, 400,
- GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA},
- {"accelgyro", I2C_PORT_GYRO, 400,
- GPIO_EC_I2C_GYRO_SCL, GPIO_EC_I2C_GYRO_SDA},
- {"sensors", NPCX_I2C_PORT2, 400,
- GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA},
- {"batt", NPCX_I2C_PORT3, 100,
- GPIO_EC_I2C_POWER_SCL, GPIO_EC_I2C_POWER_SDA},
+ {
+ .name = "tcpc0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA
+ },
+ {
+ .name = "tcpc1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA
+ },
+ {
+ .name = "accelgyro",
+ .port = I2C_PORT_GYRO,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_GYRO_SCL,
+ .sda = GPIO_EC_I2C_GYRO_SDA
+ },
+ {
+ .name = "sensors",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA
+ },
+ {
+ .name = "batt",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/corori/board.c b/board/corori/board.c
index 03f9641d9f..dc946fa4f9 100644
--- a/board/corori/board.c
+++ b/board/corori/board.c
@@ -447,30 +447,45 @@ DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
const struct i2c_port_t i2c_ports[] = {
{
- "eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA
},
{
- "battery", I2C_PORT_BATTERY, 100, GPIO_EC_I2C_BATTERY_SCL,
- GPIO_EC_I2C_BATTERY_SDA
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BATTERY_SCL,
+ .sda = GPIO_EC_I2C_BATTERY_SDA
},
#ifdef HAS_TASK_MOTIONSENSE
{
- "sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- GPIO_EC_I2C_SENSOR_SDA
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA
},
#endif
{
- "usbc0", I2C_PORT_USB_C0, 1000, GPIO_EC_I2C_USB_C0_SCL,
- GPIO_EC_I2C_USB_C0_SDA
+ .name = "usbc0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_SDA
},
#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
{
- "sub_usbc1", I2C_PORT_SUB_USB_C1, 1000,
- GPIO_EC_I2C_SUB_USB_C1_SCL, GPIO_EC_I2C_SUB_USB_C1_SDA
+ .name = "sub_usbc1",
+ .port = I2C_PORT_SUB_USB_C1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_SUB_USB_C1_SCL,
+ .sda = GPIO_EC_I2C_SUB_USB_C1_SDA
},
#endif
};
diff --git a/board/dooly/board.c b/board/dooly/board.c
index 5f854ca647..8d8f1062e9 100644
--- a/board/dooly/board.c
+++ b/board/dooly/board.c
@@ -532,13 +532,55 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"ppc1", I2C_PORT_PPC1, 400, GPIO_I2C2_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C4_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, GPIO_I2C7_SDA},
+ {
+ .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA
+ },
+ {
+ .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
+ {
+ .name = "ppc1",
+ .port = I2C_PORT_PPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
+ {
+ .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/elm/board.c b/board/elm/board.c
index f4f1e3be2e..4e1a680659 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -108,9 +108,21 @@ int anx7688_passthru_allowed(const struct i2c_port_t *port,
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"battery", I2C_PORT_BATTERY, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA,
- anx7688_passthru_allowed}
+ {
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA
+ },
+ {
+ .name = "pd",
+ .port = I2C_PORT_PD_MCU,
+ .kbps = 1000,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA,
+ .passthru_allowed = anx7688_passthru_allowed
+ }
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/endeavour/board.c b/board/endeavour/board.c
index f208da3819..98d805f60a 100644
--- a/board/endeavour/board.c
+++ b/board/endeavour/board.c
@@ -85,10 +85,34 @@ const struct mft_t mft_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"pse", I2C_PORT_PSE, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"pmic", I2C_PORT_PMIC, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .name = "pse",
+ .port = I2C_PORT_PSE,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA
+ },
+ {
+ .name = "pmic",
+ .port = I2C_PORT_PMIC,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA
+ },
+ {
+ .name = "thermal",
+ .port = I2C_PORT_THERMAL,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/eve/board.c b/board/eve/board.c
index f73118e8f2..a972cb4ebc 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -192,11 +192,41 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"accelgyro", I2C_PORT_GYRO, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"sensors", I2C_PORT_LID_ACCEL, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"batt", I2C_PORT_BATTERY, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA
+ },
+ {
+ .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA
+ },
+ {
+ .name = "accelgyro",
+ .port = I2C_PORT_GYRO,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
+ {
+ .name = "sensors",
+ .port = I2C_PORT_LID_ACCEL,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA
+ },
+ {
+ .name = "batt",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/fizz/board.c b/board/fizz/board.c
index 5b830b9150..975401d5a1 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -164,11 +164,41 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"eeprom", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .name = "tcpc",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA
+ },
+ {
+ .name = "eeprom",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA
+ },
+ {
+ .name = "charger",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
+ {
+ .name = "pmic",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA
+ },
+ {
+ .name = "thermal",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/genesis/board.c b/board/genesis/board.c
index a846478ecb..5305c8d630 100644
--- a/board/genesis/board.c
+++ b/board/genesis/board.c
@@ -133,12 +133,48 @@ const struct pwm_t pwm_channels[] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"pse", I2C_PORT_PSE, 400, GPIO_I2C4_SCL, GPIO_I2C4_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, GPIO_I2C7_SDA},
+ {
+ .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA
+ },
+ {
+ .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA
+ },
+ {
+ .name = "pse",
+ .port = I2C_PORT_PSE,
+ .kbps = 400,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C4_SDA
+ },
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/hammer/board.c b/board/hammer/board.c
index b68498acfb..b9667a9916 100644
--- a/board/hammer/board.c
+++ b/board/hammer/board.c
@@ -90,11 +90,21 @@ void usb_spi_board_disable(struct usb_spi_config const *config) {}
#ifdef CONFIG_I2C
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 400,
- GPIO_MASTER_I2C_SCL, GPIO_MASTER_I2C_SDA},
+ {
+ .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 400,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA
+ },
#ifdef BOARD_WAND
- {"charger", I2C_PORT_CHARGER, 100,
- GPIO_CHARGER_I2C_SCL, GPIO_CHARGER_I2C_SDA},
+ {
+ .name = "charger",
+ .port = I2C_PORT_CHARGER,
+ .kbps = 100,
+ .scl = GPIO_CHARGER_I2C_SCL,
+ .sda = GPIO_CHARGER_I2C_SDA
+ },
#endif
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/herobrine_npcx9/board.c b/board/herobrine_npcx9/board.c
index f63f5c7991..fea8bf3a88 100644
--- a/board/herobrine_npcx9/board.c
+++ b/board/herobrine_npcx9/board.c
@@ -64,18 +64,48 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"rtc", I2C_PORT_RTC, 400, GPIO_EC_I2C_RTC_SCL,
- GPIO_EC_I2C_RTC_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- GPIO_EC_I2C_SENSOR_SDA},
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA
+ },
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA
+ },
+ {
+ .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA
+ },
+ {
+ .name = "rtc",
+ .port = I2C_PORT_RTC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_RTC_SCL,
+ .sda = GPIO_EC_I2C_RTC_SDA
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA
+ },
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/host/board.c b/board/host/board.c
index 191fd832e1..b681ca98fb 100644
--- a/board/host/board.c
+++ b/board/host/board.c
@@ -62,15 +62,45 @@ test_mockable void fps_event(enum gpio_signal signal)
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
#ifdef I2C_PORT_BATTERY
- {"battery", I2C_PORT_BATTERY, 100, 0, 0},
+ {
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_LIGHTBAR
- {"lightbar", I2C_PORT_LIGHTBAR, 100, 0, 0},
+ {
+ .name = "lightbar",
+ .port = I2C_PORT_LIGHTBAR,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_HOST_TCPC
- {"tcpc", I2C_PORT_HOST_TCPC, 100, 0, 0},
+ {
+ .name = "tcpc",
+ .port = I2C_PORT_HOST_TCPC,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_EEPROM
- {"eeprom", I2C_PORT_EEPROM, 100, 0, 0},
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_WLC
- {"wlc", I2C_PORT_WLC, 100, 0, 0},
+ {
+ .name = "wlc",
+ .port = I2C_PORT_WLC,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#endif
};