12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/bitops.h>
15 #include <linux/errno.h>
19 #include <linux/kernel.h>
21 #include <linux/module.h>
24 #include <linux/types.h>
25 #include <linux/watchdog.h>
29 #define WDT_DEFAULT_TIME 5
30 #define WDT_MAX_TIME 256
39 #ifdef CONFIG_WATCHDOG_NOWAYOUT
42 "Watchdog cannot be stopped once started (default="
47 static unsigned long at91wdt_busy;
54 static inline void at91_wdt_stop(
void)
62 static inline void at91_wdt_start(
void)
72 static inline void at91_wdt_reload(
void)
96 static int at91_wdt_close(
struct inode *inode,
struct file *file)
109 static int at91_wdt_settimeout(
int new_time)
127 .identity =
"at91 watchdog",
134 static long at91_wdt_ioctl(
struct file *file,
135 unsigned int cmd,
unsigned long arg)
144 sizeof(at91_wdt_info)) ? -
EFAULT : 0;
162 if (at91_wdt_settimeout(new_value))
178 static ssize_t at91_wdt_write(
struct file *file,
const char *
data,
179 size_t len, loff_t *ppos)
190 .unlocked_ioctl = at91_wdt_ioctl,
191 .open = at91_wdt_open,
192 .release = at91_wdt_close,
193 .write = at91_wdt_write,
199 .fops = &at91wdt_fops,
206 if (at91wdt_miscdev.
parent)
214 pr_info(
"AT91 Watchdog Timer enabled (%d seconds%s)\n",
215 wdt_time, nowayout ?
", nowayout" :
"");
251 #define at91wdt_suspend NULL
252 #define at91wdt_resume NULL
256 .probe = at91wdt_probe,
258 .shutdown = at91wdt_shutdown,
267 static int __init at91_wdt_init(
void)
271 if (at91_wdt_settimeout(wdt_time)) {
273 pr_info(
"wdt_time value must be 1 <= wdt_time <= 256, using %d\n",
280 static void __exit at91_wdt_exit(
void)