summaryrefslogtreecommitdiff
path: root/chip/npcx
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-10-28 10:20:08 -0600
committerCommit Bot <commit-bot@chromium.org>2020-11-08 03:41:10 +0000
commit25ae7edffcceb662d5d2ebe92d19bf6f191d8bd5 (patch)
tree148d8136c062dab69d4a2670f82f87d8d895f07c /chip/npcx
parentdf5f77987d6707936c13a0e2fee09ddbd84c627a (diff)
downloadchrome-ec-25ae7edffcceb662d5d2ebe92d19bf6f191d8bd5.tar.gz
Add chip-specific shim along with i2c module
This change accomplishes 2 things: 1. It refactors the zephyr/shim directory to structure around chip specific compilation. In this example, we're focusing on npcx7m6fb which is used in volteer but others can be added easily. 2. It shims the common/i2c_master.c by providing an alternate implementation of i2c_xfer_unlocked that calls down to the Zephyr API i2c_write_read instead of the chip specific i2c_xfer_no_retry or chip_i2c_xfer_with_notify. The shim layer is made possible by the addition of zephyr/shim/include/i2c/i2c.h which adds a functions that needs to be implemented per chip (npcx7 family in this case) and allows us to map the current port int which is defined in chip/${CHIP}/registers.h (chip/npcx/registers-npcx7.h in our case). This function (i2c_get_device_for_port) maps the platform/ec port int to a const struct device * which is needed in the Zephyr I2C APIs. BRANCH=none BUG=b:171302975 TEST=clean_build.sh projects/experimental/volteer/ and make BOARD=eve Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I210f4758337bf384d0d6f103eef8b89126887d11 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504285 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'chip/npcx')
-rw-r--r--chip/npcx/registers-npcx7.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/chip/npcx/registers-npcx7.h b/chip/npcx/registers-npcx7.h
index 6fa10f5430..c496640c34 100644
--- a/chip/npcx/registers-npcx7.h
+++ b/chip/npcx/registers-npcx7.h
@@ -256,7 +256,12 @@ enum {
#define NPCX_SMBSEL_SMB5SEL 5
#define NPCX_SMBSEL_SMB6SEL 6
-/* SMB enumeration: I2C port definitions. */
+/*
+ * SMB enumeration: I2C port definitions.
+ *
+ * Node: If making changes here please update the translation layer for Zephyr
+ * builds at zephyr/shim/chip/npcx/i2c.c.
+ */
enum {
NPCX_I2C_PORT0_0 = 0, /* I2C port 0, bus 0 */
NPCX_I2C_PORT1_0, /* I2C port 1, bus 0 */