From 39d6d0db4eb5606ca1821dd8687b943c220b6ca8 Mon Sep 17 00:00:00 2001
From: Pavlo Hamov
Date: Wed, 6 Oct 2021 15:30:52 +0300
Subject: [PATCH] drivers: watchdog: esp32s2 add support
Add support of esp32s2 WDT1 & WDT2 using base esp32 driver
Use dts to determine WDT driver state
Signed-off-by: Pavlo Hamov
---
drivers/watchdog/Kconfig.esp32 | 6 ++++--
dts/xtensa/espressif/esp32s2.dtsi | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/Kconfig.esp32 b/drivers/watchdog/Kconfig.esp32
index 811b823da14..13aca00f112 100644
--- a/drivers/watchdog/Kconfig.esp32
+++ b/drivers/watchdog/Kconfig.esp32
@@ -3,9 +3,11 @@
# Copyright (C) 2017 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
+DT_COMPAT_ESP32_WDT := espressif,esp32-watchdog
+
config WDT_ESP32
bool "ESP32 Watchdog (WDT) Driver"
- depends on SOC_ESP32
- default y
+ depends on SOC_ESP32 || SOC_ESP32S2
+ default $(dt_compat_enabled,$(DT_COMPAT_ESP32_WDT))
help
Enable WDT driver for ESP32.
diff --git a/dts/xtensa/espressif/esp32s2.dtsi b/dts/xtensa/espressif/esp32s2.dtsi
index 0ed045ab3db..43756489c83 100644
--- a/dts/xtensa/espressif/esp32s2.dtsi
+++ b/dts/xtensa/espressif/esp32s2.dtsi
@@ -177,6 +177,24 @@
clocks = <&rtc ESP32_HSPI_MODULE>;
status = "disabled";
};
+
+ wdt0: watchdog@3f41f048 {
+ compatible = "espressif,esp32-watchdog";
+ reg = <0x3f41f048 0x20>;
+ interrupts = ;
+ interrupt-parent = <&intc>;
+ label = "WDT_0";
+ status = "disabled";
+ };
+
+ wdt1: watchdog@3f42f048 {
+ compatible = "espressif,esp32-watchdog";
+ reg = <0x3f42f048 0x20>;
+ interrupts = ;
+ interrupt-parent = <&intc>;
+ label = "WDT_1";
+ status = "disabled";
+ };
};
};