diff options
author | Denis Brockus <dbrockus@chromium.org> | 2019-06-25 12:44:16 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-19 21:11:02 +0000 |
commit | d1a18f82ed831d4e640336ff5571f5fa64bc7b36 (patch) | |
tree | c46aeb6136de1c27c66e3d5f662e9620161bef7b /board/flapjack | |
parent | 1f14229fa7e499dfcee07d17add187598ff0a46c (diff) | |
download | chrome-ec-d1a18f82ed831d4e640336ff5571f5fa64bc7b36.tar.gz |
Use 7bit I2C/SPI slave addresses in EC
Opt for 7bit slave addresses in EC code. If 8bit is
expected by a driver, make it local and show this in
the naming.
Use __7b, __7bf and __8b as name extensions for i2c/spi
addresses used in the EC codebase. __7b indicates a
7bit address by itself. __7bf indicates a 7bit address
with optional flags attached. __8b indicates a 8bit
address by itself.
Allow space for 10bit addresses, even though this is
not currently being used by any of our attached
devices.
These extensions are for verification purposes only and
will be removed in the last pass of this ticket. I want
to make sure the variable names reflect the type to help
eliminate future 7/8/7-flags confusion.
BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'board/flapjack')
-rw-r--r-- | board/flapjack/battery.c | 4 | ||||
-rw-r--r-- | board/flapjack/board.c | 20 | ||||
-rw-r--r-- | board/flapjack/board.h | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/board/flapjack/battery.c b/board/flapjack/battery.c index 3c3825d5cf..5bb6b07a9f 100644 --- a/board/flapjack/battery.c +++ b/board/flapjack/battery.c @@ -398,10 +398,10 @@ int charger_profile_override(struct charge_state_data *curr) * Pull down WPC VBUS. Need to use raw i2c APIs because RO * doesn't have p9221 driver. If WPC is off, this is a no-op. */ - if (i2c_read_offset16(I2C_PORT_WPC, P9221_R7_ADDR, + if (i2c_read_offset16__7bf(I2C_PORT_WPC, P9221_R7_ADDR__7bf, P9221R7_VOUT_SET_REG, &val, 1) == EC_SUCCESS && val * 100 != wpc_mv) - i2c_write_offset16(I2C_PORT_WPC, P9221_R7_ADDR, + i2c_write_offset16__7bf(I2C_PORT_WPC, P9221_R7_ADDR__7bf, P9221R7_VOUT_SET_REG, wpc_mv / 100, 1); if ((curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE) || diff --git a/board/flapjack/board.c b/board/flapjack/board.c index 5549e7b97e..fcbf71938c 100644 --- a/board/flapjack/board.c +++ b/board/flapjack/board.c @@ -138,12 +138,12 @@ static void board_setup_panel(void) dim = sku & SKU_ID_PANEL_SIZE_MASK ? 0xc4 : 0xc8; } - rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLEN, - channel); - rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLDIM, - dim); - rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR, MT6370_BACKLIGHT_BLPWM, - 0xac); + rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf, + MT6370_BACKLIGHT_BLEN, channel); + rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf, + MT6370_BACKLIGHT_BLDIM, dim); + rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf, + MT6370_BACKLIGHT_BLPWM, 0xac); if (rv) CPRINTS("Board setup panel failed"); } @@ -288,7 +288,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { .port = I2C_PORT_TCPC0, - .addr = MT6370_TCPC_I2C_ADDR, + .addr__7bf = MT6370_TCPC_I2C_ADDR__7bf, }, .drv = &mt6370_tcpm_drv}, }; @@ -500,7 +500,7 @@ struct motion_sensor_t motion_sensors[] = { .mutex = &g_lid_mutex, .drv_data = &g_bmi160_data, .port = I2C_PORT_ACCEL, - .addr = BMI160_ADDR0, + .i2c_spi_addr__7bf = BMI160_ADDR0__7bf, .rot_standard_ref = &lid_standard_ref, .default_range = 4, /* g */ .min_frequency = BMI160_ACCEL_MIN_FREQ, @@ -523,7 +523,7 @@ struct motion_sensor_t motion_sensors[] = { .mutex = &g_lid_mutex, .drv_data = &g_bmi160_data, .port = I2C_PORT_ACCEL, - .addr = BMI160_ADDR0, + .i2c_spi_addr__7bf = BMI160_ADDR0__7bf, .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, .min_frequency = BMI160_GYRO_MIN_FREQ, @@ -538,7 +538,7 @@ struct motion_sensor_t motion_sensors[] = { .drv = &tcs3400_drv, .drv_data = &g_tcs3400_data, .port = I2C_PORT_ALS, - .addr = TCS3400_I2C_ADDR, + .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf, .rot_standard_ref = NULL, .default_range = 0x10000, /* scale = 1x, uscale = 0 */ .min_frequency = TCS3400_LIGHT_MIN_FREQ, diff --git a/board/flapjack/board.h b/board/flapjack/board.h index 693a1bb8a9..13a010f416 100644 --- a/board/flapjack/board.h +++ b/board/flapjack/board.h @@ -225,10 +225,10 @@ #define I2C_PORT_EEPROM 1 /* I2C addresses */ -#define I2C_ADDR_EEPROM 0xA0 +#define I2C_ADDR_EEPROM__7bf 0x50 /* Route sbs host requests to virtual battery driver */ -#define VIRTUAL_BATTERY_ADDR 0x16 +#define VIRTUAL_BATTERY_ADDR__7bf 0x0B /* Enable Accel over SPI */ #define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */ |