linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ray.jui@broadcom.com (Ray Jui)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/6] watchdog: sp805: add 'timeout-sec' DT property support
Date: Wed, 23 May 2018 17:15:21 -0700	[thread overview]
Message-ID: <1527120924-12131-4-git-send-email-ray.jui@broadcom.com> (raw)
In-Reply-To: <1527120924-12131-1-git-send-email-ray.jui@broadcom.com>

Add support for optional devicetree property 'timeout-sec'.
'timeout-sec' is used in the driver if specified in devicetree.
Otherwise, fall back to driver default, i.e., 60 seconds

Signed-off-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/sp805_wdt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 03805bc..1484609 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -230,7 +230,14 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
 	spin_lock_init(&wdt->lock);
 	watchdog_set_nowayout(&wdt->wdd, nowayout);
 	watchdog_set_drvdata(&wdt->wdd, wdt);
-	wdt_setload(&wdt->wdd, DEFAULT_TIMEOUT);
+
+	/*
+	 * If 'timeout-sec' devicetree property is specified, use that.
+	 * Otherwise, use DEFAULT_TIMEOUT
+	 */
+	wdt->wdd.timeout = DEFAULT_TIMEOUT;
+	watchdog_init_timeout(&wdt->wdd, 0, &adev->dev);
+	wdt_setload(&wdt->wdd, wdt->wdd.timeout);
 
 	ret = watchdog_register_device(&wdt->wdd);
 	if (ret) {
-- 
2.1.4

  parent reply	other threads:[~2018-05-24  0:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  0:15 [PATCH v3 0/6] Enhance support for the SP805 WDT Ray Jui
2018-05-24  0:15 ` [PATCH v3 1/6] Documentation: DT: Consolidate SP805 binding docs Ray Jui
2018-05-24  0:15 ` [PATCH v3 2/6] Documentation: DT: Add optional 'timeout-sec' property for sp805 Ray Jui
2018-05-24 16:16   ` Guenter Roeck
2018-05-24 16:42     ` Ray Jui
2018-05-24 17:12       ` Guenter Roeck
2018-05-24  0:15 ` Ray Jui [this message]
2018-05-24  0:15 ` [PATCH v3 4/6] watchdog: sp805: set WDOG_HW_RUNNING when appropriate Ray Jui
2018-05-24 16:19   ` Guenter Roeck
2018-05-24 16:36     ` Ray Jui
2018-05-24 17:11       ` Guenter Roeck
2018-05-24  0:15 ` [PATCH v3 5/6] arm64: dt: set initial SR watchdog timeout to 60 seconds Ray Jui
2018-05-24  0:15 ` [PATCH v3 6/6] arm64: defconfig: add CONFIG_ARM_SP805_WATCHDOG Ray Jui

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=1527120924-12131-4-git-send-email-ray.jui@broadcom.com \
    --to=ray.jui@broadcom.com \
    --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).