diff options
author | Jonas Jensen <jonas.jensen@gmail.com> | 2013-12-18 10:18:03 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2014-01-28 15:27:32 -0500 |
commit | 8773926d7135bb2d4e933272cd4c0c3aa5c4a088 (patch) | |
tree | f8a6581167ad86b31405216436968ec8e3408302 | |
parent | d5cfaf0a8554ad6b0e74955c7217ed24b2cadc9b (diff) |
watchdog: mach-moxart: add restart handler
mach-moxart lacks a separate register for reset; as a workaround,
add a function that can be hooked to arm_pm_restart.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/moxart_wdt.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/watchdog/moxart_wdt.c b/drivers/watchdog/moxart_wdt.c index 4166e4d116a8..4aa3a8a876fe 100644 --- a/drivers/watchdog/moxart_wdt.c +++ b/drivers/watchdog/moxart_wdt.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/watchdog.h> | 19 | #include <linux/watchdog.h> |
20 | #include <linux/moduleparam.h> | 20 | #include <linux/moduleparam.h> |
21 | 21 | ||
22 | #include <asm/system_misc.h> | ||
23 | |||
22 | #define REG_COUNT 0x4 | 24 | #define REG_COUNT 0x4 |
23 | #define REG_MODE 0x8 | 25 | #define REG_MODE 0x8 |
24 | #define REG_ENABLE 0xC | 26 | #define REG_ENABLE 0xC |
@@ -29,8 +31,17 @@ struct moxart_wdt_dev { | |||
29 | unsigned int clock_frequency; | 31 | unsigned int clock_frequency; |
30 | }; | 32 | }; |
31 | 33 | ||
34 | static struct moxart_wdt_dev *moxart_restart_ctx; | ||
35 | |||
32 | static int heartbeat; | 36 | static int heartbeat; |
33 | 37 | ||
38 | static void moxart_wdt_restart(enum reboot_mode reboot_mode, const char *cmd) | ||
39 | { | ||
40 | writel(1, moxart_restart_ctx->base + REG_COUNT); | ||
41 | writel(0x5ab9, moxart_restart_ctx->base + REG_MODE); | ||
42 | writel(0x03, moxart_restart_ctx->base + REG_ENABLE); | ||
43 | } | ||
44 | |||
34 | static int moxart_wdt_stop(struct watchdog_device *wdt_dev) | 45 | static int moxart_wdt_stop(struct watchdog_device *wdt_dev) |
35 | { | 46 | { |
36 | struct moxart_wdt_dev *moxart_wdt = watchdog_get_drvdata(wdt_dev); | 47 | struct moxart_wdt_dev *moxart_wdt = watchdog_get_drvdata(wdt_dev); |
@@ -125,6 +136,9 @@ static int moxart_wdt_probe(struct platform_device *pdev) | |||
125 | if (err) | 136 | if (err) |
126 | return err; | 137 | return err; |
127 | 138 | ||
139 | moxart_restart_ctx = moxart_wdt; | ||
140 | arm_pm_restart = moxart_wdt_restart; | ||
141 | |||
128 | dev_dbg(dev, "Watchdog enabled (heartbeat=%d sec, nowayout=%d)\n", | 142 | dev_dbg(dev, "Watchdog enabled (heartbeat=%d sec, nowayout=%d)\n", |
129 | moxart_wdt->dev.timeout, nowayout); | 143 | moxart_wdt->dev.timeout, nowayout); |
130 | 144 | ||
@@ -135,6 +149,7 @@ static int moxart_wdt_remove(struct platform_device *pdev) | |||
135 | { | 149 | { |
136 | struct moxart_wdt_dev *moxart_wdt = platform_get_drvdata(pdev); | 150 | struct moxart_wdt_dev *moxart_wdt = platform_get_drvdata(pdev); |
137 | 151 | ||
152 | arm_pm_restart = NULL; | ||
138 | moxart_wdt_stop(&moxart_wdt->dev); | 153 | moxart_wdt_stop(&moxart_wdt->dev); |
139 | watchdog_unregister_device(&moxart_wdt->dev); | 154 | watchdog_unregister_device(&moxart_wdt->dev); |
140 | 155 | ||