20 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22 #include <linux/module.h>
24 #include <linux/types.h>
25 #include <linux/kernel.h>
27 #include <linux/watchdog.h>
33 #include <linux/slab.h>
36 #include <mach/hardware.h>
40 #define DEFAULT_HEARTBEAT 19
41 #define MAX_HEARTBEAT 60
44 #define WDTIM_INT(p) ((p) + 0x0)
45 #define WDTIM_CTRL(p) ((p) + 0x4)
46 #define WDTIM_COUNTER(p) ((p) + 0x8)
47 #define WDTIM_MCTRL(p) ((p) + 0xC)
48 #define WDTIM_MATCH0(p) ((p) + 0x10)
49 #define WDTIM_EMR(p) ((p) + 0x14)
50 #define WDTIM_PULSE(p) ((p) + 0x18)
51 #define WDTIM_RES(p) ((p) + 0x1C)
58 #define RESET_COUNT (1 << 1)
59 #define DEBUG_EN (1 << 2)
64 #define RESET_COUNT0 (1 << 2)
65 #define STOP_COUNT0 (1 << 2)
66 #define M_RES1 (1 << 3)
67 #define M_RES2 (1 << 4)
68 #define RESFRC1 (1 << 5)
69 #define RESFRC2 (1 << 6)
73 #define MATCH_OUTPUT_HIGH (2 << 4)
78 #define WDOG_COUNTER_RATE 13000000
123 unsigned int new_timeout)
132 .identity =
"PNX4008 Watchdog",
137 .start = pnx4008_wdt_start,
138 .stop = pnx4008_wdt_stop,
139 .set_timeout = pnx4008_wdt_set_timeout,
143 .info = &pnx4008_wdt_ident,
144 .ops = &pnx4008_wdt_ops,
164 return PTR_ERR(wdt_clk);
173 watchdog_set_nowayout(&pnx4008_wdd, nowayout);
175 pnx4008_wdt_stop(&pnx4008_wdd);
179 dev_err(&pdev->
dev,
"cannot register watchdog device\n");
183 dev_info(&pdev->
dev,
"PNX4008 Watchdog Timer: heartbeat %d sec\n",
206 static const struct of_device_id pnx4008_wdt_match[] = {
215 .name =
"pnx4008-watchdog",
219 .probe = pnx4008_wdt_probe,
231 "Watchdog heartbeat period in seconds from 1 to "
237 "Set to 1 to keep watchdog running after device release");