From: Fabrizio Castro <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
To: Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
Michael Turquette
<mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Geert Uytterhoeven
<geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>,
Wolfram Sang
<wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>
Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Chris Paterson
<Chris.Paterson2-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>,
Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>,
Fabrizio Castro
<fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>,
Ramesh Shanmugasundaram
<ramesh.shanmugasundaram-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
Subject: [RFC v4 13/26] watchdog: renesas_wdt: Add restart handler
Date: Wed, 31 Jan 2018 18:24:17 +0000 [thread overview]
Message-ID: <1517423070-24236-14-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1517423070-24236-1-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
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 a medium level, in order to not override other more
effective handlers.
Signed-off-by: Fabrizio Castro <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
---
v3->v4:
* New patch spawn out from patch 12/16. The restart handler on Gen3 is
controversial, hopefully this patch will help finalizing the discussion.
drivers/watchdog/renesas_wdt.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
index 0a1a402..6d1c4b9 100644
--- a/drivers/watchdog/renesas_wdt.c
+++ b/drivers/watchdog/renesas_wdt.c
@@ -107,6 +107,24 @@ static unsigned int rwdt_get_timeleft(struct watchdog_device *wdev)
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);
+
+ pm_runtime_get_sync(wdev->parent);
+
+ rwdt_write(priv, 0x00, RWTCSRB);
+ rwdt_write(priv, 0x00, RWTCSRA);
+ rwdt_write(priv, 0xffff, RWTCNT);
+
+ while (readb_relaxed(priv->base + RWTCSRA) & RWTCSRA_WRFLG)
+ cpu_relax();
+
+ rwdt_write(priv, 0x80, RWTCSRA);
+ return 0;
+}
+
static const struct watchdog_info rwdt_ident = {
.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
.identity = "Renesas WDT Watchdog",
@@ -118,6 +136,7 @@ static const struct watchdog_ops rwdt_ops = {
.stop = rwdt_stop,
.ping = rwdt_init_timeout,
.get_timeleft = rwdt_get_timeleft,
+ .restart = rwdt_restart,
};
static int rwdt_probe(struct platform_device *pdev)
@@ -176,6 +195,7 @@ static int rwdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
watchdog_set_drvdata(&priv->wdev, priv);
watchdog_set_nowayout(&priv->wdev, nowayout);
+ watchdog_set_restart_priority(&priv->wdev, 128);
/* This overrides the default timeout only if DT configuration was found */
ret = watchdog_init_timeout(&priv->wdev, 0, &pdev->dev);
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-31 18:24 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 18:24 [RFC v4 00/26] Fix watchdog on Renesas R-Car Gen2 and RZ/G1 Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 01/26] ARM: shmobile: Add watchdog support Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 04/26] ARM: dts: r8a7790: Adjust SMP routine size Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 06/26] ARM: dts: r8a7792: " Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 08/26] ARM: dts: r8a7794: " Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 09/26] soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2 Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 15/26] clk: renesas: r8a7743: Add rwdt clock Fabrizio Castro
[not found] ` <1517423070-24236-16-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:12 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 17/26] clk: renesas: r8a7790: " Fabrizio Castro
2018-02-07 23:17 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 19/26] clk: renesas: r8a7794: " Fabrizio Castro
[not found] ` <1517423070-24236-20-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:17 ` Wolfram Sang
[not found] ` <1517423070-24236-1-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-31 18:24 ` [RFC v4 02/26] ARM: dts: r8a7743: Adjust SMP routine size Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 03/26] ARM: dts: r8a7745: " Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 05/26] ARM: dts: r8a7791: " Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 07/26] ARM: dts: r8a7793: " Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 10/26] ARM: shmobile: rcar-gen2: Add watchdog support Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 11/26] dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support Fabrizio Castro
2018-02-05 6:08 ` Rob Herring
[not found] ` <1517423070-24236-12-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:04 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 12/26] watchdog: renesas_wdt: " Fabrizio Castro
[not found] ` <1517423070-24236-13-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-02 2:56 ` Guenter Roeck
[not found] ` <2dd9f76d-b3e9-31f2-11eb-272d327f3b01-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2018-02-05 11:16 ` Fabrizio Castro
2018-02-07 22:53 ` Wolfram Sang
2018-02-12 10:31 ` Fabrizio Castro
2018-01-31 18:24 ` Fabrizio Castro [this message]
[not found] ` <1517423070-24236-14-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-02 2:58 ` [RFC v4 13/26] watchdog: renesas_wdt: Add restart handler Guenter Roeck
2018-02-07 15:46 ` Geert Uytterhoeven
2018-02-07 15:55 ` Fabrizio Castro
2018-02-07 23:03 ` Wolfram Sang
2018-02-12 10:33 ` Fabrizio Castro
2018-02-12 10:54 ` Wolfram Sang
2018-02-12 11:38 ` Fabrizio Castro
2018-01-31 18:24 ` [RFC v4 14/26] ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN Fabrizio Castro
[not found] ` <1517423070-24236-15-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:11 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 16/26] clk: renesas: r8a7745: Add rwdt clock Fabrizio Castro
[not found] ` <1517423070-24236-17-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:16 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 18/26] clk: renesas: r8a7791/r8a7793: " Fabrizio Castro
2018-02-07 23:17 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 20/26] ARM: dts: r8a7743: Add watchdog support to SoC dtsi Fabrizio Castro
[not found] ` <1517423070-24236-21-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:20 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 21/26] ARM: dts: r8a7745: " Fabrizio Castro
[not found] ` <1517423070-24236-22-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:20 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 22/26] ARM: dts: r8a7790: " Fabrizio Castro
2018-02-07 23:20 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 23/26] ARM: dts: r8a7791: " Fabrizio Castro
2018-02-07 23:20 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 26/26] ARM: dts: iwg22m: Add watchdog support to SoM dtsi Fabrizio Castro
2018-02-07 23:21 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 24/26] ARM: dts: r8a7794: Add watchdog support to SoC dtsi Fabrizio Castro
[not found] ` <1517423070-24236-25-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:20 ` Wolfram Sang
2018-01-31 18:24 ` [RFC v4 25/26] ARM: dts: iwg20m: Add watchdog support to SoM dtsi Fabrizio Castro
[not found] ` <1517423070-24236-26-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-02-07 23:21 ` Wolfram Sang
2018-02-06 15:44 ` [RFC v4 00/26] Fix watchdog on Renesas R-Car Gen2 and RZ/G1 Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1517423070-24236-14-git-send-email-fabrizio.castro@bp.renesas.com \
--to=fabrizio.castro-ktt6de0ptrh9uiusa/gsgq@public.gmane.org \
--cc=Chris.Paterson2-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org \
--cc=biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org \
--cc=horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=ramesh.shanmugasundaram-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
--cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org \
--cc=wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).