diff options
-rw-r--r-- | drivers/char/watchdog/Kconfig | 11 | ||||
-rw-r--r-- | drivers/char/watchdog/at32ap700x_wdt.c | 18 |
2 files changed, 13 insertions, 16 deletions
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index 520afb8e5234..2f48ba329961 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -196,17 +196,6 @@ config AT32AP700X_WDT | |||
196 | Watchdog timer embedded into AT32AP700x devices. This will reboot | 196 | Watchdog timer embedded into AT32AP700x devices. This will reboot |
197 | your system when the timeout is reached. | 197 | your system when the timeout is reached. |
198 | 198 | ||
199 | config AT32AP700X_WDT_TIMEOUT | ||
200 | int "Timeout value for AT32AP700x watchdog" | ||
201 | depends on AT32AP700X_WDT | ||
202 | default "2" | ||
203 | range 1 2 | ||
204 | help | ||
205 | Sets the timeout value for the watchdog in AT32AP700x devices. | ||
206 | Limited by hardware to be 1 or 2 seconds. | ||
207 | |||
208 | Set to 2 seconds by default. | ||
209 | |||
210 | # X86 (i386 + ia64 + x86_64) Architecture | 199 | # X86 (i386 + ia64 + x86_64) Architecture |
211 | 200 | ||
212 | config ACQUIRE_WDT | 201 | config ACQUIRE_WDT |
diff --git a/drivers/char/watchdog/at32ap700x_wdt.c b/drivers/char/watchdog/at32ap700x_wdt.c index 8abe1c77ac1f..6e7c9588b1b9 100644 --- a/drivers/char/watchdog/at32ap700x_wdt.c +++ b/drivers/char/watchdog/at32ap700x_wdt.c | |||
@@ -20,8 +20,15 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | 21 | ||
22 | #define TIMEOUT_MIN 1 | 22 | #define TIMEOUT_MIN 1 |
23 | #define TIMEOUT_DEFAULT CONFIG_AT32AP700X_WDT_TIMEOUT | ||
24 | #define TIMEOUT_MAX 2 | 23 | #define TIMEOUT_MAX 2 |
24 | #define TIMEOUT_DEFAULT TIMEOUT_MAX | ||
25 | |||
26 | /* module parameters */ | ||
27 | static int timeout = TIMEOUT_DEFAULT; | ||
28 | module_param(timeout, int, 0); | ||
29 | MODULE_PARM_DESC(timeout, | ||
30 | "Timeout value. Limited to be 1 or 2 seconds. (default=" | ||
31 | __MODULE_STRING(TIMEOUT_DEFAULT) ")"); | ||
25 | 32 | ||
26 | /* Watchdog registers and write/read macro */ | 33 | /* Watchdog registers and write/read macro */ |
27 | #define WDT_CTRL 0x00 | 34 | #define WDT_CTRL 0x00 |
@@ -233,11 +240,11 @@ static int __init at32_wdt_probe(struct platform_device *pdev) | |||
233 | wdt->miscdev.name = "watchdog"; | 240 | wdt->miscdev.name = "watchdog"; |
234 | wdt->miscdev.fops = &at32_wdt_fops; | 241 | wdt->miscdev.fops = &at32_wdt_fops; |
235 | 242 | ||
236 | if (at32_wdt_settimeout(TIMEOUT_DEFAULT)) { | 243 | if (at32_wdt_settimeout(timeout)) { |
237 | at32_wdt_settimeout(TIMEOUT_MAX); | 244 | at32_wdt_settimeout(TIMEOUT_DEFAULT); |
238 | dev_dbg(&pdev->dev, | 245 | dev_dbg(&pdev->dev, |
239 | "default timeout invalid, set to %d sec.\n", | 246 | "default timeout invalid, set to %d sec.\n", |
240 | TIMEOUT_MAX); | 247 | TIMEOUT_DEFAULT); |
241 | } | 248 | } |
242 | 249 | ||
243 | ret = misc_register(&wdt->miscdev); | 250 | ret = misc_register(&wdt->miscdev); |
@@ -248,7 +255,8 @@ static int __init at32_wdt_probe(struct platform_device *pdev) | |||
248 | 255 | ||
249 | platform_set_drvdata(pdev, wdt); | 256 | platform_set_drvdata(pdev, wdt); |
250 | wdt->miscdev.parent = &pdev->dev; | 257 | wdt->miscdev.parent = &pdev->dev; |
251 | dev_info(&pdev->dev, "AT32AP700X WDT at 0x%p\n", wdt->regs); | 258 | dev_info(&pdev->dev, "AT32AP700X WDT at 0x%p, timeout %d sec\n", |
259 | wdt->regs, wdt->timeout); | ||
252 | 260 | ||
253 | return 0; | 261 | return 0; |
254 | 262 | ||