summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Lin <CHLin56@nuvoton.com>2022-02-08 18:44:20 +0800
committerCommit Bot <commit-bot@chromium.org>2022-02-25 17:51:21 +0000
commit813f7256a5ebeb5c949183f963b3a0e30227afb1 (patch)
tree40fa499aa9e5e03ada7e06ba97a7d50cb2e40e61
parent5603ecac80af6c29a98ab0293022ceb6da431269 (diff)
downloadchrome-ec-813f7256a5ebeb5c949183f963b3a0e30227afb1.tar.gz
zephyr: npcx: add build time check for the hibernate DT node
Nuvoton EC supports two hibernate mode: - PSL mode - non-PSL (disable RAM) mode The PSL mode uses the DT node vsby-psl-in-list to configure the PSL input wakeup pins. The non-PSL mode uses the DT node hibernate-wake-pins to configure the GPIO wakeup pins. This CL adds a build time assert to prevent a user from using the incorrect DT node for different mode. Also, add status = "okay" to the vsby-psl-in-list node because the status was disabled at default with PR:42668. BUG=b:216893756 BRANCH=none TEST=set "zmake testall --clobber" TEST=add "CONFIG_PLATFORM_EC_HIBERNATE_PSL=y" and define hibernate-wake-pins node in the prj.conf of npcx9_evb; see the build error. TEST=set "CONFIG_PLATFORM_EC_HIBERNATE_PSL=n" and define vsby-psl-in-list node in the prj.conf of npcx9_evb; see the build error. Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: I83f4c3d427ef479445d5e5b992f53056da9bf1ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3449996 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/boards/arm/brya/brya.dts1
-rw-r--r--zephyr/boards/arm/npcx_evb/npcx_evb.dtsi16
-rw-r--r--zephyr/boards/arm/volteer/volteer.dts1
-rw-r--r--zephyr/drivers/cros_system/cros_system_npcx.c10
-rw-r--r--zephyr/projects/herobrine/gpio.dts1
-rw-r--r--zephyr/projects/skyrim/gpio.dts1
6 files changed, 14 insertions, 16 deletions
diff --git a/zephyr/boards/arm/brya/brya.dts b/zephyr/boards/arm/brya/brya.dts
index 2220d983e9..db7f35cc26 100644
--- a/zephyr/boards/arm/brya/brya.dts
+++ b/zephyr/boards/arm/brya/brya.dts
@@ -170,6 +170,7 @@
vsby-psl-in-list {
/* Use PSL_IN1/2/3 as detection pins from hibernate mode */
psl-in-pads = <&psl_in1 &psl_in2 &psl_in3>;
+ status = "okay";
};
def-lvol-io-list {
diff --git a/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi b/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi
index 23f0e06345..b49be6222c 100644
--- a/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi
+++ b/zephyr/boards/arm/npcx_evb/npcx_evb.dtsi
@@ -71,11 +71,6 @@
io-channels = <&adc0 4>;
};
};
-
- vsby-psl-in-list {
- /* Use PSL_IN1/2/3 as detection pins from hibernate mode */
- psl-in-pads = <&psl_in1 &psl_in2 &psl_in3>;
- };
};
&i2c0_0 {
@@ -127,17 +122,6 @@
status = "okay";
};
-/* Power switch logic input pads */
-&psl_in1 {
- flag = <NPCX_PSL_FALLING_EDGE>;
-};
-&psl_in2 {
- flag = <NPCX_PSL_FALLING_EDGE>;
-};
-&psl_in3 {
- flag = <NPCX_PSL_RISING_EDGE>;
-};
-
&cros_kb_raw {
status = "okay";
pinctrl-0 = <&alt7_no_ksi0_sl
diff --git a/zephyr/boards/arm/volteer/volteer.dts b/zephyr/boards/arm/volteer/volteer.dts
index 227e940721..c6623f22dc 100644
--- a/zephyr/boards/arm/volteer/volteer.dts
+++ b/zephyr/boards/arm/volteer/volteer.dts
@@ -169,6 +169,7 @@
vsby-psl-in-list {
/* Use PSL_IN1/2/3/4 as detection pins from hibernate mode */
psl-in-pads = <&psl_in1 &psl_in2 &psl_in3 &psl_in4>;
+ status = "okay";
};
/*
diff --git a/zephyr/drivers/cros_system/cros_system_npcx.c b/zephyr/drivers/cros_system/cros_system_npcx.c
index 472f32ab33..b000eeec4d 100644
--- a/zephyr/drivers/cros_system/cros_system_npcx.c
+++ b/zephyr/drivers/cros_system/cros_system_npcx.c
@@ -502,6 +502,16 @@ static int cros_system_npcx_soc_reset(const struct device *dev)
return 0;
}
+#if defined(CONFIG_PLATFORM_EC_HIBERNATE_PSL)
+#if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_hibernate_wake_pins)
+#error "cros-ec,hibernate-wake-pins cannot be used with HIBERNATE_PSL"
+#endif
+#else
+#if DT_HAS_COMPAT_STATUS_OKAY(nuvoton_npcx_pslctrl_def)
+#error "vsby-psl-in-list cannot be used with non-HIBERNATE_PSL"
+#endif
+#endif
+
static int cros_system_npcx_hibernate(const struct device *dev,
uint32_t seconds, uint32_t microseconds)
{
diff --git a/zephyr/projects/herobrine/gpio.dts b/zephyr/projects/herobrine/gpio.dts
index 796610aa26..59211b75d3 100644
--- a/zephyr/projects/herobrine/gpio.dts
+++ b/zephyr/projects/herobrine/gpio.dts
@@ -243,6 +243,7 @@
vsby-psl-in-list {
/* Use PSL_IN1/2/3/4 as detection pins from hibernate mode */
psl-in-pads = <&psl_in1 &psl_in2 &psl_in3 &psl_in4>;
+ status = "okay";
};
sku {
diff --git a/zephyr/projects/skyrim/gpio.dts b/zephyr/projects/skyrim/gpio.dts
index 9aca859395..63dc8510fc 100644
--- a/zephyr/projects/skyrim/gpio.dts
+++ b/zephyr/projects/skyrim/gpio.dts
@@ -188,6 +188,7 @@
vsby-psl-in-list {
/* PSL_IN1/2/4 are used to wake */
psl-in-pads = <&psl_in1 &psl_in2 &psl_in4>;
+ status = "okay";
};
named-ioexes {