Skip to contentSkip to conversation

watchdog: Add a driver for the sunxi watchdog

PATCH New Samuel Holland 1 participant 3 messages Aug 22, 2021

Subsystems (3)
lore
Share & tools
lore

Samuel Holland

author maintainer
#0 lore raw

PATCH 1/3 watchdog: Add a driver for the sunxi watchdog

This driver supports the sun4i/sun6i/sun20i watchdog timers. They have a maximum timeout of 16 seconds.

---

 drivers/watchdog/Kconfig     |   8 ++
 drivers/watchdog/Makefile    |   1 +
 drivers/watchdog/sunxi_wdt.c | 188 +++++++++++++++++++++++++++++++++++
 3 files changed, 197 insertions(+)
 create mode 100644 drivers/watchdog/sunxi_wdt.c
drivers/watchdog/Kconfig +8 -0
index f0ff2612a6b..59112147343 100644
@@ -27,6 +27,7 @@ config WATCHDOG_TIMEOUT_MSECS
 	default 128000 if ARCH_MX25 || ARCH_MX31 || ARCH_MX5 || ARCH_MX6
 	default 128000 if ARCH_MX7 || ARCH_VF610
 	default 30000 if ARCH_SOCFPGA
+	default 16000 if ARCH_SUNXI
 	default 60000
 	help
 	  Watchdog timeout in msec
@@ -241,6 +242,13 @@ config WDT_STM32MP
 	  Enable the STM32 watchdog (IWDG) driver. Enable support to
 	  configure STM32's on-SoC watchdog.
 
+config WDT_SUNXI
+	bool "Allwinner sunxi watchdog timer support"
+	depends on WDT && ARCH_SUNXI
+	default y
+	help
+	  Enable support for the watchdog timer in Allwinner sunxi SoCs.
+
 config XILINX_TB_WATCHDOG
 	bool "Xilinx Axi watchdog timer support"
 	depends on WDT
drivers/watchdog/Makefile +1 -0
index 5c7ef593fe5..20cf4280db0 100644
@@ -35,5 +35,6 @@ obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o
 obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o
 obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
 obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o
+obj-$(CONFIG_WDT_SUNXI) += sunxi_wdt.o
 obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o
 obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o
drivers/watchdog/sunxi_wdt.c new file +188 -0

188 lines not on this page · raw message

Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 2/3 sunxi: Enable watchdog timer support by default

A watchdog helps recover from hangs or failure to boot an OS. It can also be used by the sysreset framework to intentionally reset the system. Now that a driver is available, let's enable this functionality on sunxi boards.

---

 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
index d692139199c..35b059c3faa 100644
@@ -1036,6 +1036,7 @@ config ARCH_SUNXI
 	imply SPL_POWER
 	imply SPL_SERIAL_SUPPORT
 	imply USB_GADGET
+	imply WDT
 
 config ARCH_U8500
 	bool "ST-Ericsson U8500 Series"
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 3/3 sunxi: dts: H616: Enable the watchdog

In reply to Samuel Holland

For some reason, the watchdog was disabled in the H616 device tree. Most likely this is a copy-paste from the H6 device tree: the H6 watchdog is disabled because it is broken in some chips. However, there is no evidence of issues with the H616 watchdog.

Enable the watchdog node so it can be used by the driver.

---

 arch/arm/dts/sun50i-h616.dtsi | 1 -
 1 file changed, 1 deletion(-)
arch/arm/dts/sun50i-h616.dtsi +0 -1
index dd4d2f31111..2f71e853e96 100644
@@ -122,7 +122,6 @@
 			reg = <0x030090a0 0x20>;
 			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&osc24M>;
-			status = "disabled";
 		};
 
 		pio: pinctrl@300b000 {
Signature · 1 line
2.31.1