|
@@ -17,7 +17,6 @@
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/platform_device.h>
|
|
-#include <linux/reboot.h>
|
|
|
|
#include <linux/watchdog.h>
|
|
#include <linux/watchdog.h>
|
|
|
|
|
|
#define WDT_RST 0x38
|
|
#define WDT_RST 0x38
|
|
@@ -28,7 +27,6 @@ struct qcom_wdt {
|
|
struct watchdog_device wdd;
|
|
struct watchdog_device wdd;
|
|
struct clk *clk;
|
|
struct clk *clk;
|
|
unsigned long rate;
|
|
unsigned long rate;
|
|
- struct notifier_block restart_nb;
|
|
|
|
void __iomem *base;
|
|
void __iomem *base;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -72,25 +70,9 @@ static int qcom_wdt_set_timeout(struct watchdog_device *wdd,
|
|
return qcom_wdt_start(wdd);
|
|
return qcom_wdt_start(wdd);
|
|
}
|
|
}
|
|
|
|
|
|
-static const struct watchdog_ops qcom_wdt_ops = {
|
|
|
|
- .start = qcom_wdt_start,
|
|
|
|
- .stop = qcom_wdt_stop,
|
|
|
|
- .ping = qcom_wdt_ping,
|
|
|
|
- .set_timeout = qcom_wdt_set_timeout,
|
|
|
|
- .owner = THIS_MODULE,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static const struct watchdog_info qcom_wdt_info = {
|
|
|
|
- .options = WDIOF_KEEPALIVEPING
|
|
|
|
- | WDIOF_MAGICCLOSE
|
|
|
|
- | WDIOF_SETTIMEOUT,
|
|
|
|
- .identity = KBUILD_MODNAME,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action,
|
|
|
|
- void *data)
|
|
|
|
|
|
+static int qcom_wdt_restart(struct watchdog_device *wdd)
|
|
{
|
|
{
|
|
- struct qcom_wdt *wdt = container_of(nb, struct qcom_wdt, restart_nb);
|
|
|
|
|
|
+ struct qcom_wdt *wdt = to_qcom_wdt(wdd);
|
|
u32 timeout;
|
|
u32 timeout;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -110,9 +92,25 @@ static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action,
|
|
wmb();
|
|
wmb();
|
|
|
|
|
|
msleep(150);
|
|
msleep(150);
|
|
- return NOTIFY_DONE;
|
|
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static const struct watchdog_ops qcom_wdt_ops = {
|
|
|
|
+ .start = qcom_wdt_start,
|
|
|
|
+ .stop = qcom_wdt_stop,
|
|
|
|
+ .ping = qcom_wdt_ping,
|
|
|
|
+ .set_timeout = qcom_wdt_set_timeout,
|
|
|
|
+ .restart = qcom_wdt_restart,
|
|
|
|
+ .owner = THIS_MODULE,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct watchdog_info qcom_wdt_info = {
|
|
|
|
+ .options = WDIOF_KEEPALIVEPING
|
|
|
|
+ | WDIOF_MAGICCLOSE
|
|
|
|
+ | WDIOF_SETTIMEOUT,
|
|
|
|
+ .identity = KBUILD_MODNAME,
|
|
|
|
+};
|
|
|
|
+
|
|
static int qcom_wdt_probe(struct platform_device *pdev)
|
|
static int qcom_wdt_probe(struct platform_device *pdev)
|
|
{
|
|
{
|
|
struct qcom_wdt *wdt;
|
|
struct qcom_wdt *wdt;
|
|
@@ -187,14 +185,6 @@ static int qcom_wdt_probe(struct platform_device *pdev)
|
|
goto err_clk_unprepare;
|
|
goto err_clk_unprepare;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * WDT restart notifier has priority 0 (use as a last resort)
|
|
|
|
- */
|
|
|
|
- wdt->restart_nb.notifier_call = qcom_wdt_restart;
|
|
|
|
- ret = register_restart_handler(&wdt->restart_nb);
|
|
|
|
- if (ret)
|
|
|
|
- dev_err(&pdev->dev, "failed to setup restart handler\n");
|
|
|
|
-
|
|
|
|
platform_set_drvdata(pdev, wdt);
|
|
platform_set_drvdata(pdev, wdt);
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -207,7 +197,6 @@ static int qcom_wdt_remove(struct platform_device *pdev)
|
|
{
|
|
{
|
|
struct qcom_wdt *wdt = platform_get_drvdata(pdev);
|
|
struct qcom_wdt *wdt = platform_get_drvdata(pdev);
|
|
|
|
|
|
- unregister_restart_handler(&wdt->restart_nb);
|
|
|
|
watchdog_unregister_device(&wdt->wdd);
|
|
watchdog_unregister_device(&wdt->wdd);
|
|
clk_disable_unprepare(wdt->clk);
|
|
clk_disable_unprepare(wdt->clk);
|
|
return 0;
|
|
return 0;
|