diff options
author | Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com> | 2018-04-13 10:19:24 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2018-04-16 04:22:40 -0400 |
commit | fdac6a90d2d151abdbb7e5ec14bb9ab64e2931ec (patch) | |
tree | 2d1d3324a46d138c0d628d5c940894a13a6b5b09 | |
parent | e30d69df78fb2667dc58e906cabd0f70ed0af95d (diff) |
watchdog: renesas-wdt: Add support for WDIOF_CARDRESET
This patch adds the WDIOF_CARDRESET support for the Renesas 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: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/renesas_wdt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 6b8c6ddfe30b..514db5cc1595 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, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | static const struct watchdog_info rwdt_ident = { | 123 | static const struct watchdog_info rwdt_ident = { |
124 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, | 124 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | |
125 | WDIOF_CARDRESET, | ||
125 | .identity = "Renesas WDT Watchdog", | 126 | .identity = "Renesas WDT Watchdog", |
126 | }; | 127 | }; |
127 | 128 | ||
@@ -197,9 +198,10 @@ static int rwdt_probe(struct platform_device *pdev) | |||
197 | return PTR_ERR(clk); | 198 | return PTR_ERR(clk); |
198 | 199 | ||
199 | pm_runtime_enable(&pdev->dev); | 200 | pm_runtime_enable(&pdev->dev); |
200 | |||
201 | pm_runtime_get_sync(&pdev->dev); | 201 | pm_runtime_get_sync(&pdev->dev); |
202 | priv->clk_rate = clk_get_rate(clk); | 202 | priv->clk_rate = clk_get_rate(clk); |
203 | priv->wdev.bootstatus = (readb_relaxed(priv->base + RWTCSRA) & | ||
204 | RWTCSRA_WOVF) ? WDIOF_CARDRESET : 0; | ||
203 | pm_runtime_put(&pdev->dev); | 205 | pm_runtime_put(&pdev->dev); |
204 | 206 | ||
205 | if (!priv->clk_rate) { | 207 | if (!priv->clk_rate) { |