diff options
author | Nicolas Boichat <drinkcat@google.com> | 2016-07-18 10:03:29 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-19 00:05:58 -0700 |
commit | eb56185500932271836099aa8841991fbc677874 (patch) | |
tree | e0b4b814e44a2a929af2517b60a07dd1d787ed13 | |
parent | b7a604728abe7e332a616b0cad761dec6e501877 (diff) | |
download | chrome-ec-eb56185500932271836099aa8841991fbc677874.tar.gz |
common/i2c: Remove I2C read/write commands
ectool stopped relying on these commands a while back, remove
them to save space.
BRANCH=none
BUG=chrome-os-partner:23570
TEST=ectool i2cread still works
Change-Id: I63c7a60cdc5ad5c654c49f165175e1b2fe8c4262
Reviewed-on: https://chromium-review.googlesource.com/361160
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | common/i2c.c | 72 | ||||
-rw-r--r-- | include/ec_commands.h | 6 |
2 files changed, 4 insertions, 74 deletions
diff --git a/common/i2c.c b/common/i2c.c index 51de07dd92..2540a325c7 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -461,78 +461,6 @@ unwedge_done: /*****************************************************************************/ /* Host commands */ -/* - * TODO(crosbug.com/p/23570): remove separate read and write commands, as soon - * as ectool supports EC_CMD_I2C_PASSTHRU. - */ - -static int i2c_command_read(struct host_cmd_handler_args *args) -{ - const struct ec_params_i2c_read *p = args->params; - struct ec_response_i2c_read *r = args->response; - const struct i2c_port_t *i2c_port; - int data, rv = -1; - -#ifdef CONFIG_I2C_PASSTHRU_RESTRICTED - if (system_is_locked()) - return EC_RES_ACCESS_DENIED; -#endif - - i2c_port = get_i2c_port(p->port); - if (!i2c_port) - return EC_RES_INVALID_PARAM; - - if (port_protected[p->port] && i2c_port->passthru_allowed) { - if (!i2c_port->passthru_allowed(i2c_port, p->addr >> 1)) - return EC_RES_ACCESS_DENIED; - } - - if (p->read_size == 16) - rv = i2c_read16(p->port, p->addr, p->offset, &data); - else if (p->read_size == 8) - rv = i2c_read8(p->port, p->addr, p->offset, &data); - - if (rv) - return EC_RES_ERROR; - r->data = data; - args->response_size = sizeof(*r); - - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_I2C_READ, i2c_command_read, EC_VER_MASK(0)); - -static int i2c_command_write(struct host_cmd_handler_args *args) -{ - const struct ec_params_i2c_write *p = args->params; - const struct i2c_port_t *i2c_port; - int rv = -1; - -#ifdef CONFIG_I2C_PASSTHRU_RESTRICTED - if (system_is_locked()) - return EC_RES_ACCESS_DENIED; -#endif - - i2c_port = get_i2c_port(p->port); - if (!i2c_port) - return EC_RES_INVALID_PARAM; - - if (port_protected[p->port] && i2c_port->passthru_allowed) { - if (!i2c_port->passthru_allowed(i2c_port, p->addr >> 1)) - return EC_RES_ACCESS_DENIED; - } - - if (p->write_size == 16) - rv = i2c_write16(p->port, p->addr, p->offset, p->data); - else if (p->write_size == 8) - rv = i2c_write8(p->port, p->addr, p->offset, p->data); - - if (rv) - return EC_RES_ERROR; - - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_I2C_WRITE, i2c_command_write, EC_VER_MASK(0)); - #ifdef CONFIG_I2C_DEBUG_PASSTHRU #define PTHRUPRINTF(format, args...) CPRINTS(format, ## args) #else diff --git a/include/ec_commands.h b/include/ec_commands.h index c69440fb06..0d0f686e7e 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2712,8 +2712,10 @@ enum gpio_get_subcmd { /* I2C commands. Only available when flash write protect is unlocked. */ /* - * TODO(crosbug.com/p/23570): These commands are deprecated, and will be - * removed soon. Use EC_CMD_I2C_PASSTHRU instead. + * CAUTION: These commands are deprecated, and are not supported anymore in EC + * builds >= 8398.0.0 (see crosbug.com/p/23570). + * + * Use EC_CMD_I2C_PASSTHRU instead. */ /* Read I2C bus */ |