All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Add Watchdog support for RZ/V2M EVK v2
@ 2022-11-03 22:39 Fabrizio Castro
  2022-11-03 22:39 ` [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Fabrizio Castro
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Fabrizio Castro @ 2022-11-03 22:39 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Geert Uytterhoeven
  Cc: Fabrizio Castro, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

Dear All,

This series is to add watchdog support for the RZ/V2M EVK v2.

While testing I have noticed a problem with restarting the
system via the watchdog, therefore this series also contains
a driver fix.

Thanks,
Fab

Fabrizio Castro (3):
  watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  arm64: dts: renesas: r9a09g011: Add watchdog node
  arm64: dts: renesas: v2mevk2: Enable watchdog

 arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts |  4 ++++
 arch/arm64/boot/dts/renesas/r9a09g011.dtsi        | 13 +++++++++++++
 drivers/watchdog/rzg2l_wdt.c                      | 11 ++++++++---
 3 files changed, 25 insertions(+), 3 deletions(-)

-- 
2.34.1


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

* [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2022-11-03 22:39 [PATCH 0/3] Add Watchdog support for RZ/V2M EVK v2 Fabrizio Castro
@ 2022-11-03 22:39 ` Fabrizio Castro
  2022-11-14 13:59   ` Geert Uytterhoeven
  2022-11-15 13:28   ` Guenter Roeck
  2022-11-03 22:39 ` [PATCH 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node Fabrizio Castro
  2022-11-03 22:39 ` [PATCH 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog Fabrizio Castro
  2 siblings, 2 replies; 13+ messages in thread
From: Fabrizio Castro @ 2022-11-03 22:39 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Geert Uytterhoeven
  Cc: Fabrizio Castro, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

The setting for the RZ/V2M watchdog cannot be changed once
the watchdog has been enabled, unless the IP gets reset.
The current implementation of the restart callback assumes
that the watchdog is not enabled, but that's not always the
case, and it leads to longer than necessary reboot times if
the watchdog is already running.

Always reset the RZ/V2M watchdog first, so that we can always
restart quickly.

Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
 drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
index 974a4194a8fd..00438ceed17a 100644
--- a/drivers/watchdog/rzg2l_wdt.c
+++ b/drivers/watchdog/rzg2l_wdt.c
@@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
 {
 	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
 
-	clk_prepare_enable(priv->pclk);
-	clk_prepare_enable(priv->osc_clk);
-
 	if (priv->devtype == WDT_RZG2L) {
+		clk_prepare_enable(priv->pclk);
+		clk_prepare_enable(priv->osc_clk);
+
 		/* Generate Reset (WDTRSTB) Signal on parity error */
 		rzg2l_wdt_write(priv, 0, PECR);
 
@@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
 	} else {
 		/* RZ/V2M doesn't have parity error registers */
 
+		reset_control_reset(priv->rstc);
+
+		clk_prepare_enable(priv->pclk);
+		clk_prepare_enable(priv->osc_clk);
+
 		wdev->timeout = 0;
 
 		/* Initialize time out */
-- 
2.34.1


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

* [PATCH 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node
  2022-11-03 22:39 [PATCH 0/3] Add Watchdog support for RZ/V2M EVK v2 Fabrizio Castro
  2022-11-03 22:39 ` [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Fabrizio Castro
@ 2022-11-03 22:39 ` Fabrizio Castro
  2022-11-14 14:00   ` Geert Uytterhoeven
  2022-11-03 22:39 ` [PATCH 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog Fabrizio Castro
  2 siblings, 1 reply; 13+ messages in thread
From: Fabrizio Castro @ 2022-11-03 22:39 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Geert Uytterhoeven
  Cc: Fabrizio Castro, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

The r9a09g011 (a.k.a. RZ/V2M) comes with two watchdog IPs,
but Linux is only allowed one.

Add a node for the watchdog allowed to Linux to the SoC
specific dtsi.

Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
 arch/arm64/boot/dts/renesas/r9a09g011.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g011.dtsi b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi
index fb1a97202c38..9859c717bd10 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g011.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi
@@ -161,6 +161,19 @@ uart0: serial@a4040000 {
 			status = "disabled";
 		};
 
+		wdt0: watchdog@a4050000 {
+			compatible = "renesas,r9a09g011-wdt",
+				     "renesas,rzv2m-wdt";
+			reg = <0 0xa4050000 0 0x80>;
+			clocks = <&cpg CPG_MOD R9A09G011_WDT0_PCLK>,
+				 <&cpg CPG_MOD R9A09G011_WDT0_CLK>;
+			clock-names = "pclk", "oscclk";
+			interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&cpg R9A09G011_WDT0_PRESETN>;
+			power-domains = <&cpg>;
+			status = "disabled";
+		};
+
 		pinctrl: pinctrl@b6250000 {
 			compatible = "renesas,r9a09g011-pinctrl";
 			reg = <0 0xb6250000 0 0x800>;
-- 
2.34.1


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

* [PATCH 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog
  2022-11-03 22:39 [PATCH 0/3] Add Watchdog support for RZ/V2M EVK v2 Fabrizio Castro
  2022-11-03 22:39 ` [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Fabrizio Castro
  2022-11-03 22:39 ` [PATCH 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node Fabrizio Castro
@ 2022-11-03 22:39 ` Fabrizio Castro
  2022-11-14 14:02   ` Geert Uytterhoeven
  2 siblings, 1 reply; 13+ messages in thread
From: Fabrizio Castro @ 2022-11-03 22:39 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Geert Uytterhoeven
  Cc: Fabrizio Castro, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

Enable the watchdog so that we can reboot the system.

Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
 arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
index 5c15d73d059f..11e1d51c7c0e 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
+++ b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
@@ -83,3 +83,7 @@ i2c2_pins: i2c2 {
 &uart0 {
 	status = "okay";
 };
+
+&wdt0 {
+	status = "okay";
+};
-- 
2.34.1


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

* Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2022-11-03 22:39 ` [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Fabrizio Castro
@ 2022-11-14 13:59   ` Geert Uytterhoeven
  2022-11-15 13:28   ` Guenter Roeck
  1 sibling, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-11-14 13:59 UTC (permalink / raw)
  To: Fabrizio Castro
  Cc: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

On Thu, Nov 3, 2022 at 11:40 PM Fabrizio Castro
<fabrizio.castro.jz@renesas.com> wrote:
> The setting for the RZ/V2M watchdog cannot be changed once
> the watchdog has been enabled, unless the IP gets reset.
> The current implementation of the restart callback assumes
> that the watchdog is not enabled, but that's not always the
> case, and it leads to longer than necessary reboot times if
> the watchdog is already running.
>
> Always reset the RZ/V2M watchdog first, so that we can always
> restart quickly.
>
> Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.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] 13+ messages in thread

* Re: [PATCH 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node
  2022-11-03 22:39 ` [PATCH 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node Fabrizio Castro
@ 2022-11-14 14:00   ` Geert Uytterhoeven
  0 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-11-14 14:00 UTC (permalink / raw)
  To: Fabrizio Castro
  Cc: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

On Thu, Nov 3, 2022 at 11:40 PM Fabrizio Castro
<fabrizio.castro.jz@renesas.com> wrote:
> The r9a09g011 (a.k.a. RZ/V2M) comes with two watchdog IPs,
> but Linux is only allowed one.
>
> Add a node for the watchdog allowed to Linux to the SoC
> specific dtsi.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v6.2.

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] 13+ messages in thread

* Re: [PATCH 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog
  2022-11-03 22:39 ` [PATCH 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog Fabrizio Castro
@ 2022-11-14 14:02   ` Geert Uytterhoeven
  0 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-11-14 14:02 UTC (permalink / raw)
  To: Fabrizio Castro
  Cc: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Guenter Roeck, Geert Uytterhoeven, Magnus Damm, Biju Das,
	linux-renesas-soc, devicetree, linux-kernel, linux-watchdog,
	Chris Paterson, Biju Das, Fabrizio Castro, Laurent Pinchart,
	Jacopo Mondi

On Thu, Nov 3, 2022 at 11:47 PM Fabrizio Castro
<fabrizio.castro.jz@renesas.com> wrote:
> Enable the watchdog so that we can reboot the system.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v6.2.

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] 13+ messages in thread

* Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2022-11-03 22:39 ` [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Fabrizio Castro
  2022-11-14 13:59   ` Geert Uytterhoeven
@ 2022-11-15 13:28   ` Guenter Roeck
  2022-11-17 11:39     ` Fabrizio Castro
  1 sibling, 1 reply; 13+ messages in thread
From: Guenter Roeck @ 2022-11-15 13:28 UTC (permalink / raw)
  To: Fabrizio Castro
  Cc: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Geert Uytterhoeven, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote:
> The setting for the RZ/V2M watchdog cannot be changed once
> the watchdog has been enabled, unless the IP gets reset.
> The current implementation of the restart callback assumes
> that the watchdog is not enabled, but that's not always the
> case, and it leads to longer than necessary reboot times if
> the watchdog is already running.
> 
> Always reset the RZ/V2M watchdog first, so that we can always
> restart quickly.
> 
> Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> index 974a4194a8fd..00438ceed17a 100644
> --- a/drivers/watchdog/rzg2l_wdt.c
> +++ b/drivers/watchdog/rzg2l_wdt.c
> @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
>  {
>  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
>  
> -	clk_prepare_enable(priv->pclk);
> -	clk_prepare_enable(priv->osc_clk);
> -
>  	if (priv->devtype == WDT_RZG2L) {
> +		clk_prepare_enable(priv->pclk);
> +		clk_prepare_enable(priv->osc_clk);
> +
>  		/* Generate Reset (WDTRSTB) Signal on parity error */
>  		rzg2l_wdt_write(priv, 0, PECR);
>  
> @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
>  	} else {
>  		/* RZ/V2M doesn't have parity error registers */
>  
> +		reset_control_reset(priv->rstc);
> +
> +		clk_prepare_enable(priv->pclk);
> +		clk_prepare_enable(priv->osc_clk);
> +
>  		wdev->timeout = 0;
>  
>  		/* Initialize time out */
> -- 
> 2.34.1
> 

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

* RE: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2022-11-15 13:28   ` Guenter Roeck
@ 2022-11-17 11:39     ` Fabrizio Castro
  2023-05-07 15:36       ` Wim Van Sebroeck
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrizio Castro @ 2022-11-17 11:39 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Rob Herring, Krzysztof Kozlowski, Wim Van Sebroeck,
	Geert Uytterhoeven, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

Hi Geert and Guenter,

Thank you for your reviews!

As it turns out, the rzg2l_wdt driver has some reset related issues
(currently not addressed by the driver) for the RZ/V2M and RZ/Five
SoCs. More specifically to this patch, there is a better way to fix
the restart callback by addressing the way the reset is handled
for the watchdog IP.

I am dropping this patch, and I'll send out a series to address
the above concerns (which will tackle the issues with the restart
callback in a better way).


Thanks,
Fab


> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: 15 November 2022 13:28
> Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
> 
> On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote:
> > The setting for the RZ/V2M watchdog cannot be changed once
> > the watchdog has been enabled, unless the IP gets reset.
> > The current implementation of the restart callback assumes
> > that the watchdog is not enabled, but that's not always the
> > case, and it leads to longer than necessary reboot times if
> > the watchdog is already running.
> >
> > Always reset the RZ/V2M watchdog first, so that we can always
> > restart quickly.
> >
> > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> > ---
> >  drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> > index 974a4194a8fd..00438ceed17a 100644
> > --- a/drivers/watchdog/rzg2l_wdt.c
> > +++ b/drivers/watchdog/rzg2l_wdt.c
> > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct
> watchdog_device *wdev,
> >  {
> >  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> >
> > -	clk_prepare_enable(priv->pclk);
> > -	clk_prepare_enable(priv->osc_clk);
> > -
> >  	if (priv->devtype == WDT_RZG2L) {
> > +		clk_prepare_enable(priv->pclk);
> > +		clk_prepare_enable(priv->osc_clk);
> > +
> >  		/* Generate Reset (WDTRSTB) Signal on parity error */
> >  		rzg2l_wdt_write(priv, 0, PECR);
> >
> > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device
> *wdev,
> >  	} else {
> >  		/* RZ/V2M doesn't have parity error registers */
> >
> > +		reset_control_reset(priv->rstc);
> > +
> > +		clk_prepare_enable(priv->pclk);
> > +		clk_prepare_enable(priv->osc_clk);
> > +
> >  		wdev->timeout = 0;
> >
> >  		/* Initialize time out */
> > --
> > 2.34.1
> >

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

* Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2022-11-17 11:39     ` Fabrizio Castro
@ 2023-05-07 15:36       ` Wim Van Sebroeck
  2023-05-08 13:29         ` Guenter Roeck
  2023-05-09  8:12         ` Fabrizio Castro
  0 siblings, 2 replies; 13+ messages in thread
From: Wim Van Sebroeck @ 2023-05-07 15:36 UTC (permalink / raw)
  To: Fabrizio Castro, Guenter Roeck
  Cc: Rob Herring, Krzysztof Kozlowski, Geert Uytterhoeven,
	Magnus Damm, Biju Das, linux-renesas-soc, devicetree,
	linux-kernel, linux-watchdog, Chris Paterson, Biju Das,
	Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

Hi Fabrizio,

Based on below e-mail I excluded this patch from the merge window.
I saw that Guenter still has it in his branch.
So can we have an update on this please?

Thanks in advance,
Wim.

> Hi Geert and Guenter,
> 
> Thank you for your reviews!
> 
> As it turns out, the rzg2l_wdt driver has some reset related issues
> (currently not addressed by the driver) for the RZ/V2M and RZ/Five
> SoCs. More specifically to this patch, there is a better way to fix
> the restart callback by addressing the way the reset is handled
> for the watchdog IP.
> 
> I am dropping this patch, and I'll send out a series to address
> the above concerns (which will tackle the issues with the restart
> callback in a better way).
> 
> 
> Thanks,
> Fab
> 
> 
> > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> > Sent: 15 November 2022 13:28
> > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
> > 
> > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote:
> > > The setting for the RZ/V2M watchdog cannot be changed once
> > > the watchdog has been enabled, unless the IP gets reset.
> > > The current implementation of the restart callback assumes
> > > that the watchdog is not enabled, but that's not always the
> > > case, and it leads to longer than necessary reboot times if
> > > the watchdog is already running.
> > >
> > > Always reset the RZ/V2M watchdog first, so that we can always
> > > restart quickly.
> > >
> > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> > 
> > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > 
> > > ---
> > >  drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
> > >  1 file changed, 8 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> > > index 974a4194a8fd..00438ceed17a 100644
> > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct
> > watchdog_device *wdev,
> > >  {
> > >  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > >
> > > -	clk_prepare_enable(priv->pclk);
> > > -	clk_prepare_enable(priv->osc_clk);
> > > -
> > >  	if (priv->devtype == WDT_RZG2L) {
> > > +		clk_prepare_enable(priv->pclk);
> > > +		clk_prepare_enable(priv->osc_clk);
> > > +
> > >  		/* Generate Reset (WDTRSTB) Signal on parity error */
> > >  		rzg2l_wdt_write(priv, 0, PECR);
> > >
> > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device
> > *wdev,
> > >  	} else {
> > >  		/* RZ/V2M doesn't have parity error registers */
> > >
> > > +		reset_control_reset(priv->rstc);
> > > +
> > > +		clk_prepare_enable(priv->pclk);
> > > +		clk_prepare_enable(priv->osc_clk);
> > > +
> > >  		wdev->timeout = 0;
> > >
> > >  		/* Initialize time out */
> > > --
> > > 2.34.1
> > >

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

* Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2023-05-07 15:36       ` Wim Van Sebroeck
@ 2023-05-08 13:29         ` Guenter Roeck
  2023-05-09  8:13           ` Fabrizio Castro
  2023-05-09  8:12         ` Fabrizio Castro
  1 sibling, 1 reply; 13+ messages in thread
From: Guenter Roeck @ 2023-05-08 13:29 UTC (permalink / raw)
  To: Wim Van Sebroeck
  Cc: Fabrizio Castro, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Biju Das, linux-renesas-soc,
	devicetree, linux-kernel, linux-watchdog, Chris Paterson,
	Biju Das, Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

On Sun, May 07, 2023 at 05:36:25PM +0200, Wim Van Sebroeck wrote:
> Hi Fabrizio,
> 
> Based on below e-mail I excluded this patch from the merge window.
> I saw that Guenter still has it in his branch.

Thanks for the note. I'll drop it.

Guenter

> So can we have an update on this please?
> 
> Thanks in advance,
> Wim.
> 
> > Hi Geert and Guenter,
> > 
> > Thank you for your reviews!
> > 
> > As it turns out, the rzg2l_wdt driver has some reset related issues
> > (currently not addressed by the driver) for the RZ/V2M and RZ/Five
> > SoCs. More specifically to this patch, there is a better way to fix
> > the restart callback by addressing the way the reset is handled
> > for the watchdog IP.
> > 
> > I am dropping this patch, and I'll send out a series to address
> > the above concerns (which will tackle the issues with the restart
> > callback in a better way).
> > 
> > 
> > Thanks,
> > Fab
> > 
> > 
> > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> > > Sent: 15 November 2022 13:28
> > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
> > > 
> > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote:
> > > > The setting for the RZ/V2M watchdog cannot be changed once
> > > > the watchdog has been enabled, unless the IP gets reset.
> > > > The current implementation of the restart callback assumes
> > > > that the watchdog is not enabled, but that's not always the
> > > > case, and it leads to longer than necessary reboot times if
> > > > the watchdog is already running.
> > > >
> > > > Always reset the RZ/V2M watchdog first, so that we can always
> > > > restart quickly.
> > > >
> > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> > > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> > > 
> > > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > > 
> > > > ---
> > > >  drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
> > > >  1 file changed, 8 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> > > > index 974a4194a8fd..00438ceed17a 100644
> > > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct
> > > watchdog_device *wdev,
> > > >  {
> > > >  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > > >
> > > > -	clk_prepare_enable(priv->pclk);
> > > > -	clk_prepare_enable(priv->osc_clk);
> > > > -
> > > >  	if (priv->devtype == WDT_RZG2L) {
> > > > +		clk_prepare_enable(priv->pclk);
> > > > +		clk_prepare_enable(priv->osc_clk);
> > > > +
> > > >  		/* Generate Reset (WDTRSTB) Signal on parity error */
> > > >  		rzg2l_wdt_write(priv, 0, PECR);
> > > >
> > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device
> > > *wdev,
> > > >  	} else {
> > > >  		/* RZ/V2M doesn't have parity error registers */
> > > >
> > > > +		reset_control_reset(priv->rstc);
> > > > +
> > > > +		clk_prepare_enable(priv->pclk);
> > > > +		clk_prepare_enable(priv->osc_clk);
> > > > +
> > > >  		wdev->timeout = 0;
> > > >
> > > >  		/* Initialize time out */
> > > > --
> > > > 2.34.1
> > > >

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

* RE: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2023-05-07 15:36       ` Wim Van Sebroeck
  2023-05-08 13:29         ` Guenter Roeck
@ 2023-05-09  8:12         ` Fabrizio Castro
  1 sibling, 0 replies; 13+ messages in thread
From: Fabrizio Castro @ 2023-05-09  8:12 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: Rob Herring, Krzysztof Kozlowski, Geert Uytterhoeven,
	Magnus Damm, Biju Das, linux-renesas-soc, devicetree,
	linux-kernel, linux-watchdog, Chris Paterson, Biju Das,
	Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

Hi Wim,

Thanks for checking on this.

This patch was superseded by:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f769f97917c1e756e12ff042a93f6e3167254b5b 

Therefore, the right thing to do is to get rid of this patch.

Thanks,
Fab

> From: Wim Van Sebroeck <wim@linux-watchdog.org>
> Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
> 
> Hi Fabrizio,
> 
> Based on below e-mail I excluded this patch from the merge window.
> I saw that Guenter still has it in his branch.
> So can we have an update on this please?
> 
> Thanks in advance,
> Wim.
> 
> > Hi Geert and Guenter,
> >
> > Thank you for your reviews!
> >
> > As it turns out, the rzg2l_wdt driver has some reset related issues
> > (currently not addressed by the driver) for the RZ/V2M and RZ/Five
> > SoCs. More specifically to this patch, there is a better way to fix
> > the restart callback by addressing the way the reset is handled
> > for the watchdog IP.
> >
> > I am dropping this patch, and I'll send out a series to address
> > the above concerns (which will tackle the issues with the restart
> > callback in a better way).
> >
> >
> > Thanks,
> > Fab
> >
> >
> > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> > > Sent: 15 November 2022 13:28
> > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for
> RZ/V2M
> > >
> > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote:
> > > > The setting for the RZ/V2M watchdog cannot be changed once
> > > > the watchdog has been enabled, unless the IP gets reset.
> > > > The current implementation of the restart callback assumes
> > > > that the watchdog is not enabled, but that's not always the
> > > > case, and it leads to longer than necessary reboot times if
> > > > the watchdog is already running.
> > > >
> > > > Always reset the RZ/V2M watchdog first, so that we can always
> > > > restart quickly.
> > > >
> > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> > > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> > >
> > > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > >
> > > > ---
> > > >  drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
> > > >  1 file changed, 8 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/watchdog/rzg2l_wdt.c
> b/drivers/watchdog/rzg2l_wdt.c
> > > > index 974a4194a8fd..00438ceed17a 100644
> > > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct
> > > watchdog_device *wdev,
> > > >  {
> > > >  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > > >
> > > > -	clk_prepare_enable(priv->pclk);
> > > > -	clk_prepare_enable(priv->osc_clk);
> > > > -
> > > >  	if (priv->devtype == WDT_RZG2L) {
> > > > +		clk_prepare_enable(priv->pclk);
> > > > +		clk_prepare_enable(priv->osc_clk);
> > > > +
> > > >  		/* Generate Reset (WDTRSTB) Signal on parity error */
> > > >  		rzg2l_wdt_write(priv, 0, PECR);
> > > >
> > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct
> watchdog_device
> > > *wdev,
> > > >  	} else {
> > > >  		/* RZ/V2M doesn't have parity error registers */
> > > >
> > > > +		reset_control_reset(priv->rstc);
> > > > +
> > > > +		clk_prepare_enable(priv->pclk);
> > > > +		clk_prepare_enable(priv->osc_clk);
> > > > +
> > > >  		wdev->timeout = 0;
> > > >
> > > >  		/* Initialize time out */
> > > > --
> > > > 2.34.1
> > > >

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

* RE: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
  2023-05-08 13:29         ` Guenter Roeck
@ 2023-05-09  8:13           ` Fabrizio Castro
  0 siblings, 0 replies; 13+ messages in thread
From: Fabrizio Castro @ 2023-05-09  8:13 UTC (permalink / raw)
  To: Guenter Roeck, Wim Van Sebroeck
  Cc: Rob Herring, Krzysztof Kozlowski, Geert Uytterhoeven,
	Magnus Damm, Biju Das, linux-renesas-soc, devicetree,
	linux-kernel, linux-watchdog, Chris Paterson, Biju Das,
	Fabrizio Castro, Laurent Pinchart, Jacopo Mondi

Thanks Guenter.

Fab

> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M
> 
> On Sun, May 07, 2023 at 05:36:25PM +0200, Wim Van Sebroeck wrote:
> > Hi Fabrizio,
> >
> > Based on below e-mail I excluded this patch from the merge window.
> > I saw that Guenter still has it in his branch.
> 
> Thanks for the note. I'll drop it.
> 
> Guenter
> 
> > So can we have an update on this please?
> >
> > Thanks in advance,
> > Wim.
> >
> > > Hi Geert and Guenter,
> > >
> > > Thank you for your reviews!
> > >
> > > As it turns out, the rzg2l_wdt driver has some reset related
> issues
> > > (currently not addressed by the driver) for the RZ/V2M and RZ/Five
> > > SoCs. More specifically to this patch, there is a better way to
> fix
> > > the restart callback by addressing the way the reset is handled
> > > for the watchdog IP.
> > >
> > > I am dropping this patch, and I'll send out a series to address
> > > the above concerns (which will tackle the issues with the restart
> > > callback in a better way).
> > >
> > >
> > > Thanks,
> > > Fab
> > >
> > >
> > > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter
> Roeck
> > > > Sent: 15 November 2022 13:28
> > > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for
> RZ/V2M
> > > >
> > > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote:
> > > > > The setting for the RZ/V2M watchdog cannot be changed once
> > > > > the watchdog has been enabled, unless the IP gets reset.
> > > > > The current implementation of the restart callback assumes
> > > > > that the watchdog is not enabled, but that's not always the
> > > > > case, and it leads to longer than necessary reboot times if
> > > > > the watchdog is already running.
> > > > >
> > > > > Always reset the RZ/V2M watchdog first, so that we can always
> > > > > restart quickly.
> > > > >
> > > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
> > > > > Signed-off-by: Fabrizio Castro
> <fabrizio.castro.jz@renesas.com>
> > > >
> > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > > >
> > > > > ---
> > > > >  drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
> > > > >  1 file changed, 8 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c
> b/drivers/watchdog/rzg2l_wdt.c
> > > > > index 974a4194a8fd..00438ceed17a 100644
> > > > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct
> > > > watchdog_device *wdev,
> > > > >  {
> > > > >  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > > > >
> > > > > -	clk_prepare_enable(priv->pclk);
> > > > > -	clk_prepare_enable(priv->osc_clk);
> > > > > -
> > > > >  	if (priv->devtype == WDT_RZG2L) {
> > > > > +		clk_prepare_enable(priv->pclk);
> > > > > +		clk_prepare_enable(priv->osc_clk);
> > > > > +
> > > > >  		/* Generate Reset (WDTRSTB) Signal on parity error */
> > > > >  		rzg2l_wdt_write(priv, 0, PECR);
> > > > >
> > > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct
> watchdog_device
> > > > *wdev,
> > > > >  	} else {
> > > > >  		/* RZ/V2M doesn't have parity error registers */
> > > > >
> > > > > +		reset_control_reset(priv->rstc);
> > > > > +
> > > > > +		clk_prepare_enable(priv->pclk);
> > > > > +		clk_prepare_enable(priv->osc_clk);
> > > > > +
> > > > >  		wdev->timeout = 0;
> > > > >
> > > > >  		/* Initialize time out */
> > > > > --
> > > > > 2.34.1
> > > > >

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

end of thread, other threads:[~2023-05-09  8:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 22:39 [PATCH 0/3] Add Watchdog support for RZ/V2M EVK v2 Fabrizio Castro
2022-11-03 22:39 ` [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Fabrizio Castro
2022-11-14 13:59   ` Geert Uytterhoeven
2022-11-15 13:28   ` Guenter Roeck
2022-11-17 11:39     ` Fabrizio Castro
2023-05-07 15:36       ` Wim Van Sebroeck
2023-05-08 13:29         ` Guenter Roeck
2023-05-09  8:13           ` Fabrizio Castro
2023-05-09  8:12         ` Fabrizio Castro
2022-11-03 22:39 ` [PATCH 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node Fabrizio Castro
2022-11-14 14:00   ` Geert Uytterhoeven
2022-11-03 22:39 ` [PATCH 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog Fabrizio Castro
2022-11-14 14:02   ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.