summaryrefslogtreecommitdiff
path: root/zephyr/boards
diff options
context:
space:
mode:
authorWealian Liao <whliao@nuvoton.corp-partner.google.com>2021-07-06 17:52:16 +0800
committerCommit Bot <commit-bot@chromium.org>2021-07-29 16:53:01 +0000
commit5e07ac82ecf51aff07a8def8a4bae1330c426b22 (patch)
tree58eb76f1407c91b28f37ec9949383b72282ec59b /zephyr/boards
parent128ffb9526c7275f158d588243d03a4f4e2ac0af (diff)
downloadchrome-ec-5e07ac82ecf51aff07a8def8a4bae1330c426b22.tar.gz
zephyr: npcx_evb: Enable I2C
This CL enables I2C for npcx7/9_evb. Currently, zephyr-OS ec doesn't use the GPIO for i2c unwedge functionality. Remove the GPIO setting for i2c in gpio.dts. BUG=none BRANCH=none TEST=Get sensor value by `i2c` shell command ``` uart:~$ i2c scan I2C_2_PORT_0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 1 devices found on I2C_2_PORT_0 uart:~$ i2c read I2C_2_PORT_0 0x48 0x00 2 00000000: 1f 80 ``` Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: If5029c41b7ba5400ee1492b408f7ab6975218c5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3060348 Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/boards')
-rw-r--r--zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig3
-rw-r--r--zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig3
-rw-r--r--zephyr/boards/arm/npcx_evb/npcx_evb.dtsi55
3 files changed, 61 insertions, 0 deletions
diff --git a/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig b/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig
index 7491ae09df..cacc3fe709 100644
--- a/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig
+++ b/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig
@@ -32,3 +32,6 @@ CONFIG_CLOCK_CONTROL=y
# WATCHDOG configuration
CONFIG_WATCHDOG=y
+
+# I2C
+CONFIG_I2C=y
diff --git a/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig b/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig
index cfb3a263e8..3dc981e555 100644
--- a/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig
+++ b/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig
@@ -31,3 +31,6 @@ CONFIG_CLOCK_CONTROL=y
# WATCHDOG configuration
CONFIG_WATCHDOG=y
+
+# I2C
+CONFIG_I2C=y
diff --git a/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi b/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi
index 65c1ab7e68..3c1bb67f94 100644
--- a/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi
+++ b/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi
@@ -14,4 +14,59 @@
zephyr,shell-uart = &uart1;
zephyr,flash = &flash0;
};
+
+ named-i2c-ports {
+ compatible = "named-i2c-ports";
+
+ i2c_evb_0_0 {
+ i2c-port = <&i2c0_0>;
+ enum-name = "I2C_PORT_EVB_0";
+ label = "I2C0_0";
+ };
+ i2c_evb_1_0 {
+ i2c-port = <&i2c1_0>;
+ enum-name = "I2C_PORT_EVB_1";
+ label = "I2C1_0";
+ };
+ i2c_evb_2_0 {
+ i2c-port = <&i2c2_0>;
+ enum-name = "I2C_PORT_EVB_2";
+ label = "I2C2_0";
+ };
+ i2c_evb_3_0 {
+ i2c-port = <&i2c3_0>;
+ enum-name = "I2C_PORT_EVB_3";
+ label = "I2C3_0";
+ };
+ i2c_evb_7_0 {
+ i2c-port = <&i2c7_0>;
+ enum-name = "I2C_PORT_EVB_7";
+ label = "I2C7_0";
+ };
+ };
+};
+
+&i2c0_0 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+};
+
+&i2c1_0 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+};
+
+&i2c2_0 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+};
+
+&i2c3_0 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+};
+
+&i2c7_0 {
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
};