14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16 #include <linux/device.h>
19 #include <linux/module.h>
20 #include <linux/pci.h>
22 #include <linux/watchdog.h>
25 #define VIA_WDT_MMIO_BASE 0xe8
26 #define VIA_WDT_CONF 0xec
29 #define VIA_WDT_CONF_ENABLE 0x01
30 #define VIA_WDT_CONF_MMIO 0x02
36 #define VIA_WDT_MMIO_LEN 8
38 #define VIA_WDT_COUNT 4
41 #define VIA_WDT_RUNNING 0x01
42 #define VIA_WDT_FIRED 0x02
43 #define VIA_WDT_PWROFF 0x04
44 #define VIA_WDT_DISABLED 0x08
45 #define VIA_WDT_TRIGGER 0x80
48 #define WDT_HW_HEARTBEAT 1
51 #define WDT_HEARTBEAT (HZ/2)
54 #define WDT_TIMEOUT_MAX 1023
55 #define WDT_TIMEOUT 60
69 static unsigned int mmio;
70 static void wdt_timer_tick(
unsigned long data);
75 static inline void wdt_reset(
void)
91 static void wdt_timer_tick(
unsigned long data)
94 (!watchdog_active(&wdt_dev))) {
98 pr_crit(
"I will reboot your machine !\n");
128 unsigned int new_timeout)
136 .identity =
"VIA watchdog",
148 .set_timeout = wdt_set_timeout,
165 dev_err(&pdev->
dev,
"cannot enable PCI device\n");
176 0xf0000000, 0xffffff00, 0xff,
NULL,
NULL)) {
177 dev_err(&pdev->
dev,
"MMIO allocation failed\n");
178 goto err_out_disable_device;
188 dev_info(&pdev->
dev,
"VIA Chipset watchdog MMIO: %x\n", mmio);
190 dev_err(&pdev->
dev,
"MMIO setting failed. Check BIOS.\n");
191 goto err_out_resource;
196 goto err_out_resource;
200 if (wdt_mem ==
NULL) {
201 dev_err(&pdev->
dev,
"cannot remap VIA wdt MMIO registers\n");
202 goto err_out_release;
209 watchdog_set_nowayout(&wdt_dev, nowayout);
215 goto err_out_iounmap;
227 err_out_disable_device:
251 .id_table = wdt_pci_table,