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/servo_v4/board.c | |
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/servo_v4/board.c')
-rw-r--r-- | board/servo_v4/board.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index 405c90c7aa..b26d86abf6 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -211,7 +211,7 @@ int usb_i2c_board_is_enabled(void) { return 1; } /* * Support tca6416 I2C ioexpander. */ -#define GPIOX_I2C_ADDR 0x40 +#define GPIOX_I2C_ADDR__7bf 0x20 #define GPIOX_IN_PORT_A 0x0 #define GPIOX_IN_PORT_B 0x1 #define GPIOX_OUT_PORT_A 0x2 @@ -226,13 +226,13 @@ static void write_ioexpander(int bank, int gpio, int val) int tmp; /* Read output port register */ - i2c_read8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_A + bank, &tmp); + i2c_read8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A + bank, &tmp); if (val) tmp |= BIT(gpio); else tmp &= ~BIT(gpio); /* Write back modified output port register */ - i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_A + bank, tmp); + i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A + bank, tmp); } /* Read a single GPIO input on the tca6416 I2C ioexpander. */ @@ -242,7 +242,7 @@ static int read_ioexpander_bit(int bank, int bit) int mask = 1 << bit; /* Read input port register */ - i2c_read8(1, GPIOX_I2C_ADDR, GPIOX_IN_PORT_A + bank, &tmp); + i2c_read8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_IN_PORT_A + bank, &tmp); return (tmp & mask) >> bit; } @@ -271,15 +271,15 @@ static void init_usb3_port(void) static void init_ioexpander(void) { /* Write all GPIO to output 0 */ - i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_A, 0x0); - i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_OUT_PORT_B, 0x0); + i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A, 0x0); + i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_B, 0x0); /* * Write GPIO direction: strap resistors to input, * all others to output. */ - i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_DIR_PORT_A, 0x0); - i2c_write8(1, GPIOX_I2C_ADDR, GPIOX_DIR_PORT_B, 0x18); + i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_DIR_PORT_A, 0x0); + i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_DIR_PORT_B, 0x18); } /* @@ -429,7 +429,7 @@ static void board_init(void) * Write USB3 Mode to PS8742 USB/DP Mux. * 0x0:disable 0x20:enable. */ - i2c_write8(1, 0x20, 0x0, 0x0); + i2c_write8__7bf(1, 0x10, 0x0, 0x0); /* Enable uservo USB by default. */ init_ioexpander(); |