From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5 v2] watchdog: ftwdt010: Add restart support
Date: Mon, 16 Oct 2017 22:54:27 +0200 [thread overview]
Message-ID: <20171016205427.4297-5-linus.walleij@linaro.org> (raw)
In-Reply-To: <20171016205427.4297-1-linus.walleij@linaro.org>
This enables the Faraday FTWDT010 to restart the system,
if need be. Set the restart priority for the watchdog to
128.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Rebased, no changes.
---
drivers/watchdog/ftwdt010_wdt.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c
index 21c3ac7f557a..0be7c2db642d 100644
--- a/drivers/watchdog/ftwdt010_wdt.c
+++ b/drivers/watchdog/ftwdt010_wdt.c
@@ -56,6 +56,22 @@ struct ftwdt010_wdt *to_ftwdt010_wdt(struct watchdog_device *wdd)
return container_of(wdd, struct ftwdt010_wdt, wdd);
}
+static int ftwdt010_wdt_restart(struct watchdog_device *wdd,
+ unsigned long action, void *data)
+{
+ struct ftwdt010_wdt *gwdt = to_ftwdt010_wdt(wdd);
+ u32 enable;
+
+ writel(1, gwdt->base + FTWDT010_WDLOAD);
+ writel(WDRESTART_MAGIC, gwdt->base + FTWDT010_WDRESTART);
+ enable = WDCR_SYS_RST | WDCR_ENABLE;
+ if (gwdt->use_extclk)
+ enable |= WDCR_EXTCLK;
+ writel(enable, gwdt->base + FTWDT010_WDCR);
+
+ return 0;
+}
+
static int ftwdt010_wdt_start(struct watchdog_device *wdd)
{
struct ftwdt010_wdt *gwdt = to_ftwdt010_wdt(wdd);
@@ -118,6 +134,7 @@ static const struct watchdog_ops ftwdt010_wdt_ops = {
.stop = ftwdt010_wdt_stop,
.ping = ftwdt010_wdt_ping,
.set_timeout = ftwdt010_wdt_set_timeout,
+ .restart = ftwdt010_wdt_restart,
.owner = THIS_MODULE,
};
@@ -190,6 +207,7 @@ static int ftwdt010_wdt_probe(struct platform_device *pdev)
*/
gwdt->wdd.timeout = 13U;
watchdog_init_timeout(&gwdt->wdd, 0, dev);
+ watchdog_set_restart_priority(&gwdt->wdd, 128);
reg = readw(gwdt->base + FTWDT010_WDCR);
if (reg & WDCR_ENABLE) {
--
2.13.6
next prev parent reply other threads:[~2017-10-16 20:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 20:54 [PATCH 1/5 v2] watchdog: gemini/ftwdt010: rename DT bindings Linus Walleij
2017-10-16 20:54 ` [PATCH 2/5 v2] watchdog: gemini/ftwdt010: rename driver and symbols Linus Walleij
2017-10-22 17:18 ` [2/5,v2] " Guenter Roeck
2017-10-16 20:54 ` [PATCH 3/5 v2] watchdog: ftwdt010: Make interrupt optional Linus Walleij
2017-10-22 17:19 ` [3/5,v2] " Guenter Roeck
2017-10-16 20:54 ` [PATCH 4/5 v2] watchdog: ftwdt010: Add clock support Linus Walleij
2017-10-22 17:30 ` [4/5,v2] " Guenter Roeck
2017-10-16 20:54 ` Linus Walleij [this message]
2017-10-22 17:31 ` [5/5,v2] watchdog: ftwdt010: Add restart support Guenter Roeck
2017-10-22 17:11 ` [1/5,v2] watchdog: gemini/ftwdt010: rename DT bindings Guenter Roeck
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=20171016205427.4297-5-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).