summaryrefslogtreecommitdiff
path: root/common/i2c_controller.c
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2021-04-08 15:32:21 +0000
committerCommit Bot <commit-bot@chromium.org>2021-04-08 17:19:25 +0000
commit104abee3dd48ac133e16e9691efa8ad6883d92fb (patch)
tree4d59f3cd58857c1f6aaeb734b2a6b2c8017e30b9 /common/i2c_controller.c
parentc153ecac7a6f6ac2d3e10b5b853a5d4f5a911123 (diff)
downloadchrome-ec-104abee3dd48ac133e16e9691efa8ad6883d92fb.tar.gz
i2c_controller: zephyr: explicitly strip flags from addr_flags
The ECOS I2C APIs use addr_flag to pass the I2C address together with few flags. These are currently passed to the Zephyr API stripping only the PEC bit, and no other flags are used in Zephyr platforms at the moment, but if any flag would be present it would confuse the Zephyr I2C stack. This changes the Zephyr part of the driver to explicitly strip any possible flag from add_flag, and also add a warning to signal that we are discarding some information. BUG=none BRANCH=none TEST=build and flash on volteer TEST=cbi shell command Change-Id: I497fe33c52c78d783c86711928067a4aa0a321d7 Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2814624 Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'common/i2c_controller.c')
-rw-r--r--common/i2c_controller.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c
index a76c58691a..2b5dbd99fd 100644
--- a/common/i2c_controller.c
+++ b/common/i2c_controller.c
@@ -238,8 +238,13 @@ int i2c_xfer_unlocked(const int port,
num_msgs++;
}
+
+ if (no_pec_af & ~I2C_ADDR_MASK)
+ ccprintf("Ignoring flags from i2c addr_flags: %04x",
+ no_pec_af);
+
return i2c_transfer(i2c_get_device_for_port(port), msg,
- num_msgs, no_pec_af);
+ num_msgs, I2C_STRIP_FLAGS(no_pec_af));
#elif defined(CONFIG_I2C_XFER_LARGE_TRANSFER)
ret = i2c_xfer_no_retry(port, no_pec_af,
out, out_size, in,