All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
@ 2018-03-20 21:36 Wolfram Sang
  2018-03-20 21:59 ` Guenter Roeck
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wolfram Sang @ 2018-03-20 21:36 UTC (permalink / raw)
  To: linux-watchdog
  Cc: linux-renesas-soc, Fabrizio Castro, Veeraiyan Chidambaram,
	Takeshi Kihara, Wolfram Sang

From: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>

This patch adds the WDIOF_CARDRESET support for the Renessas platform
watchdog, to know if the board reboot is due to a watchdog reset.

This is done via the WOVF bit (bit 4) of the RWTCSRA register, which
indicates if RWTCNT overflowed, triggering the reset in last boot.

Signed-off-by: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
[takeshi.kihara.df: changed to read the RWTCSRA register while clock is
 enabled]
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/watchdog/renesas_wdt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
index 6b8c6ddfe30b31..514db5cc159511 100644
--- a/drivers/watchdog/renesas_wdt.c
+++ b/drivers/watchdog/renesas_wdt.c
@@ -121,7 +121,8 @@ static int rwdt_restart(struct watchdog_device *wdev, unsigned long action,
 }
 
 static const struct watchdog_info rwdt_ident = {
-	.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
+	.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
+		WDIOF_CARDRESET,
 	.identity = "Renesas WDT Watchdog",
 };
 
@@ -197,9 +198,10 @@ static int rwdt_probe(struct platform_device *pdev)
 		return PTR_ERR(clk);
 
 	pm_runtime_enable(&pdev->dev);
-
 	pm_runtime_get_sync(&pdev->dev);
 	priv->clk_rate = clk_get_rate(clk);
+	priv->wdev.bootstatus = (readb_relaxed(priv->base + RWTCSRA) &
+				RWTCSRA_WOVF) ? WDIOF_CARDRESET : 0;
 	pm_runtime_put(&pdev->dev);
 
 	if (!priv->clk_rate) {
-- 
2.11.0


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

* Re: [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
  2018-03-20 21:36 [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET Wolfram Sang
@ 2018-03-20 21:59 ` Guenter Roeck
  2018-04-13 14:18   ` Wolfram Sang
  2018-03-20 23:40 ` Vladimir Zapolskiy
  2018-03-21  8:24 ` Geert Uytterhoeven
  2 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2018-03-20 21:59 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-watchdog, linux-renesas-soc, Fabrizio Castro,
	Veeraiyan Chidambaram, Takeshi Kihara

On Tue, Mar 20, 2018 at 10:36:26PM +0100, Wolfram Sang wrote:
> From: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
> 
> This patch adds the WDIOF_CARDRESET support for the Renessas platform
> watchdog, to know if the board reboot is due to a watchdog reset.
> 
> This is done via the WOVF bit (bit 4) of the RWTCSRA register, which
> indicates if RWTCNT overflowed, triggering the reset in last boot.
> 
> Signed-off-by: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
> [takeshi.kihara.df: changed to read the RWTCSRA register while clock is
>  enabled]
> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

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

> ---
>  drivers/watchdog/renesas_wdt.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
> index 6b8c6ddfe30b31..514db5cc159511 100644
> --- a/drivers/watchdog/renesas_wdt.c
> +++ b/drivers/watchdog/renesas_wdt.c
> @@ -121,7 +121,8 @@ static int rwdt_restart(struct watchdog_device *wdev, unsigned long action,
>  }
>  
>  static const struct watchdog_info rwdt_ident = {
> -	.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
> +	.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
> +		WDIOF_CARDRESET,
>  	.identity = "Renesas WDT Watchdog",
>  };
>  
> @@ -197,9 +198,10 @@ static int rwdt_probe(struct platform_device *pdev)
>  		return PTR_ERR(clk);
>  
>  	pm_runtime_enable(&pdev->dev);
> -
>  	pm_runtime_get_sync(&pdev->dev);
>  	priv->clk_rate = clk_get_rate(clk);
> +	priv->wdev.bootstatus = (readb_relaxed(priv->base + RWTCSRA) &
> +				RWTCSRA_WOVF) ? WDIOF_CARDRESET : 0;
>  	pm_runtime_put(&pdev->dev);
>  
>  	if (!priv->clk_rate) {
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
  2018-03-20 21:36 [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET Wolfram Sang
  2018-03-20 21:59 ` Guenter Roeck
