diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-24 17:47:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-24 17:47:24 -0500 |
commit | f828d5e2487d57699c1b9143619d03f71b164cda (patch) | |
tree | af1fa721109ad2af38b70c2b70bbf871d9561382 | |
parent | 0012125adee58a3865da7701583b7b1aee3b4ba8 (diff) | |
parent | 7a32757eda68a53626f003018733d09f94138334 (diff) |
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog fixes from Wim Van Sebroeck:
"This will fix reboot issues with the imx2_wdt driver and it also drops
some forgotten owner assignments from platform_drivers"
* git://www.linux-watchdog.org/linux-watchdog:
watchdog: drop owner assignment from platform_drivers
watchdog: imx2_wdt: Disable power down counter on boot
watchdog: imx2_wdt: Improve power management support.
-rw-r--r-- | drivers/watchdog/cadence_wdt.c | 1 | ||||
-rw-r--r-- | drivers/watchdog/imx2_wdt.c | 40 | ||||
-rw-r--r-- | drivers/watchdog/meson_wdt.c | 1 |
3 files changed, 31 insertions, 11 deletions
diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c index 5927c0a98a74..bcfd2a22208f 100644 --- a/drivers/watchdog/cadence_wdt.c +++ b/drivers/watchdog/cadence_wdt.c | |||
@@ -503,7 +503,6 @@ static struct platform_driver cdns_wdt_driver = { | |||
503 | .shutdown = cdns_wdt_shutdown, | 503 | .shutdown = cdns_wdt_shutdown, |
504 | .driver = { | 504 | .driver = { |
505 | .name = "cdns-wdt", | 505 | .name = "cdns-wdt", |
506 | .owner = THIS_MODULE, | ||
507 | .of_match_table = cdns_wdt_of_match, | 506 | .of_match_table = cdns_wdt_of_match, |
508 | .pm = &cdns_wdt_pm_ops, | 507 | .pm = &cdns_wdt_pm_ops, |
509 | }, | 508 | }, |
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index d6add516a7a7..5142bbabe027 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c | |||
@@ -52,6 +52,8 @@ | |||
52 | #define IMX2_WDT_WRSR 0x04 /* Reset Status Register */ | 52 | #define IMX2_WDT_WRSR 0x04 /* Reset Status Register */ |
53 | #define IMX2_WDT_WRSR_TOUT (1 << 1) /* -> Reset due to Timeout */ | 53 | #define IMX2_WDT_WRSR_TOUT (1 << 1) /* -> Reset due to Timeout */ |
54 | 54 | ||
55 | #define IMX2_WDT_WMCR 0x08 /* Misc Register */ | ||
56 | |||
55 | #define IMX2_WDT_MAX_TIME 128 | 57 | #define IMX2_WDT_MAX_TIME 128 |
56 | #define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */ | 58 | #define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */ |
57 | 59 | ||
@@ -274,6 +276,13 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) | |||
274 | 276 | ||
275 | imx2_wdt_ping_if_active(wdog); | 277 | imx2_wdt_ping_if_active(wdog); |
276 | 278 | ||
279 | /* | ||
280 | * Disable the watchdog power down counter at boot. Otherwise the power | ||
281 | * down counter will pull down the #WDOG interrupt line for one clock | ||
282 | * cycle. | ||
283 | */ | ||
284 | regmap_write(wdev->regmap, IMX2_WDT_WMCR, 0); | ||
285 | |||
277 | ret = watchdog_register_device(wdog); | 286 | ret = watchdog_register_device(wdog); |
278 | if (ret) { | 287 | if (ret) { |
279 | dev_err(&pdev->dev, "cannot register watchdog device\n"); | 288 | dev_err(&pdev->dev, "cannot register watchdog device\n"); |
@@ -327,18 +336,21 @@ static void imx2_wdt_shutdown(struct platform_device *pdev) | |||
327 | } | 336 | } |
328 | 337 | ||
329 | #ifdef CONFIG_PM_SLEEP | 338 | #ifdef CONFIG_PM_SLEEP |
330 | /* Disable watchdog if it is active during suspend */ | 339 | /* Disable watchdog if it is active or non-active but still running */ |
331 | static int imx2_wdt_suspend(struct device *dev) | 340 | static int imx2_wdt_suspend(struct device *dev) |
332 | { | 341 | { |
333 | struct watchdog_device *wdog = dev_get_drvdata(dev); | 342 | struct watchdog_device *wdog = dev_get_drvdata(dev); |
334 | struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); | 343 | struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); |
335 | 344 | ||
336 | imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); | 345 | /* The watchdog IP block is running */ |
337 | imx2_wdt_ping(wdog); | 346 | if (imx2_wdt_is_running(wdev)) { |
347 | imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); | ||
348 | imx2_wdt_ping(wdog); | ||
338 | 349 | ||
339 | /* Watchdog has been stopped but IP block is still running */ | 350 | /* The watchdog is not active */ |
340 | if (!watchdog_active(wdog) && imx2_wdt_is_running(wdev)) | 351 | if (!watchdog_active(wdog)) |
341 | del_timer_sync(&wdev->timer); | 352 | del_timer_sync(&wdev->timer); |
353 | } | ||
342 | 354 | ||
343 | clk_disable_unprepare(wdev->clk); | 355 | clk_disable_unprepare(wdev->clk); |
344 | 356 | ||
@@ -354,15 +366,25 @@ static int imx2_wdt_resume(struct device *dev) | |||
354 | clk_prepare_enable(wdev->clk); | 366 | clk_prepare_enable(wdev->clk); |
355 | 367 | ||
356 | if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { | 368 | if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { |
357 | /* Resumes from deep sleep we need restart | 369 | /* |
358 | * the watchdog again. | 370 | * If the watchdog is still active and resumes |
371 | * from deep sleep state, need to restart the | ||
372 | * watchdog again. | ||
359 | */ | 373 | */ |
360 | imx2_wdt_setup(wdog); | 374 | imx2_wdt_setup(wdog); |
361 | imx2_wdt_set_timeout(wdog, wdog->timeout); | 375 | imx2_wdt_set_timeout(wdog, wdog->timeout); |
362 | imx2_wdt_ping(wdog); | 376 | imx2_wdt_ping(wdog); |
363 | } else if (imx2_wdt_is_running(wdev)) { | 377 | } else if (imx2_wdt_is_running(wdev)) { |
378 | /* Resuming from non-deep sleep state. */ | ||
379 | imx2_wdt_set_timeout(wdog, wdog->timeout); | ||
364 | imx2_wdt_ping(wdog); | 380 | imx2_wdt_ping(wdog); |
365 | mod_timer(&wdev->timer, jiffies + wdog->timeout * HZ / 2); | 381 | /* |
382 | * But the watchdog is not active, then start | ||
383 | * the timer again. | ||
384 | */ | ||
385 | if (!watchdog_active(wdog)) | ||
386 | mod_timer(&wdev->timer, | ||
387 | jiffies + wdog->timeout * HZ / 2); | ||
366 | } | 388 | } |
367 | 389 | ||
368 | return 0; | 390 | return 0; |
diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c index ef6a298e8c45..1f4155ee3404 100644 --- a/drivers/watchdog/meson_wdt.c +++ b/drivers/watchdog/meson_wdt.c | |||
@@ -215,7 +215,6 @@ static struct platform_driver meson_wdt_driver = { | |||
215 | .remove = meson_wdt_remove, | 215 | .remove = meson_wdt_remove, |
216 | .shutdown = meson_wdt_shutdown, | 216 | .shutdown = meson_wdt_shutdown, |
217 | .driver = { | 217 | .driver = { |
218 | .owner = THIS_MODULE, | ||
219 | .name = DRV_NAME, | 218 | .name = DRV_NAME, |
220 | .of_match_table = meson_wdt_dt_ids, | 219 | .of_match_table = meson_wdt_dt_ids, |
221 | }, | 220 | }, |