Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: w83627hf_wdt: add bootstatus support

The status bit in the status and control register can tell us whether
the last reboot was caused by the watchdog. Make sure to take that into
the bootstatus before clearing it.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220824152448.7736-1-henning.schild@siemens.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Henning Schild and committed by
Wim Van Sebroeck
5a9fbf8b dc1f12b9

+10 -2
+10 -2
drivers/watchdog/w83627hf_wdt.c
··· 113 113 #define W836X7HF_WDT_CSR 0xf7 114 114 #define NCT6102D_WDT_CSR 0xf2 115 115 116 + #define WDT_CSR_STATUS 0x10 117 + #define WDT_CSR_KBD 0x40 118 + #define WDT_CSR_MOUSE 0x80 119 + 116 120 static void superio_outb(int reg, int val) 117 121 { 118 122 outb(reg, WDT_EFER); ··· 248 244 t = superio_inb(cr_wdt_control) & ~0x0C; 249 245 superio_outb(cr_wdt_control, t); 250 246 251 - /* reset trigger, disable keyboard & mouse turning off watchdog */ 252 - t = superio_inb(cr_wdt_csr) & ~0xD0; 247 + t = superio_inb(cr_wdt_csr); 248 + if (t & WDT_CSR_STATUS) 249 + wdog->bootstatus |= WDIOF_CARDRESET; 250 + 251 + /* reset status, disable keyboard & mouse turning off watchdog */ 252 + t &= ~(WDT_CSR_STATUS | WDT_CSR_KBD | WDT_CSR_MOUSE); 253 253 superio_outb(cr_wdt_csr, t); 254 254 255 255 superio_exit();