diff options
author | Peter Marheine <pmarheine@chromium.org> | 2021-12-01 10:38:23 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-07 02:01:02 +0000 |
commit | e508ff8f31477e09317b72d1337236c55210b2b8 (patch) | |
tree | eff8a71302f43bffb3d8d582bb9c8419ede7d1a7 | |
parent | aac51beaac76af91138c074426bdebaaa60efb60 (diff) | |
download | chrome-ec-e508ff8f31477e09317b72d1337236c55210b2b8.tar.gz |
zephyr: use a chosen device for watchdog shim
This uses a chosen cros-ec,watchdog DT node to locate the watchdog device
to shim, rather than assuming it is called twd0.
BUG=b:205615358
TEST=zmake buildall
BRANCH=none
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: Id6e2dcc8d75740797d6630134c0d4413ac7338ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3312504
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/include/cros/ite/it8xxx2.dtsi | 1 | ||||
-rw-r--r-- | zephyr/include/cros/nuvoton/npcx.dtsi | 1 | ||||
-rw-r--r-- | zephyr/shim/src/watchdog.c | 7 |
3 files changed, 4 insertions, 5 deletions
diff --git a/zephyr/include/cros/ite/it8xxx2.dtsi b/zephyr/include/cros/ite/it8xxx2.dtsi index e6915be45d..1bd3dcfbf8 100644 --- a/zephyr/include/cros/ite/it8xxx2.dtsi +++ b/zephyr/include/cros/ite/it8xxx2.dtsi @@ -10,6 +10,7 @@ cros-ec,adc = &adc0; cros-ec,espi = &espi0; cros-ec,flash = &fiu0; + cros-ec,watchdog = &twd0; }; named-bbram-regions { diff --git a/zephyr/include/cros/nuvoton/npcx.dtsi b/zephyr/include/cros/nuvoton/npcx.dtsi index a749fca9e2..d4103a2bdc 100644 --- a/zephyr/include/cros/nuvoton/npcx.dtsi +++ b/zephyr/include/cros/nuvoton/npcx.dtsi @@ -14,6 +14,7 @@ cros-ec,adc = &adc0; cros-ec,espi = &espi0; cros-ec,flash = &fiu0; + cros-ec,watchdog = &twd0; }; named-bbram-regions { diff --git a/zephyr/shim/src/watchdog.c b/zephyr/shim/src/watchdog.c index 4c78ac9b0f..bf5568c596 100644 --- a/zephyr/shim/src/watchdog.c +++ b/zephyr/shim/src/watchdog.c @@ -14,6 +14,8 @@ LOG_MODULE_REGISTER(watchdog_shim, LOG_LEVEL_ERR); +#define wdt DEVICE_DT_GET(DT_CHOSEN(cros_ec_watchdog)) + static void wdt_warning_handler(const struct device *wdt_dev, int channel_id) { /* TODO(b/176523207): watchdog warning message */ @@ -23,10 +25,8 @@ static void wdt_warning_handler(const struct device *wdt_dev, int channel_id) int watchdog_init(void) { int err; - const struct device *wdt; struct wdt_timeout_cfg wdt_config; - wdt = DEVICE_DT_GET(DT_NODELABEL(twd0)); if (!device_is_ready(wdt)) { LOG_ERR("Error: device %s is not ready", wdt->name); return -1; @@ -67,9 +67,6 @@ int watchdog_init(void) void watchdog_reload(void) { - const struct device *wdt; - - wdt = DEVICE_DT_GET(DT_NODELABEL(twd0)); if (!device_is_ready(wdt)) LOG_ERR("Error: device %s is not ready", wdt->name); |