summaryrefslogtreecommitdiff
path: root/common/peripheral.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 /common/peripheral.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 'common/peripheral.c')
-rw-r--r--common/peripheral.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/common/peripheral.c b/common/peripheral.c
index 301165e34e..eafd5d6f49 100644
--- a/common/peripheral.c
+++ b/common/peripheral.c
@@ -22,8 +22,7 @@ static int hc_locate_chip(struct host_cmd_handler_args *args)
return EC_RES_OVERFLOW;
resp->bus_type = EC_BUS_TYPE_I2C;
resp->i2c_info.port = I2C_PORT_EEPROM;
- /* Convert from 8-bit address to 7-bit address */
- resp->i2c_info.addr = I2C_ADDR_EEPROM >> 1;
+ resp->i2c_info.addr__7bf = I2C_ADDR_EEPROM__7bf;
#else
/* Lookup type is supported, but not present on system. */
return EC_RES_UNAVAILABLE;
@@ -37,8 +36,8 @@ static int hc_locate_chip(struct host_cmd_handler_args *args)
if (resp->bus_type == EC_BUS_TYPE_I2C) {
resp->i2c_info.port =
tcpc_config[params->index].i2c_info.port;
- resp->i2c_info.addr =
- tcpc_config[params->index].i2c_info.addr >> 1;
+ resp->i2c_info.addr__7bf =
+ tcpc_config[params->index].i2c_info.addr__7bf;
}
#ifdef CONFIG_INTEL_VIRTUAL_MUX
resp->reserved = tcpc_config[params->index].usb23;