[PATCH 4/5] realtek: Add watchdog node

Sander Vanheule sander at svanheule.net
Thu Nov 4 07:55:43 PDT 2021


Add and enable the Realtek Otto WDT peripheral found on these SoCs.

Devices that require the PLL value fixup before restarting, should pick
the "cpu" or "software" reset mode. These devices also need to provide a
custom reboot mode, by adding the reboot argument to the kernel command
line:

    WDT reset mode  | kernel reboot mode
    ----------------+---------------------------------------
    soc             | reboot=cold (default if not specified)
    cpu             | reboot=warm
    software        | reboot=software

Since RTL838x can only perform cold reboots reliably on selected
devices, default this platform to use reboot=warm and "cpu" reset.
RTL930x devices have more reliable reset logic, and can use the default
(cold) reboot and "soc" resets.

Note that watchdog restarts are not yet exposed, since the
_machine_restart override is still present.

Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
 target/linux/realtek/dts-5.10/rtl838x.dtsi | 16 +++++++++++++++-
 target/linux/realtek/dts-5.10/rtl930x.dtsi | 14 ++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/target/linux/realtek/dts-5.10/rtl838x.dtsi b/target/linux/realtek/dts-5.10/rtl838x.dtsi
index 9aa646ed968e..9149a098666e 100644
--- a/target/linux/realtek/dts-5.10/rtl838x.dtsi
+++ b/target/linux/realtek/dts-5.10/rtl838x.dtsi
@@ -65,7 +65,7 @@
 	};
 
 	chosen {
-		bootargs = "console=ttyS0,115200";
+		bootargs = "console=ttyS0,115200 reboot=warm";
 	};
 
 	lx_clk: lx_clk {
@@ -153,6 +153,20 @@
 			status = "disabled";
 		};
 
+		watchdog: watchdog at 3150 {
+			compatible = "realtek,rtl8380-wdt";
+			reg = <0x3150 0xc>;
+
+			realtek,reset-mode = "cpu";
+
+			clocks = <&lx_clk>;
+			timeout-sec = <30>;
+
+			interrupt-parent = <&intc>;
+			interrupt-names = "phase1", "phase2";
+			interrupts = <19>, <18>;
+		};
+
 		gpio0: gpio-controller at 3500 {
 			compatible = "realtek,rtl8380-gpio", "realtek,otto-gpio";
 			reg = <0x3500 0x20>;
diff --git a/target/linux/realtek/dts-5.10/rtl930x.dtsi b/target/linux/realtek/dts-5.10/rtl930x.dtsi
index e53f506a956f..a9b483c57338 100644
--- a/target/linux/realtek/dts-5.10/rtl930x.dtsi
+++ b/target/linux/realtek/dts-5.10/rtl930x.dtsi
@@ -162,6 +162,20 @@
 			status = "disabled";
 		};
 
+		watchdog0: watchdog at 3260 {
+			compatible = "realtek,rtl9300-wdt";
+			reg = <0x3260 0xc>;
+
+			realtek,reset-mode = "soc";
+
+			clock = <&osc 0>;
+			timeout-sec = <30>;
+
+			interrupt-parent = <&intc>;
+			interrupt-names = "phase1", "phase2";
+			interrupts = <5>, <6>;
+		};
+
 		gpio0: gpio-controller at 3500 {
 			compatible = "realtek,rtl8380-gpio", "realtek,otto-gpio";
 			reg = <0x3500 0x20>;
-- 
2.31.1




More information about the openwrt-devel mailing list