diff options
| author | Fabio Porcedda <fabio.porcedda@gmail.com> | 2013-02-14 03:14:25 -0500 |
|---|---|---|
| committer | Wim Van Sebroeck <wim@iguana.be> | 2013-03-01 06:53:45 -0500 |
| commit | c1fd5f6402050b2463d0610b94f050fedf1b5019 (patch) | |
| tree | 7ff33e78c2a4f40b3465d163c03382db0d4d500f | |
| parent | 490ac7af8b71069ba0c733052c5f448ac070c947 (diff) | |
watchdog: add timeout-sec property binding
this patchset add the timeout-sec property to the following drivers:
orion_wdt, pnx4008_wdt, s3c2410_wdt and at91sam9_wdt.
The at91sam9_wdt is tested on evk-pr3,
the other drivers are compile tested only.
Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Masanari Iida <standby24x7@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Andrew Victor <linux@maxim.org.za>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
| -rw-r--r-- | Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 4 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/watchdog/marvel.txt | 5 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt | 4 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/watchdog/samsung-wdt.txt | 3 | ||||
| -rw-r--r-- | drivers/watchdog/at91sam9_wdt.c | 7 | ||||
| -rw-r--r-- | drivers/watchdog/orion_wdt.c | 10 | ||||
| -rw-r--r-- | drivers/watchdog/pnx4008_wdt.c | 7 | ||||
| -rw-r--r-- | drivers/watchdog/s3c2410_wdt.c | 6 |
8 files changed, 31 insertions, 15 deletions
diff --git a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt index 2957ebb5aa71..fcdd48f7dcff 100644 --- a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | |||
| @@ -7,9 +7,13 @@ Required properties: | |||
| 7 | - reg: physical base address of the controller and length of memory mapped | 7 | - reg: physical base address of the controller and length of memory mapped |
| 8 | region. | 8 | region. |
| 9 | 9 | ||
| 10 | Optional properties: | ||
| 11 | - timeout-sec: contains the watchdog timeout in seconds. | ||
| 12 | |||
| 10 | Example: | 13 | Example: |
| 11 | 14 | ||
| 12 | watchdog@fffffd40 { | 15 | watchdog@fffffd40 { |
| 13 | compatible = "atmel,at91sam9260-wdt"; | 16 | compatible = "atmel,at91sam9260-wdt"; |
| 14 | reg = <0xfffffd40 0x10>; | 17 | reg = <0xfffffd40 0x10>; |
| 18 | timeout-sec = <10>; | ||
| 15 | }; | 19 | }; |
diff --git a/Documentation/devicetree/bindings/watchdog/marvel.txt b/Documentation/devicetree/bindings/watchdog/marvel.txt index 0b2503ab0a05..5dc8d30061ce 100644 --- a/Documentation/devicetree/bindings/watchdog/marvel.txt +++ b/Documentation/devicetree/bindings/watchdog/marvel.txt | |||
| @@ -5,10 +5,15 @@ Required Properties: | |||
| 5 | - Compatibility : "marvell,orion-wdt" | 5 | - Compatibility : "marvell,orion-wdt" |
| 6 | - reg : Address of the timer registers | 6 | - reg : Address of the timer registers |
| 7 | 7 | ||
| 8 | Optional properties: | ||
| 9 | |||
| 10 | - timeout-sec : Contains the watchdog timeout in seconds | ||
| 11 | |||
| 8 | Example: | 12 | Example: |
| 9 | 13 | ||
| 10 | wdt@20300 { | 14 | wdt@20300 { |
| 11 | compatible = "marvell,orion-wdt"; | 15 | compatible = "marvell,orion-wdt"; |
| 12 | reg = <0x20300 0x28>; | 16 | reg = <0x20300 0x28>; |
| 17 | timeout-sec = <10>; | ||
| 13 | status = "okay"; | 18 | status = "okay"; |
| 14 | }; | 19 | }; |
diff --git a/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt b/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt index 7c7f6887c796..556d06c17c92 100644 --- a/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt | |||
| @@ -5,9 +5,13 @@ Required properties: | |||
| 5 | - reg: physical base address of the controller and length of memory mapped | 5 | - reg: physical base address of the controller and length of memory mapped |
| 6 | region. | 6 | region. |
| 7 | 7 | ||
| 8 | Optional properties: | ||
| 9 | - timeout-sec: contains the watchdog timeout in seconds. | ||
| 10 | |||
| 8 | Example: | 11 | Example: |
| 9 | 12 | ||
| 10 | watchdog@4003C000 { | 13 | watchdog@4003C000 { |
| 11 | compatible = "nxp,pnx4008-wdt"; | 14 | compatible = "nxp,pnx4008-wdt"; |
| 12 | reg = <0x4003C000 0x1000>; | 15 | reg = <0x4003C000 0x1000>; |
| 16 | timeout-sec = <10>; | ||
| 13 | }; | 17 | }; |
diff --git a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt index ce0d8e78ed8f..2aa486cc1ff6 100644 --- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt | |||
| @@ -9,3 +9,6 @@ Required properties: | |||
| 9 | - reg : base physical address of the controller and length of memory mapped | 9 | - reg : base physical address of the controller and length of memory mapped |
| 10 | region. | 10 | region. |
| 11 | - interrupts : interrupt number to the cpu. | 11 | - interrupts : interrupt number to the cpu. |
| 12 | |||
| 13 | Optional properties: | ||
| 14 | - timeout-sec : contains the watchdog timeout in seconds. | ||
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 8038b20284ce..be37dde4f864 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | 56 | ||
| 57 | /* User land timeout */ | 57 | /* User land timeout */ |
| 58 | #define WDT_HEARTBEAT 15 | 58 | #define WDT_HEARTBEAT 15 |
| 59 | static int heartbeat = WDT_HEARTBEAT; | 59 | static int heartbeat; |
| 60 | module_param(heartbeat, int, 0); | 60 | module_param(heartbeat, int, 0); |
| 61 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " | 61 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " |
| 62 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); | 62 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); |
| @@ -176,6 +176,7 @@ static const struct watchdog_ops at91_wdt_ops = { | |||
| 176 | static struct watchdog_device at91_wdt_dev = { | 176 | static struct watchdog_device at91_wdt_dev = { |
| 177 | .info = &at91_wdt_info, | 177 | .info = &at91_wdt_info, |
| 178 | .ops = &at91_wdt_ops, | 178 | .ops = &at91_wdt_ops, |
| 179 | .timeout = WDT_HEARTBEAT, | ||
| 179 | .min_timeout = 1, | 180 | .min_timeout = 1, |
| 180 | .max_timeout = 0xFFFF, | 181 | .max_timeout = 0xFFFF, |
| 181 | }; | 182 | }; |
| @@ -194,8 +195,8 @@ static int __init at91wdt_probe(struct platform_device *pdev) | |||
| 194 | return -ENOMEM; | 195 | return -ENOMEM; |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 197 | at91_wdt_dev.timeout = heartbeat; | ||
| 198 | at91_wdt_dev.parent = &pdev->dev; | 198 | at91_wdt_dev.parent = &pdev->dev; |
| 199 | watchdog_init_timeout(&at91_wdt_dev, heartbeat, &pdev->dev); | ||
| 199 | watchdog_set_nowayout(&at91_wdt_dev, nowayout); | 200 | watchdog_set_nowayout(&at91_wdt_dev, nowayout); |
| 200 | 201 | ||
| 201 | /* Set watchdog */ | 202 | /* Set watchdog */ |
| @@ -212,7 +213,7 @@ static int __init at91wdt_probe(struct platform_device *pdev) | |||
| 212 | mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT); | 213 | mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT); |
| 213 | 214 | ||
| 214 | pr_info("enabled (heartbeat=%d sec, nowayout=%d)\n", | 215 | pr_info("enabled (heartbeat=%d sec, nowayout=%d)\n", |
| 215 | heartbeat, nowayout); | 216 | at91_wdt_dev.timeout, nowayout); |
| 216 | 217 | ||
| 217 | return 0; | 218 | return 0; |
| 218 | } | 219 | } |
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 87ed2b9886a3..da577980d390 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
| @@ -140,6 +140,7 @@ static const struct watchdog_ops orion_wdt_ops = { | |||
| 140 | static struct watchdog_device orion_wdt = { | 140 | static struct watchdog_device orion_wdt = { |
| 141 | .info = &orion_wdt_info, | 141 | .info = &orion_wdt_info, |
| 142 | .ops = &orion_wdt_ops, | 142 | .ops = &orion_wdt_ops, |
| 143 | .min_timeout = 1, | ||
| 143 | }; | 144 | }; |
| 144 | 145 | ||
| 145 | static int orion_wdt_probe(struct platform_device *pdev) | 146 | static int orion_wdt_probe(struct platform_device *pdev) |
| @@ -164,12 +165,9 @@ static int orion_wdt_probe(struct platform_device *pdev) | |||
| 164 | 165 | ||
| 165 | wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk; | 166 | wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk; |
| 166 | 167 | ||
| 167 | if ((heartbeat < 1) || (heartbeat > wdt_max_duration)) | 168 | orion_wdt.timeout = wdt_max_duration; |
| 168 | heartbeat = wdt_max_duration; | ||
| 169 | |||
| 170 | orion_wdt.timeout = heartbeat; | ||
| 171 | orion_wdt.min_timeout = 1; | ||
| 172 | orion_wdt.max_timeout = wdt_max_duration; | 169 | orion_wdt.max_timeout = wdt_max_duration; |
| 170 | watchdog_init_timeout(&orion_wdt, heartbeat, &pdev->dev); | ||
| 173 | 171 | ||
| 174 | watchdog_set_nowayout(&orion_wdt, nowayout); | 172 | watchdog_set_nowayout(&orion_wdt, nowayout); |
| 175 | ret = watchdog_register_device(&orion_wdt); | 173 | ret = watchdog_register_device(&orion_wdt); |
| @@ -179,7 +177,7 @@ static int orion_wdt_probe(struct platform_device *pdev) | |||
| 179 | } | 177 | } |
| 180 | 178 | ||
| 181 | pr_info("Initial timeout %d sec%s\n", | 179 | pr_info("Initial timeout %d sec%s\n", |
| 182 | heartbeat, nowayout ? ", nowayout" : ""); | 180 | orion_wdt.timeout, nowayout ? ", nowayout" : ""); |
| 183 | return 0; | 181 | return 0; |
| 184 | } | 182 | } |
| 185 | 183 | ||
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index de1f3fa1d787..a3684a30eb69 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
| @@ -142,6 +142,7 @@ static const struct watchdog_ops pnx4008_wdt_ops = { | |||
| 142 | static struct watchdog_device pnx4008_wdd = { | 142 | static struct watchdog_device pnx4008_wdd = { |
| 143 | .info = &pnx4008_wdt_ident, | 143 | .info = &pnx4008_wdt_ident, |
| 144 | .ops = &pnx4008_wdt_ops, | 144 | .ops = &pnx4008_wdt_ops, |
| 145 | .timeout = DEFAULT_HEARTBEAT, | ||
| 145 | .min_timeout = 1, | 146 | .min_timeout = 1, |
| 146 | .max_timeout = MAX_HEARTBEAT, | 147 | .max_timeout = MAX_HEARTBEAT, |
| 147 | }; | 148 | }; |
| @@ -151,8 +152,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev) | |||
| 151 | struct resource *r; | 152 | struct resource *r; |
| 152 | int ret = 0; | 153 | int ret = 0; |
| 153 | 154 | ||
| 154 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | 155 | watchdog_init_timeout(&pnx4008_wdd, heartbeat, &pdev->dev); |
| 155 | heartbeat = DEFAULT_HEARTBEAT; | ||
| 156 | 156 | ||
| 157 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 157 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 158 | wdt_base = devm_ioremap_resource(&pdev->dev, r); | 158 | wdt_base = devm_ioremap_resource(&pdev->dev, r); |
| @@ -167,7 +167,6 @@ static int pnx4008_wdt_probe(struct platform_device *pdev) | |||
| 167 | if (ret) | 167 | if (ret) |
| 168 | goto out; | 168 | goto out; |
| 169 | 169 | ||
| 170 | pnx4008_wdd.timeout = heartbeat; | ||
| 171 | pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? | 170 | pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? |
| 172 | WDIOF_CARDRESET : 0; | 171 | WDIOF_CARDRESET : 0; |
| 173 | watchdog_set_nowayout(&pnx4008_wdd, nowayout); | 172 | watchdog_set_nowayout(&pnx4008_wdd, nowayout); |
| @@ -181,7 +180,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev) | |||
| 181 | } | 180 | } |
| 182 | 181 | ||
| 183 | dev_info(&pdev->dev, "PNX4008 Watchdog Timer: heartbeat %d sec\n", | 182 | dev_info(&pdev->dev, "PNX4008 Watchdog Timer: heartbeat %d sec\n", |
| 184 | heartbeat); | 183 | pnx4008_wdd.timeout); |
| 185 | 184 | ||
| 186 | return 0; | 185 | return 0; |
| 187 | 186 | ||
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 6419c61594fd..c1a221cbeae4 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | #define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) | 53 | #define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) |
| 54 | 54 | ||
| 55 | static bool nowayout = WATCHDOG_NOWAYOUT; | 55 | static bool nowayout = WATCHDOG_NOWAYOUT; |
| 56 | static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME; | 56 | static int tmr_margin; |
| 57 | static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT; | 57 | static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT; |
| 58 | static int soft_noboot; | 58 | static int soft_noboot; |
| 59 | static int debug; | 59 | static int debug; |
| @@ -226,6 +226,7 @@ static struct watchdog_ops s3c2410wdt_ops = { | |||
| 226 | static struct watchdog_device s3c2410_wdd = { | 226 | static struct watchdog_device s3c2410_wdd = { |
| 227 | .info = &s3c2410_wdt_ident, | 227 | .info = &s3c2410_wdt_ident, |
| 228 | .ops = &s3c2410wdt_ops, | 228 | .ops = &s3c2410wdt_ops, |
| 229 | .timeout = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME, | ||
| 229 | }; | 230 | }; |
| 230 | 231 | ||
| 231 | /* interrupt handler code */ | 232 | /* interrupt handler code */ |
| @@ -356,7 +357,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
| 356 | /* see if we can actually set the requested timer margin, and if | 357 | /* see if we can actually set the requested timer margin, and if |
| 357 | * not, try the default value */ | 358 | * not, try the default value */ |
| 358 | 359 | ||
| 359 | if (s3c2410wdt_set_heartbeat(&s3c2410_wdd, tmr_margin)) { | 360 | watchdog_init_timeout(&s3c2410_wdd, tmr_margin, &pdev->dev); |
| 361 | if (s3c2410wdt_set_heartbeat(&s3c2410_wdd, s3c2410_wdd.timeout)) { | ||
| 360 | started = s3c2410wdt_set_heartbeat(&s3c2410_wdd, | 362 | started = s3c2410wdt_set_heartbeat(&s3c2410_wdd, |
| 361 | CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME); | 363 | CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME); |
| 362 | 364 | ||
