linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
@ 2022-11-14 18:08 Prabhakar
  2022-11-14 18:42 ` Biju Das
  0 siblings, 1 reply; 13+ messages in thread
From: Prabhakar @ 2022-11-14 18:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

On RZ/Five SoC it was observed that setting timeout (to say 1 sec)
wouldn't reset the system. To fix this we make sure we issue a reset
before putting the PM clocks to make sure the registers have been cleared.

While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as
we were calling the same functions here.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
Note,
- This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
- My initial investigation showed adding the delay after pm_runtime_get_sync()
  also fixed this issue.
- Do I need add the fixes tag ? what should be the operation PUT->RESET/RESET->PUT?
  in case we need the tag is:
  Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout callback")
---
 drivers/watchdog/rzg2l_wdt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
index 00438ceed17a..d1271cc7750f 100644
--- a/drivers/watchdog/rzg2l_wdt.c
+++ b/drivers/watchdog/rzg2l_wdt.c
@@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
 {
 	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
 
-	pm_runtime_put(wdev->parent);
 	reset_control_reset(priv->rstc);
+	pm_runtime_put(wdev->parent);
 
 	return 0;
 }
 
 static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout)
 {
-	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
-
 	wdev->timeout = timeout;
 
 	/*
@@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int time
 	 * register so that it is updated with new timeout values.
 	 */
 	if (watchdog_active(wdev)) {
-		pm_runtime_put(wdev->parent);
-		reset_control_reset(priv->rstc);
+		rzg2l_wdt_stop(wdev);
 		rzg2l_wdt_start(wdev);
 	}
 
-- 
2.25.1


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

* RE: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 18:08 [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks Prabhakar
@ 2022-11-14 18:42 ` Biju Das
  2022-11-14 19:03   ` Geert Uytterhoeven
  2022-11-14 19:45   ` Lad, Prabhakar
  0 siblings, 2 replies; 13+ messages in thread
From: Biju Das @ 2022-11-14 18:42 UTC (permalink / raw)
  To: Prabhakar, Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog
  Cc: linux-kernel, linux-renesas-soc, Fabrizio Castro, Prabhakar Mahadev Lad



> -----Original Message-----
> From: Prabhakar <prabhakar.csengg@gmail.com>
> Sent: 14 November 2022 18:09
> To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp Zabel
> <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org;
> Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> lad.rj@bp.renesas.com>
> Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM
> clocks
> 
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't
> reset the system. To fix this we make sure we issue a reset before putting
> the PM clocks to make sure the registers have been cleared.
> 
> While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as we were
> calling the same functions here.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> Note,
> - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> - My initial investigation showed adding the delay after
> pm_runtime_get_sync()
>   also fixed this issue.
> - Do I need add the fixes tag ? what should be the operation PUT-
> >RESET/RESET->PUT?

It looks like timing issue, None of the previous devices are affected by this.

