11 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 #include <linux/module.h>
15 #include <linux/types.h>
17 #include <linux/watchdog.h>
25 #define WD_TIMER_CCD 7
26 #define WD_TIMER_CLK (clk_get_rate(txx9_imclk) / (2 << WD_TIMER_CCD))
27 #define WD_MAX_TIMEOUT ((0xffffffff >> (32 - TXX9_TIMER_BITS)) / WD_TIMER_CLK)
28 #define TIMER_MARGIN 60
33 "Watchdog timeout in seconds. "
40 "Watchdog cannot be stopped once started "
44 static struct clk *txx9_imclk;
49 spin_lock(&txx9_lock);
51 spin_unlock(&txx9_lock);
57 spin_lock(&txx9_lock);
64 spin_unlock(&txx9_lock);
70 spin_lock(&txx9_lock);
74 spin_unlock(&txx9_lock);
79 unsigned int new_timeout)
82 txx9wdt_stop(wdt_dev);
83 txx9wdt_start(wdt_dev);
89 .identity =
"Hardware Watchdog for TXx9",
94 .start = txx9wdt_start,
97 .set_timeout = txx9wdt_set_timeout,
101 .info = &txx9wdt_info,
111 if (IS_ERR(txx9_imclk)) {
112 ret = PTR_ERR(txx9_imclk);
135 watchdog_set_nowayout(&txx9wdt, nowayout);
141 pr_info(
"Hardware Watchdog Timer: timeout=%d sec (max %ld) (nowayout= %d)\n",
142 timeout, WD_MAX_TIMEOUT, nowayout);
163 txx9wdt_stop(&txx9wdt);
168 .shutdown = txx9wdt_shutdown,
175 static int __init watchdog_init(
void)
180 static void __exit watchdog_exit(
void)