]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
watchdog: sp805: add 'timeout-sec' DT property support
authorRay Jui <ray.jui@broadcom.com>
Mon, 28 May 2018 18:01:34 +0000 (11:01 -0700)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Thu, 2 Aug 2018 13:57:10 +0000 (15:57 +0200)
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>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/sp805_wdt.c

index 9849db0743a75cd5739294eb71fa2af1aedb467c..b240195597c1f99c996dda4e39851a62e5f33a5b 100644 (file)
@@ -244,7 +244,14 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
        watchdog_set_nowayout(&wdt->wdd, nowayout);
        watchdog_set_drvdata(&wdt->wdd, wdt);
        watchdog_set_restart_priority(&wdt->wdd, 128);
-       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) {