diff options
-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 */ |