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>
This commit is contained in:
parent
d5cfaf0a85
commit
8773926d71
|
@ -19,6 +19,8 @@
|
||||||
#include <linux/watchdog.h>
|
#include <linux/watchdog.h>
|
||||||
#include <linux/moduleparam.h>
|
#include <linux/moduleparam.h>
|
||||||
|
|
||||||
|
#include <asm/system_misc.h>
|
||||||
|
|
||||||
#define REG_COUNT 0x4
|
#define REG_COUNT 0x4
|
||||||
#define REG_MODE 0x8
|
#define REG_MODE 0x8
|
||||||
#define REG_ENABLE 0xC
|
#define REG_ENABLE 0xC
|
||||||
|
@ -29,8 +31,17 @@ struct moxart_wdt_dev {
|
||||||
unsigned int clock_frequency;
|
unsigned int clock_frequency;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct moxart_wdt_dev *moxart_restart_ctx;
|
||||||
|
|
||||||
static int heartbeat;
|
static int heartbeat;
|
||||||
|
|
||||||
|
static void moxart_wdt_restart(enum reboot_mode reboot_mode, const char *cmd)
|
||||||
|
{
|
||||||
|
writel(1, moxart_restart_ctx->base + REG_COUNT);
|
||||||
|
writel(0x5ab9, moxart_restart_ctx->base + REG_MODE);
|
||||||
|
writel(0x03, moxart_restart_ctx->base + REG_ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
static int moxart_wdt_stop(struct watchdog_device *wdt_dev)
|
static int moxart_wdt_stop(struct watchdog_device *wdt_dev)
|
||||||
{
|
{
|
||||||
struct moxart_wdt_dev *moxart_wdt = watchdog_get_drvdata(wdt_dev);
|
struct moxart_wdt_dev *moxart_wdt = watchdog_get_drvdata(wdt_dev);
|
||||||
|
@ -125,6 +136,9 @@ static int moxart_wdt_probe(struct platform_device *pdev)
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
moxart_restart_ctx = moxart_wdt;
|
||||||
|
arm_pm_restart = moxart_wdt_restart;
|
||||||
|
|
||||||
dev_dbg(dev, "Watchdog enabled (heartbeat=%d sec, nowayout=%d)\n",
|
dev_dbg(dev, "Watchdog enabled (heartbeat=%d sec, nowayout=%d)\n",
|
||||||
moxart_wdt->dev.timeout, nowayout);
|
moxart_wdt->dev.timeout, nowayout);
|
||||||
|
|
||||||
|
@ -135,6 +149,7 @@ static int moxart_wdt_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct moxart_wdt_dev *moxart_wdt = platform_get_drvdata(pdev);
|
struct moxart_wdt_dev *moxart_wdt = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
arm_pm_restart = NULL;
|
||||||
moxart_wdt_stop(&moxart_wdt->dev);
|
moxart_wdt_stop(&moxart_wdt->dev);
|
||||||
watchdog_unregister_device(&moxart_wdt->dev);
|
watchdog_unregister_device(&moxart_wdt->dev);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue