From 483949de5dc234a038e361c562de5b5f4c2bd220 Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Thu, 13 May 2021 22:47:20 -0600 Subject: zephyr: i2c: remove frequency from devicetree The frequency wasn't actually being used as it was set by the i2c controller in the proper Zephyr driver. Also, remove the kbps field in struct i2c_port_t for Zephyr builds to make sure we don't accidentally use it later on. BRANCH=none BUG=none TEST=build trogdor and volteer Signed-off-by: Yuval Peress Change-Id: I2eea231ff629d3e6f0ebbe71923a7b0ae96af87c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2896234 Reviewed-by: Keith Short --- include/i2c.h | 2 ++ zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml | 5 ----- .../asurada/boards/riscv/asurada/asurada.dts | 4 ---- .../projects/trogdor/boards/arm/trogdor/trogdor.dts | 1 - .../projects/volteer/boards/arm/volteer/volteer.dts | 6 ------ zephyr/shim/src/i2c.c | 20 +++++++++----------- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/include/i2c.h b/include/i2c.h index 4e908733ad..709da7d451 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -108,7 +108,9 @@ struct i2c_drv { struct i2c_port_t { const char *name; /* Port name */ int port; /* Port */ +#ifndef CONFIG_ZEPHYR int kbps; /* Speed in kbps */ +#endif /* CONFIG_ZEPHYR */ enum gpio_signal scl; /* Port SCL GPIO line */ enum gpio_signal sda; /* Port SDA GPIO line */ /* When bus is protected, returns true if passthru allowed for address. 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 eb6b572569..ee61a837b3 100644 --- a/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml +++ b/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml @@ -35,11 +35,6 @@ properties: child-binding: description: Optional configuration bindings - properties: - frequency: - type: int - required: true - description: Transfer data rate in kHz child-binding: description: SCL and SDA configurations include: gpio-enum-name.yaml diff --git a/zephyr/projects/asurada/boards/riscv/asurada/asurada.dts b/zephyr/projects/asurada/boards/riscv/asurada/asurada.dts index 7193272f3d..f34a887892 100644 --- a/zephyr/projects/asurada/boards/riscv/asurada/asurada.dts +++ b/zephyr/projects/asurada/boards/riscv/asurada/asurada.dts @@ -27,7 +27,6 @@ enum-name = "I2C_PORT_POWER"; label = "POWER"; config { - frequency = <100>; scl { enum-name = "GPIO_I2C_B_SCL"; }; @@ -56,7 +55,6 @@ enum-name = "I2C_PORT_SENSOR"; label = "SENSOR"; config { - frequency = <400>; scl { enum-name = "GPIO_I2C_C_SCL"; }; @@ -75,7 +73,6 @@ enum-name = "I2C_PORT_USB_C0"; label = "USB_C0"; config { - frequency = <400>; scl { enum-name = "GPIO_I2C_F_SCL"; }; @@ -89,7 +86,6 @@ enum-name = "I2C_PORT_USB_C1"; label = "USB_C1"; config { - frequency = <400>; scl { enum-name = "GPIO_I2C_E_SCL"; }; diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts index b329014360..d361e56d5e 100644 --- a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts +++ b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts @@ -78,7 +78,6 @@ enum-name = "I2C_PORT_SENSOR"; label = "SENSOR"; config { - frequency = <400>; scl { enum-name = "GPIO_EC_I2C_SENSOR_SCL"; }; diff --git a/zephyr/projects/volteer/boards/arm/volteer/volteer.dts b/zephyr/projects/volteer/boards/arm/volteer/volteer.dts index 164b9a8b31..8a9b467c26 100644 --- a/zephyr/projects/volteer/boards/arm/volteer/volteer.dts +++ b/zephyr/projects/volteer/boards/arm/volteer/volteer.dts @@ -54,7 +54,6 @@ enum-name = "I2C_PORT_SENSOR"; label = "SENSOR"; config { - frequency = <400>; scl { enum-name = "GPIO_EC_I2C0_SENSOR_SCL"; }; @@ -73,7 +72,6 @@ enum-name = "I2C_PORT_USB_C0"; label = "USB_C0"; config { - frequency = <1000>; scl { enum-name = "GPIO_EC_I2C1_USB_C0_SCL"; }; @@ -87,7 +85,6 @@ enum-name = "I2C_PORT_USB_C1"; label = "USB_C1"; config { - frequency = <1000>; scl { enum-name = "GPIO_EC_I2C2_USB_C1_SCL"; }; @@ -101,7 +98,6 @@ enum-name = "I2C_PORT_USB_1_MIX"; label = "USB_1_MIX"; config { - frequency = <100>; scl { enum-name = "GPIO_EC_I2C3_USB_1_MIX_SCL"; }; @@ -115,7 +111,6 @@ enum-name = "I2C_PORT_POWER"; label = "POWER"; config { - frequency = <100>; scl { enum-name = "GPIO_EC_I2C5_BATTERY_SCL"; }; @@ -134,7 +129,6 @@ enum-name = "I2C_PORT_EEPROM"; label = "EEPROM"; config { - frequency = <100>; scl { enum-name = "GPIO_EC_I2C7_EEPROM_PWR_SCL_R"; }; diff --git a/zephyr/shim/src/i2c.c b/zephyr/shim/src/i2c.c index c42e9e9e75..9a1b19b61f 100644 --- a/zephyr/shim/src/i2c.c +++ b/zephyr/shim/src/i2c.c @@ -19,17 +19,15 @@ #define I2C_CONFIG_GPIO(id, type) \ DT_ENUM_UPPER_TOKEN(DT_CHILD(DT_CHILD(id, config), type), enum_name) -#define I2C_PORT_INIT(id) \ - COND_CODE_1(DT_NODE_EXISTS(DT_CHILD(id, config)), \ - ( \ - { \ - .name = DT_LABEL(id), \ - .port = I2C_PORT(id), \ - .kbps = DT_PROP(DT_CHILD(id, config), \ - frequency), \ - .scl = I2C_CONFIG_GPIO(id, scl), \ - .sda = I2C_CONFIG_GPIO(id, sda), \ - }, ), \ +#define I2C_PORT_INIT(id) \ + COND_CODE_1(DT_NODE_EXISTS(DT_CHILD(id, config)), \ + ( \ + { \ + .name = DT_LABEL(id), \ + .port = I2C_PORT(id), \ + .scl = I2C_CONFIG_GPIO(id, scl), \ + .sda = I2C_CONFIG_GPIO(id, sda), \ + }, ), \ ()) /* * Long term we will not need these, for now they're needed to get things to -- cgit v1.2.1