diff options
author | Dawid Niedzwiecki <dn@semihalf.com> | 2022-07-15 12:47:52 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-28 07:33:47 +0000 |
commit | 354ab4fb7e1e401415525ebf7d29d91d75b3b3b3 (patch) | |
tree | a6339cedd852fd3897e2d62c48914ab425b6e0af /docs | |
parent | a4288a8808be277c9b6d6b4b764c820ac7dfa068 (diff) | |
download | chrome-ec-354ab4fb7e1e401415525ebf7d29d91d75b3b3b3.tar.gz |
zephyr: rework i2c enums
Add additional enum that is created based on used I2C ports from
devicetree.
Use the new enums to create i2c enums listed in the named-i2c-ports
node. The named-i2c-port enums that point to the same i2c port have
the same value.
The change should allow getting the i2c enum value from the
named-i2c-ports node and the i2c port node(the node created by the chip
vendor) alternately. It will be useful in process of moving usbc chips
e.g. bc12 under the i2c bus, not in the named-usbc-port node.
Since i2c enums using the same port have the same value, the
i2c_physical_ports is no longer needed.
The commit reduces the usage of memory a bit because I2C_PORT_COUNT is
lower and initialization of i2c_physical_ports isn't needed.
Also, change how the enum values are defined in the dts files. Only one
node should be created per physical i2c port and define multiple enum
values.
BUG=b:228240586
TEST=zmake testall; make sure all i2c ports work
BRANCH=main
Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: I95c3f6845cfb71a69d408f33a6c7b22383f10028
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3763905
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/zephyr/zephyr_battery.md | 2 | ||||
-rw-r--r-- | docs/zephyr/zephyr_bc12.md | 2 | ||||
-rw-r--r-- | docs/zephyr/zephyr_charger.md | 2 | ||||
-rw-r--r-- | docs/zephyr/zephyr_i2c.md | 37 |
4 files changed, 15 insertions, 28 deletions
diff --git a/docs/zephyr/zephyr_battery.md b/docs/zephyr/zephyr_battery.md index c84bcc3b8e..3dde8cb9cf 100644 --- a/docs/zephyr/zephyr_battery.md +++ b/docs/zephyr/zephyr_battery.md @@ -86,7 +86,7 @@ named-i2c-ports { battery { i2c-port = <{i2c_phandle}>; remote-port = <{I2C_PASSTHRU-PORT-NUMBER}>; - enum-name = "I2C_PORT_BATTERY"; + enum-names = "I2C_PORT_BATTERY"; }; ... ... diff --git a/docs/zephyr/zephyr_bc12.md b/docs/zephyr/zephyr_bc12.md index b74d369eb7..7c4d71839b 100644 --- a/docs/zephyr/zephyr_bc12.md +++ b/docs/zephyr/zephyr_bc12.md @@ -69,7 +69,7 @@ named-i2c-ports { ... c0_bc12: c0_bc12 { i2c-port = <&i2c0_0>; - enum-name = "I2C_PORT_USB_C0_BC12"; + enum-names = "I2C_PORT_USB_C0_BC12"; }; }; diff --git a/docs/zephyr/zephyr_charger.md b/docs/zephyr/zephyr_charger.md index 3857571ad2..8bb4f8d3f5 100644 --- a/docs/zephyr/zephyr_charger.md +++ b/docs/zephyr/zephyr_charger.md @@ -56,7 +56,7 @@ named-i2c-ports { /* TODO(b/228237412): Update this comment once charger chg_chips[] is * created by a shim driver. */ - enum-name = "I2C_PORT_CHARGER"; + enum-names = "I2C_PORT_CHARGER"; }; }; ``` diff --git a/docs/zephyr/zephyr_i2c.md b/docs/zephyr/zephyr_i2c.md index da54a373a5..f8d17381d7 100644 --- a/docs/zephyr/zephyr_i2c.md +++ b/docs/zephyr/zephyr_i2c.md @@ -101,7 +101,7 @@ named-i2c-ports { battery { i2c-port = <&i2c0_0>; remote-port = <0>; - enum-name = "I2C_PORT_BATTERY"; + enum-names = "I2C_PORT_BATTERY"; } }; ``` @@ -115,13 +115,9 @@ named-i2c-ports { battery { i2c-port = <&i2c0_0>; remote-port = <0>; - enum-name = "I2C_PORT_BATTERY"; + enum-names = "I2C_PORT_BATTERY", + "I2C_PORT_CHARGER"; } - charger { - i2c-port = <&i2c0_0>; - remote-port = <0>; - enum-name = "I2C_PORT_CHARGER"; - }; }; ``` @@ -307,39 +303,30 @@ below: i2c_sensor: sensor { i2c-port = <&i2c0_0>; - enum-name = "I2C_PORT_SENSOR"; - }; - i2c-accel { - i2c-port = <&i2c0_0>; - enum-name = "I2C_PORT_ACCEL"; + enum-names = "I2C_PORT_SENSOR", + "I2C_PORT_ACCEL"; }; i2c_usb_c0: usb-c0 { i2c-port = <&i2c1_0>; - enum-name = "I2C_PORT_USB_C0"; + enum-names = "I2C_PORT_USB_C0"; }; i2c_usb_c1: usb-c1 { i2c-port = <&i2c2_0>; - enum-name = "I2C_PORT_USB_C1"; + enum-names = "I2C_PORT_USB_C1"; }; usb1-mix { i2c-port = <&i2c3_0>; - enum-name = "I2C_PORT_USB_1_MIX"; + enum-names = "I2C_PORT_USB_1_MIX"; }; power { i2c-port = <&i2c5_0>; - enum-name = "I2C_PORT_POWER"; - }; - battery { - i2c-port = <&i2c5_0>; - enum-name = "I2C_PORT_BATTERY"; + enum-names = "I2C_PORT_POWER", + "I2C_PORT_BATTERY"; }; eeprom { i2c-port = <&i2c7_0>; - enum-name = "I2C_PORT_EEPROM"; - }; - charger { - i2c-port = <&i2c7_0>; - enum-name = "I2C_PORT_CHARGER"; + enum-names = "I2C_PORT_EEPROM", + "I2C_PORT_CHARGER"; }; }; ``` |