>   in case we need the tag is:
>   Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout callback")
> ---
>  drivers/watchdog/rzg2l_wdt.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> index 00438ceed17a..d1271cc7750f 100644
> --- a/drivers/watchdog/rzg2l_wdt.c
> +++ b/drivers/watchdog/rzg2l_wdt.c
> @@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
> {
>  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> 
> -	pm_runtime_put(wdev->parent);
>  	reset_control_reset(priv->rstc);
> +	pm_runtime_put(wdev->parent);
> 
>  	return 0;
>  }
> 
>  static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int
> timeout)  {
> -	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> -
>  	wdev->timeout = timeout;
> 
>  	/*
> @@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct watchdog_device
> *wdev, unsigned int time
>  	 * register so that it is updated with new timeout values.
>  	 */


Maybe update the comment above with new code change.

Cheers,
Biju

>  	if (watchdog_active(wdev)) {
> -		pm_runtime_put(wdev->parent);
> -		reset_control_reset(priv->rstc);
> +		rzg2l_wdt_stop(wdev);
>  		rzg2l_wdt_start(wdev);
>  	}
> 
> --
> 2.25.1


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

* Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 18:42 ` Biju Das
@ 2022-11-14 19:03   ` Geert Uytterhoeven
  2022-11-14 19:10     ` Biju Das
  2022-11-14 20:11     ` Lad, Prabhakar
  2022-11-14 19:45   ` Lad, Prabhakar
  1 sibling, 2 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-11-14 19:03 UTC (permalink / raw)
  To: Biju Das
  Cc: Prabhakar, Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad

Hi Biju,

On Mon, Nov 14, 2022 at 7:42 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > -----Original Message-----
> > From: Prabhakar <prabhakar.csengg@gmail.com>
> > Sent: 14 November 2022 18:09
> > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp Zabel
> > <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org;
> > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> > lad.rj@bp.renesas.com>
> > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM
> > clocks
> >
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't
> > reset the system. To fix this we make sure we issue a reset before putting
> > the PM clocks to make sure the registers have been cleared.
> >
> > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as we were
> > calling the same functions here.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > Note,
> > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > - My initial investigation showed adding the delay after
> > pm_runtime_get_sync()
> >   also fixed this issue.
> > - Do I need add the fixes tag ? what should be the operation PUT-
> > >RESET/RESET->PUT?
>
> It looks like timing issue, None of the previous devices are affected by this.

To me it looks like the device must be clocked for the reset signal
to be propagated?

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] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:03   ` Geert Uytterhoeven
@ 2022-11-14 19:10     ` Biju Das
  2022-11-15  7:48       ` Biju Das
  2022-11-14 20:11     ` Lad, Prabhakar
  1 sibling, 1 reply; 13+ messages in thread
From: Biju Das @ 2022-11-14 19:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Prabhakar, Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad



> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: 14 November 2022 19:04
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Prabhakar <prabhakar.csengg@gmail.com>; Geert Uytterhoeven
> <geert+renesas@glider.be>; Wim Van Sebroeck <wim@linux-watchdog.org>; Guenter
> Roeck <linux@roeck-us.net>; Philipp Zabel <p.zabel@pengutronix.de>; linux-
> watchdog@vger.kernel.org; linux-kernel@vger.kernel.org; linux-renesas-
> soc@vger.kernel.org; Fabrizio Castro <fabrizio.castro.jz@renesas.com>;
> Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM
> clocks
> 
> Hi Biju,
> 
> On Mon, Nov 14, 2022 at 7:42 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > -----Original Message-----
> > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > Sent: 14 November 2022 18:09
> > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>;
> > > Philipp Zabel <p.zabel@pengutronix.de>;
> > > linux-watchdog@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org;
> > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > <prabhakar.mahadev- lad.rj@bp.renesas.com>
> > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> > > the PM clocks
> > >
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec)
> > > wouldn't reset the system. To fix this we make sure we issue a reset
> > > before putting the PM clocks to make sure the registers have been
> cleared.
> > >
> > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as
> > > we were calling the same functions here.
> > >
> > > Signed-off-by: Lad Prabhakar
> > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > ---
> > > Note,
> > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > - My initial investigation showed adding the delay after
> > > pm_runtime_get_sync()
> > >   also fixed this issue.
> > > - Do I need add the fixes tag ? what should be the operation PUT-
> > > >RESET/RESET->PUT?
> >
> > It looks like timing issue, None of the previous devices are affected by
> this.
> 
> To me it looks like the device must be clocked for the reset signal to be
> propagated?

Yep, provide clk supply for a device, then apply reset.

Cheers,
Biju

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

* Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 18:42 ` Biju Das
  2022-11-14 19:03   ` Geert Uytterhoeven
@ 2022-11-14 19:45   ` Lad, Prabhakar
  2022-11-14 19:53     ` Biju Das
  1 sibling, 1 reply; 13+ messages in thread
From: Lad, Prabhakar @ 2022-11-14 19:45 UTC (permalink / raw)
  To: Biju Das
  Cc: Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad

HI Biju,

Thank you for the review.

On Mon, Nov 14, 2022 at 6:42 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Prabhakar <prabhakar.csengg@gmail.com>
> > Sent: 14 November 2022 18:09
> > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp Zabel
> > <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org;
> > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> > lad.rj@bp.renesas.com>
> > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM
> > clocks
> >
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't
> > reset the system. To fix this we make sure we issue a reset before putting
> > the PM clocks to make sure the registers have been cleared.
> >
> > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as we were
> > calling the same functions here.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > Note,
> > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > - My initial investigation showed adding the delay after
> > pm_runtime_get_sync()
> >   also fixed this issue.
> > - Do I need add the fixes tag ? what should be the operation PUT-
> > >RESET/RESET->PUT?
>
> It looks like timing issue, None of the previous devices are affected by this.
>
yep.

> >   in case we need the tag is:
> >   Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout callback")
> > ---
> >  drivers/watchdog/rzg2l_wdt.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> > index 00438ceed17a..d1271cc7750f 100644
> > --- a/drivers/watchdog/rzg2l_wdt.c
> > +++ b/drivers/watchdog/rzg2l_wdt.c
> > @@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
> > {
> >       struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> >
> > -     pm_runtime_put(wdev->parent);
> >       reset_control_reset(priv->rstc);
> > +     pm_runtime_put(wdev->parent);
> >
> >       return 0;
> >  }
> >
> >  static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int
> > timeout)  {
> > -     struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > -
> >       wdev->timeout = timeout;
> >
> >       /*
> > @@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct watchdog_device
> > *wdev, unsigned int time
> >        * register so that it is updated with new timeout values.
> >        */
>
>
> Maybe update the comment above with new code change.
>
    /*
     * If the watchdog is active, reset the module for updating the WDTSET
     * register so that it is updated with new timeout values.
     */

The above existing comment holds good with this code change. If you
prefer something else please let me know I'll update it accordingly.

Cheers,
Prabhakar

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

* RE: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:45   ` Lad, Prabhakar
@ 2022-11-14 19:53     ` Biju Das
  2022-11-14 19:56       ` Lad, Prabhakar
  0 siblings, 1 reply; 13+ messages in thread
From: Biju Das @ 2022-11-14 19:53 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad



> -----Original Message-----
> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> Sent: 14 November 2022 19:46
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp
> Zabel <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Fabrizio
> Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> the PM clocks
> 
> HI Biju,
> 
> Thank you for the review.
> 
> On Mon, Nov 14, 2022 at 6:42 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > Sent: 14 November 2022 18:09
> > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>;
> > > Philipp Zabel <p.zabel@pengutronix.de>;
> > > linux-watchdog@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org; linux-renesas-
> soc@vger.kernel.org;
> > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > <prabhakar.mahadev- lad.rj@bp.renesas.com>
> > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> > > the PM clocks
> > >
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec)
> > > wouldn't reset the system. To fix this we make sure we issue a
> reset
> > > before putting the PM clocks to make sure the registers have been
> cleared.
> > >
> > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as
> > > we were calling the same functions here.
> > >
> > > Signed-off-by: Lad Prabhakar
> > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > ---
> > > Note,
> > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > - My initial investigation showed adding the delay after
> > > pm_runtime_get_sync()
> > >   also fixed this issue.
> > > - Do I need add the fixes tag ? what should be the operation PUT-
> > > >RESET/RESET->PUT?
> >
> > It looks like timing issue, None of the previous devices are
> affected by this.
> >
> yep.
> 
> > >   in case we need the tag is:
> > >   Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout
> > > callback")
> > > ---
> > >  drivers/watchdog/rzg2l_wdt.c | 7 ++-----
> > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/watchdog/rzg2l_wdt.c
> > > b/drivers/watchdog/rzg2l_wdt.c index 00438ceed17a..d1271cc7750f
> > > 100644
> > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > @@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct
> > > watchdog_device *wdev) {
> > >       struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > >
> > > -     pm_runtime_put(wdev->parent);
> > >       reset_control_reset(priv->rstc);
> > > +     pm_runtime_put(wdev->parent);
> > >
> > >       return 0;
> > >  }
> > >
> > >  static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev,
> > > unsigned int
> > > timeout)  {
> > > -     struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > > -
> > >       wdev->timeout = timeout;
> > >
> > >       /*
> > > @@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct
> > > watchdog_device *wdev, unsigned int time
> > >        * register so that it is updated with new timeout values.
> > >        */
> >
> >
> > Maybe update the comment above with new code change.
> >
>     /*
>      * If the watchdog is active, reset the module for updating the
> WDTSET
>      * register so that it is updated with new timeout values.
>      */
> 
> The above existing comment holds good with this code change. If you
> prefer something else please let me know I'll update it accordingly.

Maybe mention, The resetting of the module is done in wdt_stop function.

Cheers,
Biju

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

* Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:53     ` Biju Das
@ 2022-11-14 19:56       ` Lad, Prabhakar
  2022-11-14 19:59         ` Biju Das
  0 siblings, 1 reply; 13+ messages in thread
From: Lad, Prabhakar @ 2022-11-14 19:56 UTC (permalink / raw)
  To: Biju Das
  Cc: Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad

On Mon, Nov 14, 2022 at 7:53 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> > Sent: 14 November 2022 19:46
> > To: Biju Das <biju.das.jz@bp.renesas.com>
> > Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp
> > Zabel <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org; linux-
> > kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Fabrizio
> > Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> > the PM clocks
> >
> > HI Biju,
> >
> > Thank you for the review.
> >
> > On Mon, Nov 14, 2022 at 6:42 PM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > > Sent: 14 November 2022 18:09
> > > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>;
> > > > Philipp Zabel <p.zabel@pengutronix.de>;
> > > > linux-watchdog@vger.kernel.org
> > > > Cc: linux-kernel@vger.kernel.org; linux-renesas-
> > soc@vger.kernel.org;
> > > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > > <prabhakar.mahadev- lad.rj@bp.renesas.com>
> > > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> > > > the PM clocks
> > > >
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > >
> > > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec)
> > > > wouldn't reset the system. To fix this we make sure we issue a
> > reset
> > > > before putting the PM clocks to make sure the registers have been
> > cleared.
> > > >
> > > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as
> > > > we were calling the same functions here.
> > > >
> > > > Signed-off-by: Lad Prabhakar
> > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > ---
> > > > Note,
> > > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > > - My initial investigation showed adding the delay after
> > > > pm_runtime_get_sync()
> > > >   also fixed this issue.
> > > > - Do I need add the fixes tag ? what should be the operation PUT-
> > > > >RESET/RESET->PUT?
> > >
> > > It looks like timing issue, None of the previous devices are
> > affected by this.
> > >
> > yep.
> >
> > > >   in case we need the tag is:
> > > >   Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout
> > > > callback")
> > > > ---
> > > >  drivers/watchdog/rzg2l_wdt.c | 7 ++-----
> > > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/watchdog/rzg2l_wdt.c
> > > > b/drivers/watchdog/rzg2l_wdt.c index 00438ceed17a..d1271cc7750f
> > > > 100644
> > > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > > @@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct
> > > > watchdog_device *wdev) {
> > > >       struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > > >
> > > > -     pm_runtime_put(wdev->parent);
> > > >       reset_control_reset(priv->rstc);
> > > > +     pm_runtime_put(wdev->parent);
> > > >
> > > >       return 0;
> > > >  }
> > > >
> > > >  static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev,
> > > > unsigned int
> > > > timeout)  {
> > > > -     struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > > > -
> > > >       wdev->timeout = timeout;
> > > >
> > > >       /*
> > > > @@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct
> > > > watchdog_device *wdev, unsigned int time
> > > >        * register so that it is updated with new timeout values.
> > > >        */
> > >
> > >
> > > Maybe update the comment above with new code change.
> > >
> >     /*
> >      * If the watchdog is active, reset the module for updating the
> > WDTSET
> >      * register so that it is updated with new timeout values.
> >      */
> >
> > The above existing comment holds good with this code change. If you
> > prefer something else please let me know I'll update it accordingly.
>
> Maybe mention, The resetting of the module is done in wdt_stop function.
>
    /*
     * If the watchdog is active, reset the module for updating the WDTSET
     * register by calling rzg2l_wdt_stop() (which internally calls
reset_control_reset() and pm_runtime_put()
     * so that it is updated with new timeout values.
     */

Does the above look good?

Cheers,
Prabhakar

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

* RE: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:56       ` Lad, Prabhakar
@ 2022-11-14 19:59         ` Biju Das
  2022-11-14 20:07           ` Lad, Prabhakar
  0 siblings, 1 reply; 13+ messages in thread
From: Biju Das @ 2022-11-14 19:59 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad



> -----Original Message-----
> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> Sent: 14 November 2022 19:56
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp
> Zabel <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Fabrizio
> Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> the PM clocks
> 
> On Mon, Nov 14, 2022 at 7:53 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> > > Sent: 14 November 2022 19:46
> > > To: Biju Das <biju.das.jz@bp.renesas.com>
> > > Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>;
> > > Philipp Zabel <p.zabel@pengutronix.de>;
> > > linux-watchdog@vger.kernel.org; linux- kernel@vger.kernel.org;
> > > linux-renesas-soc@vger.kernel.org; Fabrizio Castro
> > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we
> > > put the PM clocks
> > >
> > > HI Biju,
> > >
> > > Thank you for the review.
> > >
> > > On Mon, Nov 14, 2022 at 6:42 PM Biju Das
> > > <biju.das.jz@bp.renesas.com>
> > > wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > > > Sent: 14 November 2022 18:09
> > > > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van
> > > > > Sebroeck <wim@linux-watchdog.org>; Guenter Roeck
> > > > > <linux@roeck-us.net>; Philipp Zabel <p.zabel@pengutronix.de>;
> > > > > linux-watchdog@vger.kernel.org
> > > > > Cc: linux-kernel@vger.kernel.org; linux-renesas-
> > > soc@vger.kernel.org;
> > > > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > > > <prabhakar.mahadev- lad.rj@bp.renesas.com>
> > > > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we
> > > > > put the PM clocks
> > > > >
> > > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > >
> > > > > On RZ/Five SoC it was observed that setting timeout (to say 1
> > > > > sec) wouldn't reset the system. To fix this we make sure we
> > > > > issue a
> > > reset
> > > > > before putting the PM clocks to make sure the registers have
> > > > > been
> > > cleared.
> > > > >
> > > > > While at it re-used rzg2l_wdt_stop() in
> rzg2l_wdt_set_timeout()
> > > > > as we were calling the same functions here.
> > > > >
> > > > > Signed-off-by: Lad Prabhakar
> > > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > > ---
> > > > > Note,
> > > > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > > > - My initial investigation showed adding the delay after
> > > > > pm_runtime_get_sync()
> > > > >   also fixed this issue.
> > > > > - Do I need add the fixes tag ? what should be the operation
> > > > > PUT-
> > > > > >RESET/RESET->PUT?
> > > >
> > > > It looks like timing issue, None of the previous devices are
> > > affected by this.
> > > >
> > > yep.
> > >
> > > > >   in case we need the tag is:
> > > > >   Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout
> > > > > callback")
> > > > > ---
> > > > >  drivers/watchdog/rzg2l_wdt.c | 7 ++-----
> > > > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c
> > > > > b/drivers/watchdog/rzg2l_wdt.c index
> 00438ceed17a..d1271cc7750f
> > > > > 100644
> > > > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > > > @@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct
> > > > > watchdog_device *wdev) {
> > > > >       struct rzg2l_wdt_priv *priv =
> watchdog_get_drvdata(wdev);
> > > > >
> > > > > -     pm_runtime_put(wdev->parent);
> > > > >       reset_control_reset(priv->rstc);
> > > > > +     pm_runtime_put(wdev->parent);
> > > > >
> > > > >       return 0;
> > > > >  }
> > > > >
> > > > >  static int rzg2l_wdt_set_timeout(struct watchdog_device
> *wdev,
> > > > > unsigned int
> > > > > timeout)  {
> > > > > -     struct rzg2l_wdt_priv *priv =
> watchdog_get_drvdata(wdev);
> > > > > -
> > > > >       wdev->timeout = timeout;
> > > > >
> > > > >       /*
> > > > > @@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct
> > > > > watchdog_device *wdev, unsigned int time
> > > > >        * register so that it is updated with new timeout
> values.
> > > > >        */
> > > >
> > > >
> > > > Maybe update the comment above with new code change.
> > > >
> > >     /*
> > >      * If the watchdog is active, reset the module for updating
> the
> > > WDTSET
> > >      * register so that it is updated with new timeout values.
> > >      */
> > >
> > > The above existing comment holds good with this code change. If
> you
> > > prefer something else please let me know I'll update it
> accordingly.
> >
> > Maybe mention, The resetting of the module is done in wdt_stop
> function.
> >
>     /*
>      * If the watchdog is active, reset the module for updating the
> WDTSET
>      * register by calling rzg2l_wdt_stop() (which internally calls
> reset_control_reset() and pm_runtime_put()

(which internally calls reset_control_reset() to reset the module)

>      * so that it is updated with new timeout values.
>      */

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

* Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:59         ` Biju Das
@ 2022-11-14 20:07           ` Lad, Prabhakar
  0 siblings, 0 replies; 13+ messages in thread
From: Lad, Prabhakar @ 2022-11-14 20:07 UTC (permalink / raw)
  To: Biju Das
  Cc: Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad

On Mon, Nov 14, 2022 at 7:59 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> > Sent: 14 November 2022 19:56
> > To: Biju Das <biju.das.jz@bp.renesas.com>
> > Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp
> > Zabel <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org; linux-
> > kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Fabrizio
> > Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> > the PM clocks
> >
> > On Mon, Nov 14, 2022 at 7:53 PM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> > > > Sent: 14 November 2022 19:46
> > > > To: Biju Das <biju.das.jz@bp.renesas.com>
> > > > Cc: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>;
> > > > Philipp Zabel <p.zabel@pengutronix.de>;
> > > > linux-watchdog@vger.kernel.org; linux- kernel@vger.kernel.org;
> > > > linux-renesas-soc@vger.kernel.org; Fabrizio Castro
> > > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we
> > > > put the PM clocks
> > > >
> > > > HI Biju,
> > > >
> > > > Thank you for the review.
> > > >
> > > > On Mon, Nov 14, 2022 at 6:42 PM Biju Das
> > > > <biju.das.jz@bp.renesas.com>
> > > > wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > > > > Sent: 14 November 2022 18:09
> > > > > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van
> > > > > > Sebroeck <wim@linux-watchdog.org>; Guenter Roeck
> > > > > > <linux@roeck-us.net>; Philipp Zabel <p.zabel@pengutronix.de>;
> > > > > > linux-watchdog@vger.kernel.org
> > > > > > Cc: linux-kernel@vger.kernel.org; linux-renesas-
> > > > soc@vger.kernel.org;
> > > > > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > > > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > > > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > > > > <prabhakar.mahadev- lad.rj@bp.renesas.com>
> > > > > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we
> > > > > > put the PM clocks
> > > > > >
> > > > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > > >
> > > > > > On RZ/Five SoC it was observed that setting timeout (to say 1
> > > > > > sec) wouldn't reset the system. To fix this we make sure we
> > > > > > issue a
> > > > reset
> > > > > > before putting the PM clocks to make sure the registers have
> > > > > > been
> > > > cleared.
> > > > > >
> > > > > > While at it re-used rzg2l_wdt_stop() in
> > rzg2l_wdt_set_timeout()
> > > > > > as we were calling the same functions here.
> > > > > >
> > > > > > Signed-off-by: Lad Prabhakar
> > > > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > > > ---
> > > > > > Note,
> > > > > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > > > > - My initial investigation showed adding the delay after
> > > > > > pm_runtime_get_sync()
> > > > > >   also fixed this issue.
> > > > > > - Do I need add the fixes tag ? what should be the operation
> > > > > > PUT-
> > > > > > >RESET/RESET->PUT?
> > > > >
> > > > > It looks like timing issue, None of the previous devices are
> > > > affected by this.
> > > > >
> > > > yep.
> > > >
> > > > > >   in case we need the tag is:
> > > > > >   Fixes: 4055ee81009e6 ("watchdog: rzg2l_wdt: Add set_timeout
> > > > > > callback")
> > > > > > ---
> > > > > >  drivers/watchdog/rzg2l_wdt.c | 7 ++-----
> > > > > >  1 file changed, 2 insertions(+), 5 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c
> > > > > > b/drivers/watchdog/rzg2l_wdt.c index
> > 00438ceed17a..d1271cc7750f
> > > > > > 100644
> > > > > > --- a/drivers/watchdog/rzg2l_wdt.c
> > > > > > +++ b/drivers/watchdog/rzg2l_wdt.c
> > > > > > @@ -115,16 +115,14 @@ static int rzg2l_wdt_stop(struct
> > > > > > watchdog_device *wdev) {
> > > > > >       struct rzg2l_wdt_priv *priv =
> > watchdog_get_drvdata(wdev);
> > > > > >
> > > > > > -     pm_runtime_put(wdev->parent);
> > > > > >       reset_control_reset(priv->rstc);
> > > > > > +     pm_runtime_put(wdev->parent);
> > > > > >
> > > > > >       return 0;
> > > > > >  }
> > > > > >
> > > > > >  static int rzg2l_wdt_set_timeout(struct watchdog_device
> > *wdev,
> > > > > > unsigned int
> > > > > > timeout)  {
> > > > > > -     struct rzg2l_wdt_priv *priv =
> > watchdog_get_drvdata(wdev);
> > > > > > -
> > > > > >       wdev->timeout = timeout;
> > > > > >
> > > > > >       /*
> > > > > > @@ -132,8 +130,7 @@ static int rzg2l_wdt_set_timeout(struct
> > > > > > watchdog_device *wdev, unsigned int time
> > > > > >        * register so that it is updated with new timeout
> > values.
> > > > > >        */
> > > > >
> > > > >
> > > > > Maybe update the comment above with new code change.
> > > > >
> > > >     /*
> > > >      * If the watchdog is active, reset the module for updating
> > the
> > > > WDTSET
> > > >      * register so that it is updated with new timeout values.
> > > >      */
> > > >
> > > > The above existing comment holds good with this code change. If
> > you
> > > > prefer something else please let me know I'll update it
> > accordingly.
> > >
> > > Maybe mention, The resetting of the module is done in wdt_stop
> > function.
> > >
> >     /*
> >      * If the watchdog is active, reset the module for updating the
> > WDTSET
> >      * register by calling rzg2l_wdt_stop() (which internally calls
> > reset_control_reset() and pm_runtime_put()
>
> (which internally calls reset_control_reset() to reset the module)
>
Sure will update that in v2.

Cheers,
Prabhakar

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

* Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:03   ` Geert Uytterhoeven
  2022-11-14 19:10     ` Biju Das
@ 2022-11-14 20:11     ` Lad, Prabhakar
  1 sibling, 0 replies; 13+ messages in thread
From: Lad, Prabhakar @ 2022-11-14 20:11 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Biju Das, Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad

Hi Geert,

On Mon, Nov 14, 2022 at 7:03 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Biju,
>
> On Mon, Nov 14, 2022 at 7:42 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > -----Original Message-----
> > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > Sent: 14 November 2022 18:09
> > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van Sebroeck
> > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp Zabel
> > > <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org;
> > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> > > lad.rj@bp.renesas.com>
> > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM
> > > clocks
> > >
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't
> > > reset the system. To fix this we make sure we issue a reset before putting
> > > the PM clocks to make sure the registers have been cleared.
> > >
> > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as we were
> > > calling the same functions here.
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > ---
> > > Note,
> > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > - My initial investigation showed adding the delay after
> > > pm_runtime_get_sync()
> > >   also fixed this issue.
> > > - Do I need add the fixes tag ? what should be the operation PUT-
> > > >RESET/RESET->PUT?
> >
> > It looks like timing issue, None of the previous devices are affected by this.
>
> To me it looks like the device must be clocked for the reset signal
> to be propagated?
>
In the HW manual (7.4.3 Procedure for Activating Modules) it does
state the below before applying the reset signal,

Set up the clock control register for the clock signal connected to
the target module to start the supply of the clock.
Note that the PLL for the clock should be started before the clock if
the PLL is stopped.

So maybe I can add the fixes tag in v2.

Cheers,
Prabhakar

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

* RE: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-14 19:10     ` Biju Das
@ 2022-11-15  7:48       ` Biju Das
  2022-11-15  8:11         ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Biju Das @ 2022-11-15  7:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Prabhakar, Geert Uytterhoeven, Wim Van Sebroeck, Guenter Roeck,
	Philipp Zabel, linux-watchdog, linux-kernel, linux-renesas-soc,
	Fabrizio Castro, Prabhakar Mahadev Lad

> Subject: RE: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> the PM clocks
> 
> 
> 
> > -----Original Message-----
> > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > Sent: 14 November 2022 19:04
> > To: Biju Das <biju.das.jz@bp.renesas.com>
> > Cc: Prabhakar <prabhakar.csengg@gmail.com>; Geert Uytterhoeven
> > <geert+renesas@glider.be>; Wim Van Sebroeck <wim@linux-
> watchdog.org>;
> > Guenter Roeck <linux@roeck-us.net>; Philipp Zabel
> > <p.zabel@pengutronix.de>; linux- watchdog@vger.kernel.org;
> > linux-kernel@vger.kernel.org; linux-renesas- soc@vger.kernel.org;
> > Fabrizio Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev
> > Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we
> put
> > the PM clocks
> >
> > Hi Biju,
> >
> > On Mon, Nov 14, 2022 at 7:42 PM Biju Das
> <biju.das.jz@bp.renesas.com> wrote:
> > > > -----Original Message-----
> > > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > > Sent: 14 November 2022 18:09
> > > > To: Geert Uytterhoeven <geert+renesas@glider.be>; Wim Van
> Sebroeck
> > > > <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>;
> > > > Philipp Zabel <p.zabel@pengutronix.de>;
> > > > linux-watchdog@vger.kernel.org
> > > > Cc: linux-kernel@vger.kernel.org;
> > > > linux-renesas-soc@vger.kernel.org;
> > > > Prabhakar <prabhakar.csengg@gmail.com>; Biju Das
> > > > <biju.das.jz@bp.renesas.com>; Fabrizio Castro
> > > > <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> > > > <prabhakar.mahadev- lad.rj@bp.renesas.com>
> > > > Subject: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we
> put
> > > > the PM clocks
> > > >
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > >
> > > > On RZ/Five SoC it was observed that setting timeout (to say 1
> sec)
> > > > wouldn't reset the system. To fix this we make sure we issue a
> > > > reset before putting the PM clocks to make sure the registers
> have
> > > > been
> > cleared.
> > > >
> > > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout()
> as
> > > > we were calling the same functions here.
> > > >
> > > > Signed-off-by: Lad Prabhakar
> > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > ---
> > > > Note,
> > > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > > - My initial investigation showed adding the delay after
> > > > pm_runtime_get_sync()
> > > >   also fixed this issue.
> > > > - Do I need add the fixes tag ? what should be the operation
> PUT-
> > > > >RESET/RESET->PUT?
> > >
> > > It looks like timing issue, None of the previous devices are
> > > affected by
> > this.
> >
> > To me it looks like the device must be clocked for the reset signal
> to
> > be propagated?
> 
> Yep, provide clk supply for a device, then apply reset.

Maybe we need to make it consistent by taking care of  [1]

Current patch: CLK ON -> apply Reset for V2M.
[1]:  Apply Reset -> CLK ON for V2M.

[1] https://lore.kernel.org/linux-renesas-soc/CAMuHMdUWbT6VArm9B56VE0yUYWCTm=3vMGrrONSv9cdsQQnhpg@mail.gmail.com/T/#mdb78503524a8f4207f59a40f7ff573e210656988

Cheers,
Biju

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

* Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-15  7:48       ` Biju Das
@ 2022-11-15  8:11         ` Geert Uytterhoeven
  2022-11-15  8:28           ` Biju Das
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2022-11-15  8:11 UTC (permalink / raw)
  To: Biju Das
  Cc: Prabhakar, Wim Van Sebroeck, Guenter Roeck, Philipp Zabel,
	linux-watchdog, linux-kernel, linux-renesas-soc, Fabrizio Castro,
	Prabhakar Mahadev Lad

Hi Biju,

On Tue, Nov 15, 2022 at 8:48 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > -----Original Message-----
> > > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > > On Mon, Nov 14, 2022 at 7:42 PM Biju Das
> > <biju.das.jz@bp.renesas.com> wrote:
> > > > > From: Prabhakar <prabhakar.csengg@gmail.com>
> > > > > On RZ/Five SoC it was observed that setting timeout (to say 1
> > sec)
> > > > > wouldn't reset the system. To fix this we make sure we issue a
> > > > > reset before putting the PM clocks to make sure the registers
> > have
> > > > > been
> > > cleared.
> > > > >
> > > > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout()
> > as
> > > > > we were calling the same functions here.
> > > > >
> > > > > Signed-off-by: Lad Prabhakar
> > > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > > ---
> > > > > Note,
> > > > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > > > - My initial investigation showed adding the delay after
> > > > > pm_runtime_get_sync()
> > > > >   also fixed this issue.
> > > > > - Do I need add the fixes tag ? what should be the operation
> > PUT-
> > > > > >RESET/RESET->PUT?
> > > >
> > > > It looks like timing issue, None of the previous devices are
> > > > affected by
> > > this.
> > >
> > > To me it looks like the device must be clocked for the reset signal
> > to
> > > be propagated?
> >
> > Yep, provide clk supply for a device, then apply reset.
>
> Maybe we need to make it consistent by taking care of  [1]
>
> Current patch: CLK ON -> apply Reset for V2M.
> [1]:  Apply Reset -> CLK ON for V2M.

Yes, that would also simplify that patch: just add the call to reset?

> [1] https://lore.kernel.org/linux-renesas-soc/CAMuHMdUWbT6VArm9B56VE0yUYWCTm=3vMGrrONSv9cdsQQnhpg@mail.gmail.com/T/#mdb78503524a8f4207f59a40f7ff573e210656988

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] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks
  2022-11-15  8:11         ` Geert Uytterhoeven
@ 2022-11-15  8:28           ` Biju Das
  0 siblings, 0 replies; 13+ messages in thread
From: Biju Das @ 2022-11-15  8:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Prabhakar, Wim Van Sebroeck, Guenter Roeck, Philipp Zabel,
	linux-watchdog, linux-kernel, linux-renesas-soc, Fabrizio Castro,
	Prabhakar Mahadev Lad



> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: 15 November 2022 08:11
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Prabhakar <prabhakar.csengg@gmail.com>; Wim Van Sebroeck
> <wim@linux-watchdog.org>; Guenter Roeck <linux@roeck-us.net>; Philipp
> Zabel <p.zabel@pengutronix.de>; linux-watchdog@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Fabrizio
> Castro <fabrizio.castro.jz@renesas.com>; Prabhakar Mahadev Lad
> <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: Re: [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put
> the PM clocks
> 
> Hi Biju,
> 
> On Tue, Nov 15, 2022 at 8:48 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > > -----Original Message-----
> > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, Nov 14,
> > > > 2022 at 7:42 PM Biju Das
> > > <biju.das.jz@bp.renesas.com> wrote:
> > > > > > From: Prabhakar <prabhakar.csengg@gmail.com> On RZ/Five SoC
> it
> > > > > > was observed that setting timeout (to say 1
> > > sec)
> > > > > > wouldn't reset the system. To fix this we make sure we issue
> a
> > > > > > reset before putting the PM clocks to make sure the
> registers
> > > have
> > > > > > been
> > > > cleared.
> > > > > >
> > > > > > While at it re-used rzg2l_wdt_stop() in
> > > > > > rzg2l_wdt_set_timeout()
> > > as
> > > > > > we were calling the same functions here.
> > > > > >
> > > > > > Signed-off-by: Lad Prabhakar
> > > > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > > > ---
> > > > > > Note,
> > > > > > - This patch has been tested on RZ/G2L, RZ/V2M and RZ/Five.
> > > > > > - My initial investigation showed adding the delay after
> > > > > > pm_runtime_get_sync()
> > > > > >   also fixed this issue.
> > > > > > - Do I need add the fixes tag ? what should be the operation
> > > PUT-
> > > > > > >RESET/RESET->PUT?
> > > > >
> > > > > It looks like timing issue, None of the previous devices are
> > > > > affected by
> > > > this.
> > > >
> > > > To me it looks like the device must be clocked for the reset
> > > > signal
> > > to
> > > > be propagated?
> > >
> > > Yep, provide clk supply for a device, then apply reset.
> >
> > Maybe we need to make it consistent by taking care of  [1]
> >
> > Current patch: CLK ON -> apply Reset for V2M.
> > [1]:  Apply Reset -> CLK ON for V2M.
> 
> Yes, that would also simplify that patch: just add the call to reset?

Fabrizio previously told me, CLK ON -> apply Reset does not work for RZ/V2M reboot use case.

Regards,
Biju

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

end of thread, other threads:[~2022-11-15  8:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 18:08 [PATCH] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks Prabhakar
2022-11-14 18:42 ` Biju Das
2022-11-14 19:03   ` Geert Uytterhoeven
2022-11-14 19:10     ` Biju Das
2022-11-15  7:48       ` Biju Das
2022-11-15  8:11         ` Geert Uytterhoeven
2022-11-15  8:28           ` Biju Das
2022-11-14 20:11     ` Lad, Prabhakar
2022-11-14 19:45   ` Lad, Prabhakar
2022-11-14 19:53     ` Biju Das
2022-11-14 19:56       ` Lad, Prabhakar
2022-11-14 19:59         ` Biju Das
2022-11-14 20:07           ` Lad, Prabhakar

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).