devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>
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 22/37] watchdog: renesas_wdt: Add restart support
Date: Thu, 25 Jan 2018 18:02:56 +0000	[thread overview]
Message-ID: <1516903391-30467-23-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1516903391-30467-1-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>

This commit extends the driver to add restart support by implementing
the restart callback to trigger the watchdog as quickly as possible.

Signed-off-by: Fabrizio Castro <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
---
 drivers/watchdog/renesas_wdt.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
index 831ef83..120ddac 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)
-- 
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

  parent reply	other threads:[~2018-01-25 18:02 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 18:02 [RFC 00/37] Fix watchdog on Renesas R-Car Gen2 and RZ/G1 Fabrizio Castro
2018-01-25 18:02 ` [RFC 01/37] ARM: shmobile: Add watchdog support Fabrizio Castro
     [not found]   ` <1516903391-30467-2-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26  9:46     ` Geert Uytterhoeven
     [not found]       ` <CAMuHMdWVvMJR5NHMFn6zx39jw2XdP5nteU3actUcen0dmoT-LQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-26  9:49         ` Geert Uytterhoeven
2018-01-26 11:52         ` Fabrizio Castro
2018-01-26 12:10           ` Geert Uytterhoeven
2018-01-26 13:44             ` Fabrizio Castro
2018-01-26 16:08           ` [RFC v2 " Fabrizio Castro
2018-01-26 16:08             ` [RFC v2 23/37] ARM: shmobile: rcar-gen2: Export shmobile_set_wdt_clock_status function Fabrizio Castro
     [not found]             ` <1516982937-29245-1-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 16:16               ` [RFC v2 01/37] ARM: shmobile: Add watchdog support Fabrizio Castro
2018-01-25 18:02 ` [RFC 02/37] ARM: dts: r8a7743: Adjust SMP routine size Fabrizio Castro
     [not found]   ` <1516903391-30467-3-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26  9:52     ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 05/37] ARM: dts: r8a7791: " Fabrizio Castro
2018-01-26  9:53   ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 07/37] ARM: dts: r8a7793: " Fabrizio Castro
     [not found]   ` <1516903391-30467-8-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26  9:53     ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 08/37] ARM: dts: r8a7794: " Fabrizio Castro
2018-01-26  9:54   ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 09/37] soc: renesas: rcar-rst: Add generic compatible strings Fabrizio Castro
     [not found]   ` <1516903391-30467-10-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:00     ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 10/37] soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2 Fabrizio Castro
     [not found]   ` <1516903391-30467-11-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26  8:30     ` Sergei Shtylyov
     [not found]       ` <e1670c79-2fef-b45b-4688-a6ba8ebd8c24-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2018-01-26 16:59         ` Fabrizio Castro
