diff options
-rw-r--r-- | zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml | 5 | ||||
-rw-r--r-- | zephyr/shim/src/i2c.c | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml b/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml index 9d0a7187e5..e27488c9a9 100644 --- a/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml +++ b/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml @@ -55,3 +55,8 @@ properties: description: Human readable string describing the device (used as device_get_binding() argument). + dynamic-speed: + type: boolean + required: false + description: + Enables run-time speed configuration. 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 |