Skip to contentSkip to conversation

arm64: renesas: Add R-Car S4-8 watchdog support on Spider

PATCH In review Geert Uytterhoeven 4 participants 17 messages Jan 18, 2022 – Feb 14, 2022

Subsystems (5)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover arm64: renesas: Add R-Car S4-8 watchdog support on Spider

Hi all,

This patch series adds support for the RCLK Watchdog Timer (RWDT) in the R-Car S4-8 SoC, and enables it on the Renesas Spider development board.

Patch 1 is to be queued in renesas-clk for v5.18. Patches 2 and 3 are intended for the watchdog tree. Patches 4 and 5 are to be queued in renesas-devel for v5.18.

Thanks for your comments!

Geert Uytterhoeven (3):
clk: renesas: r8a779f0: Add WDT clock
arm64: dts: renesas: r8a779f0: Add RWDT node
arm64: dts: renesas: spider-cpu: Enable watchdog timer

Thanh Quan (2):
dt-bindings: watchdog: renesas-wdt: Document r8a779f0 support
watchdog: renesas_wdt: Add R-Car Gen4 support

 .../devicetree/bindings/watchdog/renesas,wdt.yaml      |  5 +++++
 arch/arm64/boot/dts/renesas/r8a779f0-spider-cpu.dtsi   |  5 +++++
 arch/arm64/boot/dts/renesas/r8a779f0.dtsi              | 10 ++++++++++
 drivers/clk/renesas/r8a779f0-cpg-mssr.c                |  9 +++++++++
 drivers/watchdog/renesas_wdt.c                         |  1 +
 5 files changed, 30 insertions(+)
Signature · 12 lines
2.25.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH 1/5 clk: renesas: r8a779f0: Add WDT clock

Add the module clock used by the RCLK Watchdog Timer (RWDT) on the Renesas R-Car S4-8 (r8a779f0) SoC. Mark it as a critical clock, to ensure uninterrupted watchdog operation.

---
 drivers/clk/renesas/r8a779f0-cpg-mssr.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +9 -0
index 4100078406d67073..e48c5af7341454a7 100644
@@ -121,6 +121,11 @@ static const struct mssr_mod_clk r8a779f0_mod_clks[] __initconst = {
 	DEF_MOD("scif4",	705,	R8A779F0_CLK_S0D12_PER),
 	DEF_MOD("sys-dmac0",	709,	R8A779F0_CLK_S0D3_PER),
 	DEF_MOD("sys-dmac1",	710,	R8A779F0_CLK_S0D3_PER),
+	DEF_MOD("wdt",		907,	R8A779F0_CLK_R),
+};
+
+static const unsigned int r8a779f0_crit_mod_clks[] __initconst = {
+	MOD_CLK_ID(907),	/* WDT */
 };
 
 /*
@@ -177,6 +182,10 @@ const struct cpg_mssr_info r8a779f0_cpg_mssr_info __initconst = {
 	.num_mod_clks = ARRAY_SIZE(r8a779f0_mod_clks),
 	.num_hw_mod_clks = 28 * 32,
 
+	/* Critical Module Clocks */
+	.crit_mod_clks = r8a779f0_crit_mod_clks,
+	.num_crit_mod_clks = ARRAY_SIZE(r8a779f0_crit_mod_clks),
+
 	/* Callbacks */
 	.init = r8a779f0_cpg_mssr_init,
 	.cpg_clk_register = rcar_gen4_cpg_clk_register,
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/5
#3 lore raw

Re: [PATCH 1/5] clk: renesas: r8a779f0: Add WDT clock

In reply to Geert Uytterhoeven
Quoted 6 lines · Geert Uytterhoeven

Add the module clock used by the RCLK Watchdog Timer (RWDT) on the Renesas R-Car S4-8 (r8a779f0) SoC. Mark it as a critical clock, to ensure uninterrupted watchdog operation.

Quoted 31 lines
---
 drivers/clk/renesas/r8a779f0-cpg-mssr.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +9 -0
index 4100078406d67073..e48c5af7341454a7 100644
@@ -121,6 +121,11 @@ static const struct mssr_mod_clk r8a779f0_mod_clks[] __initconst = {
 	DEF_MOD("scif4",	705,	R8A779F0_CLK_S0D12_PER),
 	DEF_MOD("sys-dmac0",	709,	R8A779F0_CLK_S0D3_PER),
 	DEF_MOD("sys-dmac1",	710,	R8A779F0_CLK_S0D3_PER),
+	DEF_MOD("wdt",		907,	R8A779F0_CLK_R),
+};
+
+static const unsigned int r8a779f0_crit_mod_clks[] __initconst = {
+	MOD_CLK_ID(907),	/* WDT */
 };
 
 /*
@@ -177,6 +182,10 @@ const struct cpg_mssr_info r8a779f0_cpg_mssr_info __initconst = {
 	.num_mod_clks = ARRAY_SIZE(r8a779f0_mod_clks),
 	.num_hw_mod_clks = 28 * 32,
 
+	/* Critical Module Clocks */
+	.crit_mod_clks = r8a779f0_crit_mod_clks,
+	.num_crit_mod_clks = ARRAY_SIZE(r8a779f0_crit_mod_clks),
+
 	/* Callbacks */
 	.init = r8a779f0_cpg_mssr_init,
 	.cpg_clk_register = rcar_gen4_cpg_clk_register,
