devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: r9a06g032: add support for the watchdogs
@ 2022-02-04 16:17 Jean-Jacques Hiblot
  2022-02-04 16:18 ` [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock Jean-Jacques Hiblot
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-04 16:17 UTC (permalink / raw)
  To: geert+renesas, Wim Van Sebroeck, Guenter Roeck, Magnus Damm,
	Rob Herring, Wolfram Sang
  Cc: Jean-Jacques Hiblot, linux-watchdog, devicetree, linux-kernel,
	linux-renesas-soc, linux-clk

Hi all,

This series adds support for the watchdog timers of the RZ/N1.
The watchdog driver (rzn1-wdt.c) is derived from the driver available at
https://github.com/renesas-rz/rzn1_linux.git with a few modifications
(devm watchdog API usage and WDIOF_MAGICCLOSE option)

In order to be able to reset the board when a watchdog timer expires,
the RSTEN register must be configured. This is done in the clock
driver of the r9a06g032. The rationnal is that this driver is the only one
that handles the sysctrl for this platform and there are a couple of other
clock drivers that also handle resets/reboot. I intend to later post
another patch to add software-triggered reboot capability that will
leverage this change.


Jean-Jacques Hiblot (5):
  clk: renesas: r9a06g032: Enable the watchdog reset sources
  dt-bindings: clock: r9a06g032: Add the definition of the watchdog
    clock
  dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1
  ARM: dts: r9a06g032: Add the watchdog nodes
  ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout

Phil Edworthy (1):
  watchdog: Add Renesas RZ/N1 Watchdog driver

 .../bindings/watchdog/renesas,wdt.yaml        |   4 +
 arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts   |   5 +
 arch/arm/boot/dts/r9a06g032.dtsi              |  16 ++
 drivers/clk/renesas/r9a06g032-clocks.c        |  33 +++
 drivers/watchdog/Kconfig                      |   8 +
 drivers/watchdog/Makefile                     |   1 +
 drivers/watchdog/rzn1_wdt.c                   | 197 ++++++++++++++++++
 include/dt-bindings/clock/r9a06g032-sysctrl.h |   1 +
 8 files changed, 265 insertions(+)
 create mode 100644 drivers/watchdog/rzn1_wdt.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock
  2022-02-04 16:17 [PATCH 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
@ 2022-02-04 16:18 ` Jean-Jacques Hiblot
  2022-02-07 16:07   ` Geert Uytterhoeven
  2022-02-11 14:50   ` Rob Herring
  2022-02-04 16:18 ` [PATCH 3/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-04 16:18 UTC (permalink / raw)
  To: geert+renesas, linux-kernel; +Cc: Jean-Jacques Hiblot, Rob Herring, devicetree

This clock is actually the REF_SYNC_D8 clock.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 include/dt-bindings/clock/r9a06g032-sysctrl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/r9a06g032-sysctrl.h b/include/dt-bindings/clock/r9a06g032-sysctrl.h
index 90c0f3dc1ba1..d9d7b8b4f426 100644
--- a/include/dt-bindings/clock/r9a06g032-sysctrl.h
+++ b/include/dt-bindings/clock/r9a06g032-sysctrl.h
@@ -74,6 +74,7 @@
 #define R9A06G032_CLK_DDRPHY_PCLK	81	/* AKA CLK_REF_SYNC_D4 */
 #define R9A06G032_CLK_FW		81	/* AKA CLK_REF_SYNC_D4 */
 #define R9A06G032_CLK_CRYPTO		81	/* AKA CLK_REF_SYNC_D4 */
+#define R9A06G032_CLK_WATCHDOG		82	/* AKA CLK_REF_SYNC_D8 */
 #define R9A06G032_CLK_A7MP		84	/* AKA DIV_CA7 */
 #define R9A06G032_HCLK_CAN0		85
 #define R9A06G032_HCLK_CAN1		86
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1
  2022-02-04 16:17 [PATCH 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
  2022-02-04 16:18 ` [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock Jean-Jacques Hiblot
@ 2022-02-04 16:18 ` Jean-Jacques Hiblot
  2022-02-07 16:09   ` Geert Uytterhoeven
  2022-02-04 16:18 ` [PATCH 4/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
  2022-02-04 16:18 ` [PATCH 5/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout Jean-Jacques Hiblot
  3 siblings, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-04 16:18 UTC (permalink / raw)
  To: geert+renesas, Wim Van Sebroeck, Guenter Roeck, Wolfram Sang
  Cc: Jean-Jacques Hiblot, Rob Herring, linux-watchdog, devicetree,
	linux-kernel

Describe the WDT hardware in the RZ/N1 series.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml b/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
index 91a98ccd4226..11e1c9f101a7 100644
--- a/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
@@ -19,6 +19,9 @@ properties:
               - renesas,r7s9210-wdt      # RZ/A2
           - const: renesas,rza-wdt       # RZ/A
 
+      - items:
+          - const: renesas,rzn1-wdt # RZ/N1
+
       - items:
           - enum:
               - renesas,r9a07g044-wdt    # RZ/G2{L,LC}
@@ -89,6 +92,7 @@ allOf:
             contains:
               enum:
                 - renesas,rza-wdt
+                - renesas,rzn1-wdt
     then:
       required:
         - power-domains
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/6] ARM: dts: r9a06g032: Add the watchdog nodes
  2022-02-04 16:17 [PATCH 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
  2022-02-04 16:18 ` [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock Jean-Jacques Hiblot
  2022-02-04 16:18 ` [PATCH 3/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
@ 2022-02-04 16:18 ` Jean-Jacques Hiblot
  2022-02-07 16:12   ` Geert Uytterhoeven
  2022-02-04 16:18 ` [PATCH 5/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout Jean-Jacques Hiblot
  3 siblings, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-04 16:18 UTC (permalink / raw)
  To: geert+renesas, Magnus Damm, Rob Herring
  Cc: Jean-Jacques Hiblot, linux-renesas-soc, devicetree, linux-kernel

This SOC includes 2 watchdog controllers (one per A7 core).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 arch/arm/boot/dts/r9a06g032.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/r9a06g032.dtsi b/arch/arm/boot/dts/r9a06g032.dtsi
index c47896e4ab58..54c91b46a5d0 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -184,6 +184,22 @@ gic: interrupt-controller@44101000 {
 			interrupts =
 				<GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
 		};
+
+		wdt0: watchdog@40008000 {
+			compatible = "renesas,rzn1-wdt";
+			reg = <0x40008000 0x1000>;
+			interrupts = <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
+			status = "disabled";
+		};
+
+		wdt1: watchdog@40009000 {
+			compatible = "renesas,rzn1-wdt";
+			reg = <0x40009000 0x1000>;
+			interrupts = <GIC_SPI 74 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
+			status = "disabled";
+		};
 	};
 
 	timer {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout
  2022-02-04 16:17 [PATCH 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
                   ` (2 preceding siblings ...)
  2022-02-04 16:18 ` [PATCH 4/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
@ 2022-02-04 16:18 ` Jean-Jacques Hiblot
  2022-02-07 16:15   ` Geert Uytterhoeven
  3 siblings, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-04 16:18 UTC (permalink / raw)
  To: geert+renesas, Magnus Damm, Rob Herring
  Cc: Jean-Jacques Hiblot, linux-renesas-soc, devicetree, linux-kernel

10s seems a reasonable value for a watchdog.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts b/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
index 4e57ae2688fc..5c8f46b20acc 100644
--- a/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
+++ b/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
@@ -23,6 +23,11 @@ aliases {
 	};
 };
 
+&wdt0 {
+	timeout-sec = <10>;
+	status = "okay";
+};
+
 &uart0 {
 	status = "okay";
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock
  2022-02-04 16:18 ` [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock Jean-Jacques Hiblot
@ 2022-02-07 16:07   ` Geert Uytterhoeven
  2022-02-11 14:50   ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-07 16:07 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Geert Uytterhoeven, Linux Kernel Mailing List, Rob Herring,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Jean-Jacques,

On Fri, Feb 4, 2022 at 5:18 PM Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> This clock is actually the REF_SYNC_D8 clock.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>

Thanks for your patch!

> --- a/include/dt-bindings/clock/r9a06g032-sysctrl.h
> +++ b/include/dt-bindings/clock/r9a06g032-sysctrl.h
> @@ -74,6 +74,7 @@
>  #define R9A06G032_CLK_DDRPHY_PCLK      81      /* AKA CLK_REF_SYNC_D4 */
>  #define R9A06G032_CLK_FW               81      /* AKA CLK_REF_SYNC_D4 */
>  #define R9A06G032_CLK_CRYPTO           81      /* AKA CLK_REF_SYNC_D4 */
> +#define R9A06G032_CLK_WATCHDOG         82      /* AKA CLK_REF_SYNC_D8 */
>  #define R9A06G032_CLK_A7MP             84      /* AKA DIV_CA7 */
>  #define R9A06G032_HCLK_CAN0            85
>  #define R9A06G032_HCLK_CAN1            86

I couldn't find this in the documentation, so I have to trust you on this.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1
  2022-02-04 16:18 ` [PATCH 3/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
@ 2022-02-07 16:09   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-07 16:09 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Wim Van Sebroeck, Guenter Roeck, Wolfram Sang, Rob Herring,
	Linux Watchdog Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

Hi Jean-Jacques,

On Fri, Feb 4, 2022 at 5:18 PM Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> Describe the WDT hardware in the RZ/N1 series.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
> @@ -19,6 +19,9 @@ properties:
>                - renesas,r7s9210-wdt      # RZ/A2
>            - const: renesas,rza-wdt       # RZ/A
>
> +      - items:
> +          - const: renesas,rzn1-wdt # RZ/N1

I think it would be good to have an SoC-specific compatible value
("renesas,r9a06g032-wdt") in addition to the family-specific one.

> +
>        - items:
>            - enum:
>                - renesas,r9a07g044-wdt    # RZ/G2{L,LC}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/6] ARM: dts: r9a06g032: Add the watchdog nodes
  2022-02-04 16:18 ` [PATCH 4/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
@ 2022-02-07 16:12   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-07 16:12 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Magnus Damm, Rob Herring, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

Hi Jean-Jacques,

On Fri, Feb 4, 2022 at 5:18 PM Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> This SOC includes 2 watchdog controllers (one per A7 core).
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>

Thanks for your patch!

> --- a/arch/arm/boot/dts/r9a06g032.dtsi
> +++ b/arch/arm/boot/dts/r9a06g032.dtsi
> @@ -184,6 +184,22 @@ gic: interrupt-controller@44101000 {
>                         interrupts =
>                                 <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
>                 };
> +
> +               wdt0: watchdog@40008000 {

Please insert these nodes before the system-controller@4000c000
node, to preserve sort order (by unit address).

> +                       compatible = "renesas,rzn1-wdt";

"renesas,r9a06g032-wdt", "renesas,rzn1-wdt"
as per my comments on the DT bindings patch.

> +                       reg = <0x40008000 0x1000>;
> +                       interrupts = <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>;
> +                       clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
> +                       status = "disabled";
> +               };
> +
> +               wdt1: watchdog@40009000 {
> +                       compatible = "renesas,rzn1-wdt";
> +                       reg = <0x40009000 0x1000>;
> +                       interrupts = <GIC_SPI 74 IRQ_TYPE_EDGE_RISING>;
> +                       clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
> +                       status = "disabled";
> +               };
>         };
>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout
  2022-02-04 16:18 ` [PATCH 5/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout Jean-Jacques Hiblot
@ 2022-02-07 16:15   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-07 16:15 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Magnus Damm, Rob Herring, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

Hi Jean-Jacques,

Thanks for your patch!

On Fri, Feb 4, 2022 at 5:18 PM Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> 10s seems a reasonable value for a watchdog.

All other Renesas DTS files use 60s. Would 60s be OK for you?

> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>

> --- a/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
> +++ b/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
> @@ -23,6 +23,11 @@ aliases {
>         };
>  };
>
> +&wdt0 {

Please insert below "uart0", to preserve sort order (alphabetically).

> +       timeout-sec = <10>;
> +       status = "okay";
> +};
> +
>  &uart0 {
>         status = "okay";
>  };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock
  2022-02-04 16:18 ` [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock Jean-Jacques Hiblot
  2022-02-07 16:07   ` Geert Uytterhoeven
@ 2022-02-11 14:50   ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-02-11 14:50 UTC (permalink / raw)
  To: Jean-Jacques Hiblot; +Cc: devicetree, linux-kernel, Rob Herring, geert+renesas

On Fri, 04 Feb 2022 17:18:00 +0100, Jean-Jacques Hiblot wrote:
> This clock is actually the REF_SYNC_D8 clock.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> ---
>  include/dt-bindings/clock/r9a06g032-sysctrl.h | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-02-11 14:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-04 16:17 [PATCH 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
2022-02-04 16:18 ` [PATCH 2/6] dt-bindings: clock: r9a06g032: Add the definition of the watchdog clock Jean-Jacques Hiblot
2022-02-07 16:07   ` Geert Uytterhoeven
2022-02-11 14:50   ` Rob Herring
2022-02-04 16:18 ` [PATCH 3/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
2022-02-07 16:09   ` Geert Uytterhoeven
2022-02-04 16:18 ` [PATCH 4/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
2022-02-07 16:12   ` Geert Uytterhoeven
2022-02-04 16:18 ` [PATCH 5/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 10s timeout Jean-Jacques Hiblot
2022-02-07 16:15   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).