13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15 #include <linux/module.h>
17 #include <linux/types.h>
18 #include <linux/kernel.h>
21 #include <linux/watchdog.h>
28 #include <mach/bridge-regs.h>
33 #define TIMER_CTRL 0x0000
35 #define WDT_VAL 0x0024
37 #define WDT_MAX_CYCLE_COUNT 0xffffffff
39 #define WDT_OK_TO_CLOSE 1
43 static unsigned int wdt_max_duration;
45 static unsigned int wdt_tclk;
56 spin_unlock(&wdt_lock);
84 spin_unlock(&wdt_lock);
104 spin_unlock(&wdt_lock);
108 static unsigned int orion_wdt_get_timeleft(
struct watchdog_device *wdt_dev)
110 unsigned int time_left;
112 spin_lock(&wdt_lock);
114 spin_unlock(&wdt_lock);
120 unsigned int timeout)
128 .identity =
"Orion Watchdog",
133 .start = orion_wdt_start,
134 .stop = orion_wdt_stop,
135 .ping = orion_wdt_ping,
136 .set_timeout = orion_wdt_set_timeout,
137 .get_timeleft = orion_wdt_get_timeleft,
141 .info = &orion_wdt_info,
142 .ops = &orion_wdt_ops,
152 dev_err(&pdev->
dev,
"Orion Watchdog missing clock\n");
155 clk_prepare_enable(clk);
172 watchdog_set_nowayout(&orion_wdt, nowayout);
175 clk_disable_unprepare(clk);
179 pr_info(
"Initial timeout %d sec%s\n",
180 heartbeat, nowayout ?
", nowayout" :
"");
187 clk_disable_unprepare(clk);
193 orion_wdt_stop(&orion_wdt);
197 { .compatible =
"marvell,orion-wdt", },
203 .probe = orion_wdt_probe,
205 .shutdown = orion_wdt_shutdown,
209 .of_match_table =
of_match_ptr(orion_wdt_of_match_table),
222 MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="