author maintainer
#4 lore raw

PATCH 2/5 dt-bindings: watchdog: renesas-wdt: Document r8a779f0 support

In reply to Geert Uytterhoeven

From: Thanh Quan <[email protected]>

Document support for the Watchdog Timer (WDT) Controller in the Renesas R-Car S4-8 (R8A779F0) SoC.

---
 Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml +5 -0
index 91a98ccd4226f505..d060438e1402d502 100644
@@ -55,6 +55,11 @@ properties:
               - renesas,r8a779a0-wdt     # R-Car V3U
           - const: renesas,rcar-gen3-wdt # R-Car Gen3 and RZ/G2
 
+      - items:
+          - enum:
+              - renesas,r8a779f0-wdt     # R-Car S4-8
+          - const: renesas,rcar-gen4-wdt # R-Car Gen4
+
   reg:
     maxItems: 1
 
Signature · 1 line
2.25.1
maintainer Acked-by on v1 2/5
#6 lore raw

Re: [PATCH 2/5] dt-bindings: watchdog: renesas-wdt: Document r8a779f0 support

In reply to Geert Uytterhoeven
Quoted 11 lines · Geert Uytterhoeven

From: Thanh Quan <[email protected]>

Document support for the Watchdog Timer (WDT) Controller in the Renesas R-Car S4-8 (R8A779F0) SoC.

---
 Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml | 5 +++++
 1 file changed, 5 insertions(+)
maintainer Reviewed-by on v1 2/5
#7 lore raw

Re: [PATCH 2/5] dt-bindings: watchdog: renesas-wdt: Document r8a779f0 support

In reply to Geert Uytterhoeven
Quoted 9 lines · Geert Uytterhoeven

From: Thanh Quan <[email protected]>

Document support for the Watchdog Timer (WDT) Controller in the Renesas R-Car S4-8 (R8A779F0) SoC.

Quoted 20 lines
---
 Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml +5 -0
index 91a98ccd4226f505..d060438e1402d502 100644
@@ -55,6 +55,11 @@ properties:
               - renesas,r8a779a0-wdt     # R-Car V3U
           - const: renesas,rcar-gen3-wdt # R-Car Gen3 and RZ/G2
 
+      - items:
+          - enum:
+              - renesas,r8a779f0-wdt     # R-Car S4-8
+          - const: renesas,rcar-gen4-wdt # R-Car Gen4
+
   reg:
     maxItems: 1
 
author maintainer
#8 lore raw

PATCH 3/5 watchdog: renesas_wdt: Add R-Car Gen4 support

In reply to Geert Uytterhoeven

From: Thanh Quan <[email protected]>

Add the compatible string for the R-Car Gen4 family. No further driver changes are needed.

---
 drivers/watchdog/renesas_wdt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/renesas_wdt.c +1 -0
index 5791198960e6c5bf..41d58ea5eb2f40fd 100644
@@ -327,6 +327,7 @@ static SIMPLE_DEV_PM_OPS(rwdt_pm_ops, rwdt_suspend, rwdt_resume);
 static const struct of_device_id rwdt_ids[] = {
 	{ .compatible = "renesas,rcar-gen2-wdt", },
 	{ .compatible = "renesas,rcar-gen3-wdt", },
+	{ .compatible = "renesas,rcar-gen4-wdt", },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rwdt_ids);
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 3/5
#10 lore raw

Re: [PATCH 3/5] watchdog: renesas_wdt: Add R-Car Gen4 support

In reply to Geert Uytterhoeven
Quoted 8 lines · Geert Uytterhoeven

From: Thanh Quan <[email protected]>

Add the compatible string for the R-Car Gen4 family. No further driver changes are needed.

Quoted 16 lines
---
 drivers/watchdog/renesas_wdt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/watchdog/renesas_wdt.c +1 -0
index 5791198960e6c5bf..41d58ea5eb2f40fd 100644
@@ -327,6 +327,7 @@ static SIMPLE_DEV_PM_OPS(rwdt_pm_ops, rwdt_suspend, rwdt_resume);
 static const struct of_device_id rwdt_ids[] = {
 	{ .compatible = "renesas,rcar-gen2-wdt", },
 	{ .compatible = "renesas,rcar-gen3-wdt", },
+	{ .compatible = "renesas,rcar-gen4-wdt", },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rwdt_ids);
author maintainer
#11 lore raw

PATCH 4/5 arm64: dts: renesas: r8a779f0: Add RWDT node

In reply to Geert Uytterhoeven

Add a device node for the RCLK Watchdog Timer (RWDT) on the Renesas R-Car S4-8 (R8A779F0) SoC.

