summaryrefslogtreecommitdiff
path: root/common/usb_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/usb_i2c.c')
-rw-r--r--common/usb_i2c.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/common/usb_i2c.c b/common/usb_i2c.c
index 50537ce82e..375419dfcc 100644
--- a/common/usb_i2c.c
+++ b/common/usb_i2c.c
@@ -106,9 +106,7 @@ static void usb_i2c_execute(struct usb_i2c_config const *config)
/* Payload is ready to execute. */
uint32_t count = usb_i2c_read_packet(config);
int portindex = (config->buffer[0] >> 0) & 0xf;
- /* Convert 7-bit slave address to chromium EC 8-bit address. */
- uint8_t slave_addr = (config->buffer[0] >> 7) & 0xfe;
-
+ uint16_t addr__7bf = (config->buffer[0] >> 8) & 0x7f;
int write_count = ((config->buffer[0] << 4) & 0xf00) |
((config->buffer[1] >> 0) & 0xff);
int read_count = (config->buffer[1] >> 8) & 0xff;
@@ -135,7 +133,7 @@ static void usb_i2c_execute(struct usb_i2c_config const *config)
config->buffer[0] = USB_I2C_READ_COUNT_INVALID;
} else if (portindex >= i2c_ports_used) {
config->buffer[0] = USB_I2C_PORT_INVALID;
- } else if (slave_addr == USB_I2C_CMD_ADDR) {
+ } else if (addr__7bf == USB_I2C_CMD_ADDR__7bf) {
/*
* This is a non-i2c command, invoke the handler if it has
* been registered, if not - report the appropriate error.
@@ -156,8 +154,7 @@ static void usb_i2c_execute(struct usb_i2c_config const *config)
* knows about. It should behave closer to
* EC_CMD_I2C_PASSTHRU, which can protect ports and ranges.
*/
- ret = i2c_xfer(i2c_ports[portindex].port,
- slave_addr,
+ ret = i2c_xfer__7bf(i2c_ports[portindex].port, addr__7bf,
(uint8_t *)(config->buffer + 2) + offset,
write_count,
(uint8_t *)(config->buffer + 2),