diff options
author | Dawid Niedzwiecki <dn@semihalf.com> | 2021-10-05 10:59:59 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-06 06:59:37 +0000 |
commit | c8892bba6f9af3eefb86d3c86921402cff259914 (patch) | |
tree | 027e81c34a7db261521936a683ada064f323e74e | |
parent | feef497df8a5ba450161959b416d9eb56ec31027 (diff) | |
download | chrome-ec-c8892bba6f9af3eefb86d3c86921402cff259914.tar.gz |
zephyr: convert port number for I2C_CONTROL HC
The port number passed via the I2C control host command may be different
than the one used in ZephyrEC so convert it based on the "remote-port"
property in DTS.
BUG=b:201408931
BRANCH=none
TEST=zmake testall
Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: I71e05df2eb4f76b8c93948a97f47193aaaa6e25e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3205251
Reviewed-by: Yuval Peress <peress@google.com>
Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
-rw-r--r-- | common/i2c_controller.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c index 92234bc600..8ce4e2bad1 100644 --- a/common/i2c_controller.c +++ b/common/i2c_controller.c @@ -1488,6 +1488,15 @@ DECLARE_HOST_COMMAND(EC_CMD_I2C_PASSTHRU_PROTECT, i2c_command_passthru_protect, static enum ec_status i2c_command_control(struct host_cmd_handler_args *args) { +#ifdef CONFIG_ZEPHYR + /* For Zephyr, convert the received remote port number to a port number + * used in EC. + */ + ((struct ec_params_i2c_control *)(args->params))->port = + i2c_get_port_from_remote_port( + ((struct ec_params_i2c_control *)(args->params)) + ->port); +#endif const struct ec_params_i2c_control *params = args->params; struct ec_response_i2c_control *resp = args->response; enum i2c_freq old_i2c_freq; |