summaryrefslogtreecommitdiff
path: root/board/elm/board.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-06-25 12:44:16 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-19 21:11:02 +0000
commitd1a18f82ed831d4e640336ff5571f5fa64bc7b36 (patch)
treec46aeb6136de1c27c66e3d5f662e9620161bef7b /board/elm/board.c
parent1f14229fa7e499dfcee07d17add187598ff0a46c (diff)
downloadchrome-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/elm/board.c')
-rw-r--r--board/elm/board.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/board/elm/board.c b/board/elm/board.c
index cdd0a0f998..3568564621 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -92,13 +92,14 @@ const struct adc_t adc_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-int anx7688_passthru_allowed(const struct i2c_port_t *port, uint16_t address)
+int anx7688_passthru_allowed__7bf(const struct i2c_port_t *port,
+ const uint16_t addr__7bf)
{
/* Allow access to 0x2c (TCPC) */
- if (address == 0x2c)
+ if (I2C_GET_ADDR__7b(addr__7bf) == 0x2c)
return 1;
- CPRINTF("Passthru rejected on %x", address);
+ CPRINTF("Passthru rejected on %x", I2C_GET_ADDR__7b(addr__7bf));
return 0;
}
@@ -107,7 +108,7 @@ int anx7688_passthru_allowed(const struct i2c_port_t *port, uint16_t address)
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}
+ anx7688_passthru_allowed__7bf}
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -125,7 +126,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr = CONFIG_TCPC_I2C_BASE_ADDR,
+ .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
},
.drv = &anx7688_tcpm_drv,
},
@@ -466,7 +467,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[0],
.drv_data = &g_kx022_data[0],
- .addr = 1, /* SPI, device ID 0 */
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -489,7 +490,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[1],
.drv_data = &g_kx022_data[1],
- .addr = 3, /* SPI, device ID 1 */
+ .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(1),
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,