diff options
| -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 | ||