@ 2018-03-20 23:40 ` Vladimir Zapolskiy
  2018-03-21  8:12   ` Wolfram Sang
  2018-03-21  8:24 ` Geert Uytterhoeven
  2 siblings, 1 reply; 6+ messages in thread
From: Vladimir Zapolskiy @ 2018-03-20 23:40 UTC (permalink / raw)
  To: Wolfram Sang, linux-watchdog
  Cc: linux-renesas-soc, Fabrizio Castro, Veeraiyan Chidambaram,
	Takeshi Kihara

Hi Wolfram,

On 03/20/2018 11:36 PM, Wolfram Sang wrote:
> From: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
> 
> This patch adds the WDIOF_CARDRESET support for the Renessas platform

typo, s/Renessas/Renesas/

> watchdog, to know if the board reboot is due to a watchdog reset.
> 
> This is done via the WOVF bit (bit 4) of the RWTCSRA register, which
> indicates if RWTCNT overflowed, triggering the reset in last boot.
> 
> Signed-off-by: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
> [takeshi.kihara.df: changed to read the RWTCSRA register while clock is
>  enabled]
> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>

--
With best wishes,
Vladimir

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

* Re: [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
  2018-03-20 23:40 ` Vladimir Zapolskiy
@ 2018-03-21  8:12   ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2018-03-21  8:12 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Wolfram Sang, linux-watchdog, linux-renesas-soc, Fabrizio Castro,
	Veeraiyan Chidambaram, Takeshi Kihara

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

On Wed, Mar 21, 2018 at 01:40:55AM +0200, Vladimir Zapolskiy wrote:
> Hi Wolfram,
> 
> On 03/20/2018 11:36 PM, Wolfram Sang wrote:
> > From: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
> > 
> > This patch adds the WDIOF_CARDRESET support for the Renessas platform
> 
> typo, s/Renessas/Renesas/

Ooops, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
  2018-03-20 21:36 [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET Wolfram Sang
  2018-03-20 21:59 ` Guenter Roeck
  2018-03-20 23:40 ` Vladimir Zapolskiy
@ 2018-03-21  8:24 ` Geert Uytterhoeven
  2 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2018-03-21  8:24 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Linux Watchdog Mailing List, Linux-Renesas, Fabrizio Castro,
	Veeraiyan Chidambaram, Takeshi Kihara

On Tue, Mar 20, 2018 at 10:36 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> From: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
>
> This patch adds the WDIOF_CARDRESET support for the Renessas platform
> watchdog, to know if the board reboot is due to a watchdog reset.
>
> This is done via the WOVF bit (bit 4) of the RWTCSRA register, which
> indicates if RWTCNT overflowed, triggering the reset in last boot.
>
> Signed-off-by: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
> [takeshi.kihara.df: changed to read the RWTCSRA register while clock is
>  enabled]
> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.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] 6+ messages in thread

* Re: [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
  2018-03-20 21:59 ` Guenter Roeck
@ 2018-04-13 14:18   ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2018-04-13 14:18 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wolfram Sang, linux-watchdog, linux-renesas-soc, Fabrizio Castro,
	Veeraiyan Chidambaram, Takeshi Kihara

[-- Attachment #1: Type: text/plain, Size: 129 bytes --]


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

Guenter, how about a keyboard macro to avoid such typos? ;)
Fixed it in v2.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-04-13 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20 21:36 [PATCH] watchdog: renesas-wdt: Add support for WDIOF_CARDRESET Wolfram Sang
2018-03-20 21:59 ` Guenter Roeck
2018-04-13 14:18   ` Wolfram Sang
2018-03-20 23:40 ` Vladimir Zapolskiy
2018-03-21  8:12   ` Wolfram Sang
2018-03-21  8:24 ` 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.