Extracted from a larger patch in the BSP by LUU HOAI.

---
 arch/arm64/boot/dts/renesas/r8a779f0.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/renesas/r8a779f0.dtsi +10 -0
index 5426532d10e2a472..0ac8c345558efc17 100644
@@ -59,6 +59,16 @@ soc: soc {
 		#size-cells = <2>;
 		ranges;
 
+		rwdt: watchdog@e6020000 {
+			compatible = "renesas,r8a779f0-wdt",
+				     "renesas,rcar-gen4-wdt";
+			reg = <0 0xe6020000 0 0x0c>;
+			clocks = <&cpg CPG_MOD 907>;
+			power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>;
+			resets = <&cpg 907>;
+			status = "disabled";
+		};
+
 		cpg: clock-controller@e6150000 {
 			compatible = "renesas,r8a779f0-cpg-mssr";
 			reg = <0 0xe6150000 0 0x4000>;
Signature · 1 line
2.25.1
maintainer Acked-by on v1 4/5
#13 lore raw

Re: [PATCH 4/5] arm64: dts: renesas: r8a779f0: Add RWDT node

In reply to Geert Uytterhoeven
Quoted 7 lines · Geert Uytterhoeven

Add a device node for the RCLK Watchdog Timer (RWDT) on the Renesas R-Car S4-8 (R8A779F0) SoC.

Extracted from a larger patch in the BSP by LUU HOAI.

Quoted 25 lines
---
 arch/arm64/boot/dts/renesas/r8a779f0.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/renesas/r8a779f0.dtsi +10 -0
index 5426532d10e2a472..0ac8c345558efc17 100644
@@ -59,6 +59,16 @@ soc: soc {
 		#size-cells = <2>;
 		ranges;
 
+		rwdt: watchdog@e6020000 {
+			compatible = "renesas,r8a779f0-wdt",
+				     "renesas,rcar-gen4-wdt";
+			reg = <0 0xe6020000 0 0x0c>;
+			clocks = <&cpg CPG_MOD 907>;
+			power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>;
+			resets = <&cpg 907>;
+			status = "disabled";
+		};
+
 		cpg: clock-controller@e6150000 {
 			compatible = "renesas,r8a779f0-cpg-mssr";
 			reg = <0 0xe6150000 0 0x4000>;
author maintainer
#14 lore raw

PATCH 5/5 arm64: dts: renesas: spider-cpu: Enable watchdog timer

In reply to Geert Uytterhoeven

Enable the watchdog timer on the Spider board.

Extracted from a larger patch in the BSP by LUU HOAI.

---
For the watchdog to be able to actually reboot the system, this depends on proper configuration of the Watchdog Timer Reset Control Register (WDTRSTCR) in the Reset (RST) module, either by Linux[1], or by the firmware.

[1] "[PATCH LOCAL v2] soc: renesas: rcar-rst: Allow WDT reset on R-Car

     Gen4"
    https://lore.kernel.org/r/39005cf749a99afc6d3ba96ff155fd2a231418a8.1642524743.git.geert+renesas@glider.be
---
 arch/arm64/boot/dts/renesas/r8a779f0-spider-cpu.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/renesas/r8a779f0-spider-cpu.dtsi +5 -0
index 156586532c844c41..3a90932fe85c8243 100644
@@ -31,6 +31,11 @@ &extalr_clk {
 	clock-frequency = <32768>;
 };
 
+&rwdt {
+	timeout-sec = <60>;
+	status = "okay";
+};
+
 &scif3 {
 	status = "okay";
 };
Signature · 1 line
2.25.1
maintainer Acked-by on v1 5/5
#16 lore raw

Re: [PATCH 5/5] arm64: dts: renesas: spider-cpu: Enable watchdog timer

In reply to Geert Uytterhoeven
Quoted 6 lines · Geert Uytterhoeven

Enable the watchdog timer on the Spider board.

Extracted from a larger patch in the BSP by LUU HOAI.

Quoted 29 lines

---
For the watchdog to be able to actually reboot the system, this depends on proper configuration of the Watchdog Timer Reset Control Register (WDTRSTCR) in the Reset (RST) module, either by Linux[1], or by the firmware.

[1] "[PATCH LOCAL v2] soc: renesas: rcar-rst: Allow WDT reset on R-Car

     Gen4"
    https://lore.kernel.org/r/39005cf749a99afc6d3ba96ff155fd2a231418a8.1642524743.git.geert+renesas@glider.be
---
 arch/arm64/boot/dts/renesas/r8a779f0-spider-cpu.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/renesas/r8a779f0-spider-cpu.dtsi +5 -0
index 156586532c844c41..3a90932fe85c8243 100644
@@ -31,6 +31,11 @@ &extalr_clk {
 	clock-frequency = <32768>;
 };
 
+&rwdt {
+	timeout-sec = <60>;
+	status = "okay";
+};
+
 &scif3 {
 	status = "okay";
 };