diff options
author | Keith Short <keithshort@chromium.org> | 2021-11-18 16:54:54 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-30 23:55:36 +0000 |
commit | cdc4811ebe80e0e7a0edeb093dc74b9d947290bb (patch) | |
tree | 09eba2a9ed32f68d83f22052863e69cbf676f6bb | |
parent | d4832f0d001fa567e633b9c37af2b78a38592403 (diff) | |
download | chrome-ec-cdc4811ebe80e0e7a0edeb093dc74b9d947290bb.tar.gz |
i2c: Use declared initializers for i2c_ports: reef boards
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: Iff4681dc3c750fe7acc0601983dde2fbbc06de38
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300187
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r-- | board/reef/board.c | 45 | ||||
-rw-r--r-- | board/reef_it8320/board.c | 18 | ||||
-rw-r--r-- | board/reef_mchp/board.c | 45 |
3 files changed, 84 insertions, 24 deletions
diff --git a/board/reef/board.c b/board/reef/board.c index ed8e83d0a8..92ff6a7764 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -147,16 +147,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/reef_it8320/board.c b/board/reef_it8320/board.c index 92fdc66806..d965b53593 100644 --- a/board/reef_it8320/board.c +++ b/board/reef_it8320/board.c @@ -66,10 +66,20 @@ const struct adc_t adc_channels[] = { BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); const struct i2c_port_t i2c_ports[] = { - {"mux", IT83XX_I2C_CH_C, 400, - GPIO_EC_I2C_C_SCL, GPIO_EC_I2C_C_SDA}, - {"batt", IT83XX_I2C_CH_E, 100, - GPIO_EC_I2C_E_SCL, GPIO_EC_I2C_E_SDA}, + { + .name = "mux", + .port = IT83XX_I2C_CH_C, + .kbps = 400, + .scl = GPIO_EC_I2C_C_SCL, + .sda = GPIO_EC_I2C_C_SDA + }, + { + .name = "batt", + .port = IT83XX_I2C_CH_E, + .kbps = 100, + .scl = GPIO_EC_I2C_E_SCL, + .sda = GPIO_EC_I2C_E_SDA + }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c index b934264510..be24f34aa8 100644 --- a/board/reef_mchp/board.c +++ b/board/reef_mchp/board.c @@ -205,16 +205,41 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); * 400 to 100 kHz. */ const struct i2c_port_t i2c_ports[] = { - {"tcpc0", MCHP_I2C_PORT0, 400, - GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA}, - {"tcpc1", MCHP_I2C_PORT2, 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", MCHP_I2C_PORT7, 400, - GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA}, - {"batt", MCHP_I2C_PORT3, 100, - GPIO_EC_I2C_POWER_SCL, GPIO_EC_I2C_POWER_SDA}, + { + .name = "tcpc0", + .port = MCHP_I2C_PORT0, + .kbps = 400, + .scl = GPIO_EC_I2C_USB_C0_PD_SCL, + .sda = GPIO_EC_I2C_USB_C0_PD_SDA + }, + { + .name = "tcpc1", + .port = MCHP_I2C_PORT2, + .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 = MCHP_I2C_PORT7, + .kbps = 400, + .scl = GPIO_EC_I2C_SENSOR_SCL, + .sda = GPIO_EC_I2C_SENSOR_SDA + }, + { + .name = "batt", + .port = MCHP_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); |