From 4d5a9a823e3eef6d624b326cbbafebc698d71cdc Mon Sep 17 00:00:00 2001 From: Caveh Jalali Date: Tue, 21 Sep 2021 16:27:52 -0700 Subject: hostcmd: Define I2C speed control interface This defines an host command to get or set the I2C bus speed of an I2C bus located on the EC. BRANCH=none BUG=b:201039003 TEST=with follow-on patches, switched I2C bus speed between 400 kHz and 1 MHz using ectool. Cq-Depend: chromium:3181506 Change-Id: I57889ebf40bcec397b6f9a52822bb5479702e9e4 Signed-off-by: Caveh Jalali Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3181505 Reviewed-by: Daisuke Nojiri Reviewed-by: Boris Mittelberg --- include/ec_commands.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/ec_commands.h b/include/ec_commands.h index d866f90918..e317c29e28 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -7010,6 +7010,31 @@ enum ec_set_base_state_cmd { EC_SET_BASE_STATE_RESET, }; +#define EC_CMD_I2C_CONTROL 0x0139 + +/* Subcommands for I2C control */ + +enum ec_i2c_control_command { + EC_I2C_CONTROL_GET_SPEED, + EC_I2C_CONTROL_SET_SPEED, +}; + +#define EC_I2C_CONTROL_SPEED_UNKNOWN 0 + +struct ec_params_i2c_control { + uint8_t port; /* I2C port number */ + uint8_t cmd; /* enum ec_i2c_control_command */ + union { + uint16_t speed_khz; + } cmd_params; +} __ec_align_size1; + +struct ec_response_i2c_control { + union { + uint16_t speed_khz; + } cmd_response; +} __ec_align_size1; + /*****************************************************************************/ /* The command range 0x200-0x2FF is reserved for Rotor. */ -- cgit v1.2.1