Linux Watchdog driver development
 help / color / mirror / Atom feed
* [PATCH v4] fix it87_wdt early reboot by reporting running timer
@ 2025-11-17 12:11 René Rebe
  2025-11-17 15:24 ` Guenter Roeck
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: René Rebe @ 2025-11-17 12:11 UTC (permalink / raw)
  To: linux; +Cc: wim, linux-watchdog

Some products, such as the Ugreen DXP4800 Plus NAS, ship with the it87
wdt enabled by the firmware and a broken BIOS option that does not
allow to change the time or turn it off. As this makes installing
Linux rather difficult, change the it87_wdt to report it running to
the watchdog core.

Signed-off-by: René Rebe <rene@exactco.de>
---
v1:
- just clear hw timer register
v2:
- detect running hw timer and report to watchdog core
v3:
- multiply TOV1 in _wdt_get_timeout
- don't wrongly and superfluously set .max_hw_heartbeat_ms
- don't call set_timeout manually
v4:
- simplify to wdt_running
- move code up to not move superio_exit

diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
index 3b8488c86a2f..8ba7e03857ca 100644
--- a/drivers/watchdog/it87_wdt.c
+++ b/drivers/watchdog/it87_wdt.c
@@ -188,6 +188,12 @@ static void _wdt_update_timeout(unsigned int t)
 		superio_outb(t >> 8, WDTVALMSB);
 }
 
+/* Internal function, should be called after superio_select(GPIO) */
+static bool _wdt_running(void)
+{
+	return superio_inb(WDTVALLSB) || (max_units > 255 && superio_inb(WDTVALMSB));
+}
+
 static int wdt_update_timeout(unsigned int t)
 {
 	int ret;
@@ -374,6 +381,12 @@ static int __init it87_wdt_init(void)
 		}
 	}
 
+	/* wdt already left running by firmware? */
+	if (_wdt_running()) {
+		pr_info("Left running by firmware.\n");
+		set_bit(WDOG_HW_RUNNING, &wdt_dev.status);
+	}
+
 	superio_exit();
 
 	if (timeout < 1 || timeout > max_units * 60) {

-- 
  René Rebe, ExactCODE GmbH, Berlin, Germany
  https://exactco.de | https://t2linux.com | https://rene.rebe.de

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-12-13 16:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 12:11 [PATCH v4] fix it87_wdt early reboot by reporting running timer René Rebe
2025-11-17 15:24 ` Guenter Roeck
2025-12-12 20:21 ` James Hilliard
     [not found] ` <CADvTj4po1bx6AVfGKoxF38pzKURxryC17Up5Z7Ne+P5XBMZFmQ@mail.gmail.com>
2025-12-12 21:50   ` Guenter Roeck
2025-12-12 22:04     ` James Hilliard
2025-12-12 22:16       ` René Rebe
2025-12-12 22:28         ` James Hilliard
2025-12-12 22:34           ` René Rebe
2025-12-12 22:41             ` James Hilliard
2025-12-12 22:44               ` René Rebe
2025-12-12 23:00                 ` James Hilliard
2025-12-13 16:01                   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox