Commit 089bcaa8 authored by Fabrizio Castro's avatar Fabrizio Castro Committed by Wim Van Sebroeck

watchdog: renesas_wdt: Add restart handler

On iWave's boards iwg20d and iwg22d the only way to reboot the system is
by means of the watchdog.
This patch adds a restart handler to rwdt_ops, and also makes sure we
keep its priority to the lowest level, in order to not override other
more effective handlers.
Signed-off-by: default avatarFabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: default avatarRamesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 3fe95e6c
...@@ -110,6 +110,16 @@ static unsigned int rwdt_get_timeleft(struct watchdog_device *wdev) ...@@ -110,6 +110,16 @@ static unsigned int rwdt_get_timeleft(struct watchdog_device *wdev)
return DIV_BY_CLKS_PER_SEC(priv, 65536 - val); return DIV_BY_CLKS_PER_SEC(priv, 65536 - val);
} }
static int rwdt_restart(struct watchdog_device *wdev, unsigned long action,
void *data)
{
struct rwdt_priv *priv = watchdog_get_drvdata(wdev);
rwdt_start(wdev);
rwdt_write(priv, 0xffff, RWTCNT);
return 0;
}
static const struct watchdog_info rwdt_ident = { static const struct watchdog_info rwdt_ident = {
.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
.identity = "Renesas WDT Watchdog", .identity = "Renesas WDT Watchdog",
...@@ -121,6 +131,7 @@ static const struct watchdog_ops rwdt_ops = { ...@@ -121,6 +131,7 @@ static const struct watchdog_ops rwdt_ops = {
.stop = rwdt_stop, .stop = rwdt_stop,
.ping = rwdt_init_timeout, .ping = rwdt_init_timeout,
.get_timeleft = rwdt_get_timeleft, .get_timeleft = rwdt_get_timeleft,
.restart = rwdt_restart,
}; };
#if defined(CONFIG_ARCH_RCAR_GEN2) && defined(CONFIG_SMP) #if defined(CONFIG_ARCH_RCAR_GEN2) && defined(CONFIG_SMP)
...@@ -220,6 +231,7 @@ static int rwdt_probe(struct platform_device *pdev) ...@@ -220,6 +231,7 @@ static int rwdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
watchdog_set_drvdata(&priv->wdev, priv); watchdog_set_drvdata(&priv->wdev, priv);
watchdog_set_nowayout(&priv->wdev, nowayout); watchdog_set_nowayout(&priv->wdev, nowayout);
watchdog_set_restart_priority(&priv->wdev, 0);
/* This overrides the default timeout only if DT configuration was found */ /* This overrides the default timeout only if DT configuration was found */
ret = watchdog_init_timeout(&priv->wdev, 0, &pdev->dev); ret = watchdog_init_timeout(&priv->wdev, 0, &pdev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment