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

In order to be able to reset the board when a watchdog timer expires,
the RSTEN register must be configured. it is the responsability of the
bootloader to set those bits (or not, depending on the chosen policy).

If the watchdog reset source is not enabled, an interrupt is triggered
when the watchdog expires. Currently this interrupt doesn't much apart
from printing a message.

Changes v1 -> v2:
* Modified the clock driver to not enable the watchdog reset sources.
  On other renesas platforms, those bits are by the bootloader. The
  watchdog reset sources are still disabled when the platform is halted
  to prevent a watchdog reset.
* Added a SOC-specific compatible "renesas,r9a06g032-wdt"
* reordered the dts/i entries
* default timeout is 60 seconds
* reworked the probe function of the wdt driver to better error cases
* removed the set_timeout() and use a fixed period computed in probe().
  This removes the confusion and makes it clear that the period defined
  by the user space in indeed handled by the watchdog core

Jean-Jacques Hiblot (5):
  dt-bindings: clock: r9a06g032: Add the definition of the 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 60s timeout
  clk: renesas: r9a06g032: Disable the watchdog reset sources when
    halting

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

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

-- 
2.25.1


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

* [PATCH v2 1/6] dt-bindings: clock: r9a06g032: Add the definition of the the watchdog clock
  2022-02-08 18:35 [PATCH v2 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
@ 2022-02-08 18:35 ` Jean-Jacques Hiblot
  2022-02-11 16:45   ` Rob Herring
  2022-02-08 18:35 ` [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-08 18:35 UTC (permalink / raw)
  To: linux-renesas-soc, 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 v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1
  2022-02-08 18:35 [PATCH v2 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
  2022-02-08 18:35 ` [PATCH v2 1/6] dt-bindings: clock: r9a06g032: Add the definition of the the watchdog clock Jean-Jacques Hiblot
@ 2022-02-08 18:35 ` Jean-Jacques Hiblot
  2022-02-09  8:32   ` Geert Uytterhoeven
  2022-02-11 16:45   ` Rob Herring
  2022-02-08 18:35 ` [PATCH v2 3/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
  2022-02-08 18:35 ` [PATCH v2 4/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 60s timeout Jean-Jacques Hiblot
  3 siblings, 2 replies; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-08 18:35 UTC (permalink / raw)
  To: linux-renesas-soc, 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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml b/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
index 91a98ccd4226..b453af2dee3b 100644
--- a/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml
@@ -19,6 +19,11 @@ properties:
               - renesas,r7s9210-wdt      # RZ/A2
           - const: renesas,rza-wdt       # RZ/A
 
+      - items:
+          - enum:
+              - renesas,r9a06g032-wdt    # RZ/N1D
+          - const: renesas,rzn1-wdt      # RZ/N1
+
       - items:
           - enum:
               - renesas,r9a07g044-wdt    # RZ/G2{L,LC}
@@ -89,6 +94,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 v2 3/6] ARM: dts: r9a06g032: Add the watchdog nodes
  2022-02-08 18:35 [PATCH v2 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
  2022-02-08 18:35 ` [PATCH v2 1/6] dt-bindings: clock: r9a06g032: Add the definition of the the watchdog clock Jean-Jacques Hiblot
  2022-02-08 18:35 ` [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
@ 2022-02-08 18:35 ` Jean-Jacques Hiblot
  2022-02-09  8:33   ` Geert Uytterhoeven
  2022-02-08 18:35 ` [PATCH v2 4/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 60s timeout Jean-Jacques Hiblot
  3 siblings, 1 reply; 10+ messages in thread
From: Jean-Jacques Hiblot @ 2022-02-08 18:35 UTC (permalink / raw)
  To: linux-renesas-soc, geert+renesas, Magnus Damm, Rob Herring
  Cc: Jean-Jacques Hiblot, 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..c5659db1581b 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -66,6 +66,22 @@ soc {
 		interrupt-parent = <&gic>;
 		ranges;
 
+		wdt0: watchdog@40008000 {
+			compatible = "renesas,r9a06g032-wdt";
+			reg = <0x40008000 0x1000>;
+			interrupts = <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
+			status = "disabled";
+		};
+
+		wdt1: watchdog@40009000 {
+			compatible = "renesas,r9a06g032-wdt";
+			reg = <0x40009000 0x1000>;
+			interrupts = <GIC_SPI 74 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
+			status = "disabled";
+		};
+
 		sysctrl: system-controller@4000c000 {
 			compatible = "renesas,r9a06g032-sysctrl";
 			reg = <0x4000c000 0x1000>;
-- 
2.25.1


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

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

60s is a sensible default value.

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..3f8f3ce87e12 100644
--- a/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
+++ b/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
@@ -26,3 +26,8 @@ aliases {
 &uart0 {
 	status = "okay";
 };
+
+&wdt0 {
+	timeout-sec = <60>;
+	status = "okay";
+};
-- 
2.25.1


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

* Re: [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1
  2022-02-08 18:35 ` [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
@ 2022-02-09  8:32   ` Geert Uytterhoeven
  2022-02-11 16:45   ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-09  8:32 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Linux-Renesas, 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

On Tue, Feb 8, 2022 at 7:35 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>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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 v2 3/6] ARM: dts: r9a06g032: Add the watchdog nodes
  2022-02-08 18:35 ` [PATCH v2 3/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
@ 2022-02-09  8:33   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-09  8:33 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Linux-Renesas, Geert Uytterhoeven, Magnus Damm, Rob Herring,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

Hi Jean-Jacques,

On Tue, Feb 8, 2022 at 7:35 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
> @@ -66,6 +66,22 @@ soc {
>                 interrupt-parent = <&gic>;
>                 ranges;
>
> +               wdt0: watchdog@40008000 {
> +                       compatible = "renesas,r9a06g032-wdt";

compatible = "renesas,r9a06g032-wdt", "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,r9a06g032-wdt";

compatible = "renesas,r9a06g032-wdt", "renesas,rzn1-wdt";

> +                       reg = <0x40009000 0x1000>;
> +                       interrupts = <GIC_SPI 74 IRQ_TYPE_EDGE_RISING>;
> +                       clocks = <&sysctrl R9A06G032_CLK_WATCHDOG>;
> +                       status = "disabled";
> +               };
> +
>                 sysctrl: system-controller@4000c000 {
>                         compatible = "renesas,r9a06g032-sysctrl";
>                         reg = <0x4000c000 0x1000>;
> --
> 2.25.1
>


-- 
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 v2 4/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 60s timeout
  2022-02-08 18:35 ` [PATCH v2 4/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 60s timeout Jean-Jacques Hiblot
@ 2022-02-09  8:33   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-02-09  8:33 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Linux-Renesas, Magnus Damm, Rob Herring,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

On Tue, Feb 8, 2022 at 7:35 PM Jean-Jacques Hiblot
<jjhiblot@traphandler.com> wrote:
> 60s is a sensible default value.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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 v2 1/6] dt-bindings: clock: r9a06g032: Add the definition of the the watchdog clock
  2022-02-08 18:35 ` [PATCH v2 1/6] dt-bindings: clock: r9a06g032: Add the definition of the the watchdog clock Jean-Jacques Hiblot
@ 2022-02-11 16:45   ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-02-11 16:45 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: linux-kernel, geert+renesas, Rob Herring, linux-renesas-soc,
	devicetree

On Tue, 08 Feb 2022 19:35:05 +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

* Re: [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1
  2022-02-08 18:35 ` [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
  2022-02-09  8:32   ` Geert Uytterhoeven
@ 2022-02-11 16:45   ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-02-11 16:45 UTC (permalink / raw)
  To: Jean-Jacques Hiblot
  Cc: Guenter Roeck, Rob Herring, devicetree, geert+renesas,
	linux-watchdog, Wolfram Sang, Wim Van Sebroeck, linux-renesas-soc,
	linux-kernel

On Tue, 08 Feb 2022 19:35:06 +0100, Jean-Jacques Hiblot wrote:
> 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 | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

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

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

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

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-08 18:35 [PATCH v2 0/6] ARM: r9a06g032: add support for the watchdogs Jean-Jacques Hiblot
2022-02-08 18:35 ` [PATCH v2 1/6] dt-bindings: clock: r9a06g032: Add the definition of the the watchdog clock Jean-Jacques Hiblot
2022-02-11 16:45   ` Rob Herring
2022-02-08 18:35 ` [PATCH v2 2/6] dt-bindings: watchdog: renesas,wdt: Add support for RZ/N1 Jean-Jacques Hiblot
2022-02-09  8:32   ` Geert Uytterhoeven
2022-02-11 16:45   ` Rob Herring
2022-02-08 18:35 ` [PATCH v2 3/6] ARM: dts: r9a06g032: Add the watchdog nodes Jean-Jacques Hiblot
2022-02-09  8:33   ` Geert Uytterhoeven
2022-02-08 18:35 ` [PATCH v2 4/6] ARM: dts: r9a06g032-rzn1d400-db: Enable watchdog0 with a 60s timeout Jean-Jacques Hiblot
2022-02-09  8:33   ` 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).