2018-01-26 10:05     ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 12/37] ARM: dts: r8a7743: Use fallback rst compatible string Fabrizio Castro
2018-01-25 18:02 ` [RFC 15/37] ARM: dts: r8a7791: " Fabrizio Castro
2018-01-25 18:02 ` [RFC 20/37] arm64: dts: renesas: r8a77995: " Fabrizio Castro
2018-01-25 18:02 ` [RFC 21/37] dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support Fabrizio Castro
     [not found]   ` <1516903391-30467-22-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:10     ` Geert Uytterhoeven
     [not found] ` <1516903391-30467-1-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-25 18:02   ` [RFC 03/37] ARM: dts: r8a7745: Adjust SMP routine size Fabrizio Castro
2018-01-26  9:52     ` Geert Uytterhoeven
2018-01-25 18:02   ` [RFC 04/37] ARM: dts: r8a7790: " Fabrizio Castro
2018-01-26  9:53     ` Geert Uytterhoeven
2018-01-25 18:02   ` [RFC 06/37] ARM: dts: r8a7792: " Fabrizio Castro
2018-01-26  9:53     ` Geert Uytterhoeven
2018-01-25 18:02   ` [RFC 11/37] soc: renesas: rcar-rst: Document generic compatible strings Fabrizio Castro
2018-01-26 10:06     ` Geert Uytterhoeven
2018-01-25 18:02   ` [RFC 13/37] ARM: dts: r8a7745: Use fallback rst compatible string Fabrizio Castro
2018-01-25 18:02   ` [RFC 14/37] ARM: dts: r8a7790: " Fabrizio Castro
2018-01-25 18:02   ` [RFC 16/37] ARM: dts: r8a7794: " Fabrizio Castro
2018-01-25 18:02   ` [RFC 17/37] arm64: dts: renesas: r8a7795: " Fabrizio Castro
2018-01-25 18:02   ` [RFC 18/37] arm64: dts: renesas: r8a7796: " Fabrizio Castro
2018-01-25 18:02   ` [RFC 19/37] arm64: dts: renesas: r8a77970: " Fabrizio Castro
2018-01-25 18:02   ` Fabrizio Castro [this message]
2018-01-26 10:11     ` [RFC 22/37] watchdog: renesas_wdt: Add restart support Geert Uytterhoeven
2018-01-26 17:14     ` Guenter Roeck
2018-01-26 17:50       ` Fabrizio Castro
2018-01-25 18:02   ` [RFC 23/37] ARM: shmobile: rcar-gen2: Export shmobile_set_wdt_clock_status function Fabrizio Castro
     [not found]     ` <1516903391-30467-24-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:16       ` Geert Uytterhoeven
2018-01-25 18:03   ` [RFC 29/37] clk: renesas: r8a7791/r8a7793: Add rwdt clock Fabrizio Castro
     [not found]     ` <1516903391-30467-30-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:25       ` Geert Uytterhoeven
2018-01-25 18:03   ` [RFC 33/37] ARM: dts: r8a7790: Add watchdog support to SoC dtsi Fabrizio Castro
2018-01-26 10:30     ` Geert Uytterhoeven
2018-01-25 18:03   ` [RFC 35/37] ARM: dts: r8a7794: " Fabrizio Castro
     [not found]     ` <1516903391-30467-36-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:31       ` Geert Uytterhoeven
2018-01-25 18:03   ` [RFC 37/37] ARM: dts: iwg22m: Add watchdog support to SoM dtsi Fabrizio Castro
     [not found]     ` <1516903391-30467-38-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:32       ` Geert Uytterhoeven
2018-01-25 18:02 ` [RFC 24/37] watchdog: renesas_wdt_gen2: Add Gen2 specific driver Fabrizio Castro
2018-01-26 10:22   ` Geert Uytterhoeven
     [not found]   ` <1516903391-30467-25-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 17:28     ` Guenter Roeck
     [not found]       ` <20180126172835.GB16194-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2018-01-26 18:00         ` Fabrizio Castro
2018-01-25 18:02 ` [RFC 25/37] ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN2 Fabrizio Castro
2018-01-25 18:03 ` [RFC 26/37] clk: renesas: r8a7743: Add rwdt clock Fabrizio Castro
2018-01-26 10:33   ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 27/37] clk: renesas: r8a7745: " Fabrizio Castro
2018-01-26 10:24   ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 28/37] clk: renesas: r8a7790: " Fabrizio Castro
     [not found]   ` <1516903391-30467-29-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:25     ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 30/37] clk: renesas: r8a7794: " Fabrizio Castro
     [not found]   ` <1516903391-30467-31-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:25     ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 31/37] ARM: dts: r8a7743: Add watchdog support to SoC dtsi Fabrizio Castro
2018-01-26 10:27   ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 32/37] ARM: dts: r8a7745: " Fabrizio Castro
2018-01-26 10:28   ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 34/37] ARM: dts: r8a7791: " Fabrizio Castro
     [not found]   ` <1516903391-30467-35-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:30     ` Geert Uytterhoeven
2018-01-25 18:03 ` [RFC 36/37] ARM: dts: iwg20m: Add watchdog support to SoM dtsi Fabrizio Castro
     [not found]   ` <1516903391-30467-37-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
2018-01-26 10:32     ` 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=1516903391-30467-23-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 \
    /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).