summaryrefslogtreecommitdiff
path: root/zephyr/projects
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2022-01-23 16:15:40 +1100
committerCommit Bot <commit-bot@chromium.org>2022-01-28 01:42:57 +0000
commit7be8e21ceb8d9b777b7ecdb207de024b771e465e (patch)
tree118727ad2b83f08615c137ccce9cb113cb05faa9 /zephyr/projects
parent20fc386d20a6b3cae93e426f62f95f74e6bcee70 (diff)
downloadchrome-ec-7be8e21ceb8d9b777b7ecdb207de024b771e465e.tar.gz
npcx_evb: Migrate interrupts to new framework
Migrate interrupts to new configuration framework. BUG=b:215259628,b:215259627 TEST=zmake configure -b {npcx9,npcx7} BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I830e7d888c635fb943b1546d6d827de2c876d8b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3413596 Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'zephyr/projects')
-rw-r--r--zephyr/projects/npcx_evb/npcx7/BUILD.py2
-rw-r--r--zephyr/projects/npcx_evb/npcx7/gpio.dts3
-rw-r--r--zephyr/projects/npcx_evb/npcx7/include/gpio_map.h21
-rw-r--r--zephyr/projects/npcx_evb/npcx7/interrupts.dts26
-rw-r--r--zephyr/projects/npcx_evb/npcx9/BUILD.py8
-rw-r--r--zephyr/projects/npcx_evb/npcx9/gpio.dts3
-rw-r--r--zephyr/projects/npcx_evb/npcx9/include/gpio_map.h21
-rw-r--r--zephyr/projects/npcx_evb/npcx9/interrupts.dts26
8 files changed, 66 insertions, 44 deletions
diff --git a/zephyr/projects/npcx_evb/npcx7/BUILD.py b/zephyr/projects/npcx_evb/npcx7/BUILD.py
index 9b9789c3d9..c16eba209b 100644
--- a/zephyr/projects/npcx_evb/npcx7/BUILD.py
+++ b/zephyr/projects/npcx_evb/npcx7/BUILD.py
@@ -5,5 +5,5 @@
register_npcx_project(
project_name="npcx7",
zephyr_board="npcx7_evb",
- dts_overlays=["gpio.dts", "pwm.dts", "fan.dts", "keyboard.dts"],
+ dts_overlays=["gpio.dts", "interrupts.dts", "pwm.dts", "fan.dts", "keyboard.dts"],
)
diff --git a/zephyr/projects/npcx_evb/npcx7/gpio.dts b/zephyr/projects/npcx_evb/npcx7/gpio.dts
index df28dad76c..3bfc4f386a 100644
--- a/zephyr/projects/npcx_evb/npcx7/gpio.dts
+++ b/zephyr/projects/npcx_evb/npcx7/gpio.dts
@@ -15,14 +15,17 @@
enum-name = "GPIO_WP_L";
};
gpio_ac_present: ac_present {
+ #gpio-cells = <0>;
gpios = <&gpiod 2 GPIO_INPUT>;
enum-name = "GPIO_AC_PRESENT";
};
gpio_power_button_l: power_button_l {
+ #gpio-cells = <0>;
gpios = <&gpio0 0 GPIO_INPUT>;
enum-name = "GPIO_POWER_BUTTON_L";
};
gpio_lid_open: lid_open {
+ #gpio-cells = <0>;
gpios = <&gpio0 1 GPIO_INPUT>;
enum-name = "GPIO_LID_OPEN";
};
diff --git a/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h b/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h
index 741cbd89a2..b4c6591fbc 100644
--- a/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h
+++ b/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h
@@ -11,25 +11,4 @@
#define GPIO_KBD_KSO2 GPIO_UNIMPLEMENTED
-/*
- * Set EC_CROS_GPIO_INTERRUPTS to a space-separated list of GPIO_INT items.
- *
- * Each GPIO_INT requires three parameters:
- * gpio_signal - The enum gpio_signal for the interrupt gpio
- * interrupt_flags - The interrupt-related flags (e.g. GPIO_INT_EDGE_BOTH)
- * handler - The platform/ec interrupt handler.
- *
- * Ensure that this files includes all necessary headers to declare all
- * referenced handler functions.
- *
- * For example, one could use the follow definition:
- * #define EC_CROS_GPIO_INTERRUPTS \
- * GPIO_INT(NAMED_GPIO(h1_ec_pwr_btn_odl), GPIO_INT_EDGE_BOTH, button_print)
- */
-#define EC_CROS_GPIO_INTERRUPTS \
- GPIO_INT(GPIO_AC_PRESENT, GPIO_INT_EDGE_BOTH, extpower_interrupt) \
- GPIO_INT(GPIO_LID_OPEN, GPIO_INT_EDGE_BOTH, lid_interrupt) \
- GPIO_INT(GPIO_POWER_BUTTON_L, GPIO_INT_EDGE_BOTH, \
- power_button_interrupt)
-
#endif /* __ZEPHYR_GPIO_MAP_H */
diff --git a/zephyr/projects/npcx_evb/npcx7/interrupts.dts b/zephyr/projects/npcx_evb/npcx7/interrupts.dts
new file mode 100644
index 0000000000..ee3fa90bd5
--- /dev/null
+++ b/zephyr/projects/npcx_evb/npcx7/interrupts.dts
@@ -0,0 +1,26 @@
+/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_ac_present: ac_present {
+ irq-gpio = <&gpio_ac_present>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "extpower_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-gpio = <&gpio_lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_power_button: power_button {
+ irq-gpio = <&gpio_power_button_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ };
+};
diff --git a/zephyr/projects/npcx_evb/npcx9/BUILD.py b/zephyr/projects/npcx_evb/npcx9/BUILD.py
index afd6816af9..e6b2716cb4 100644
--- a/zephyr/projects/npcx_evb/npcx9/BUILD.py
+++ b/zephyr/projects/npcx_evb/npcx9/BUILD.py
@@ -5,5 +5,11 @@
register_npcx_project(
project_name="npcx9",
zephyr_board="npcx9_evb",
- dts_overlays=["gpio.dts", "pwm.dts", "fan.dts", "keyboard.dts"],
+ dts_overlays=[
+ "gpio.dts",
+ "interrupts.dts",
+ "pwm.dts",
+ "fan.dts",
+ "keyboard.dts",
+ ],
)
diff --git a/zephyr/projects/npcx_evb/npcx9/gpio.dts b/zephyr/projects/npcx_evb/npcx9/gpio.dts
index df28dad76c..3bfc4f386a 100644
--- a/zephyr/projects/npcx_evb/npcx9/gpio.dts
+++ b/zephyr/projects/npcx_evb/npcx9/gpio.dts
@@ -15,14 +15,17 @@
enum-name = "GPIO_WP_L";
};
gpio_ac_present: ac_present {
+ #gpio-cells = <0>;
gpios = <&gpiod 2 GPIO_INPUT>;
enum-name = "GPIO_AC_PRESENT";
};
gpio_power_button_l: power_button_l {
+ #gpio-cells = <0>;
gpios = <&gpio0 0 GPIO_INPUT>;
enum-name = "GPIO_POWER_BUTTON_L";
};
gpio_lid_open: lid_open {
+ #gpio-cells = <0>;
gpios = <&gpio0 1 GPIO_INPUT>;
enum-name = "GPIO_LID_OPEN";
};
diff --git a/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h b/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h
index 741cbd89a2..b4c6591fbc 100644
--- a/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h
+++ b/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h
@@ -11,25 +11,4 @@
#define GPIO_KBD_KSO2 GPIO_UNIMPLEMENTED
-/*
- * Set EC_CROS_GPIO_INTERRUPTS to a space-separated list of GPIO_INT items.
- *
- * Each GPIO_INT requires three parameters:
- * gpio_signal - The enum gpio_signal for the interrupt gpio
- * interrupt_flags - The interrupt-related flags (e.g. GPIO_INT_EDGE_BOTH)
- * handler - The platform/ec interrupt handler.
- *
- * Ensure that this files includes all necessary headers to declare all
- * referenced handler functions.
- *
- * For example, one could use the follow definition:
- * #define EC_CROS_GPIO_INTERRUPTS \
- * GPIO_INT(NAMED_GPIO(h1_ec_pwr_btn_odl), GPIO_INT_EDGE_BOTH, button_print)
- */
-#define EC_CROS_GPIO_INTERRUPTS \
- GPIO_INT(GPIO_AC_PRESENT, GPIO_INT_EDGE_BOTH, extpower_interrupt) \
- GPIO_INT(GPIO_LID_OPEN, GPIO_INT_EDGE_BOTH, lid_interrupt) \
- GPIO_INT(GPIO_POWER_BUTTON_L, GPIO_INT_EDGE_BOTH, \
- power_button_interrupt)
-
#endif /* __ZEPHYR_GPIO_MAP_H */
diff --git a/zephyr/projects/npcx_evb/npcx9/interrupts.dts b/zephyr/projects/npcx_evb/npcx9/interrupts.dts
new file mode 100644
index 0000000000..ee3fa90bd5
--- /dev/null
+++ b/zephyr/projects/npcx_evb/npcx9/interrupts.dts
@@ -0,0 +1,26 @@
+/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_ac_present: ac_present {
+ irq-gpio = <&gpio_ac_present>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "extpower_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-gpio = <&gpio_lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_power_button: power_button {
+ irq-gpio = <&gpio_power_button_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ };
+};