summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/i2c.c
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-11-05 13:31:32 +0100
committerCommit Bot <commit-bot@chromium.org>2021-11-08 23:25:55 +0000
commitbd06ea8601161fcb65122b08708ed8a73b387c71 (patch)
tree76ad95cb56d8defdaf85f92f6a6551a70e81b577 /zephyr/shim/src/i2c.c
parent04e6a2380e1cbafb169c7194f0fc58d460193ea6 (diff)
downloadchrome-ec-bd06ea8601161fcb65122b08708ed8a73b387c71.tar.gz
zephyr: i2c: Add dynamic-speed flag to named-i2c node
Add a property dynamic-speed to a i2c-named dts node. It informs that the i2c speed of the i2c node can be changed in run-time with a console command or a host command. BUG=b:201408931 TEST=zmake testall & verify that i2c freq can be changed for marked ports BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I1b261cab6bf288e574c600c6e97167e9edee2e2f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3264184 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim/src/i2c.c')
-rw-r--r--zephyr/shim/src/i2c.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/zephyr/shim/src/i2c.c b/zephyr/shim/src/i2c.c
index 11f9e03ed4..73f9cdd58e 100644
--- a/zephyr/shim/src/i2c.c
+++ b/zephyr/shim/src/i2c.c
@@ -26,10 +26,15 @@
#define INIT_REMOTE_PORTS(id) \
[I2C_PORT(id)] = DT_PROP_OR(id, remote_port, -1),
-#define I2C_PORT_INIT(id) \
- { \
- .name = DT_LABEL(id), \
- .port = I2C_PORT(id), \
+#define I2C_PORT_FLAGS(id) \
+ COND_CODE_1(DT_PROP(id, dynamic_speed), (I2C_PORT_FLAG_DYNAMIC_SPEED), \
+ (0))
+
+#define I2C_PORT_INIT(id) \
+ { \
+ .name = DT_LABEL(id), \
+ .port = I2C_PORT(id), \
+ .flags = I2C_PORT_FLAGS(id), \
},
/*
* Long term we will not need these, for now they're needed to get things to