Skip to contentSkip to conversation

watchdog: sp5100_tco: Immediately trigger upon starting.

PATCH In review Gregory Oakes 2 participants 2 messages Mar 16, 2023 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 watchdog: sp5100_tco: Immediately trigger upon starting.

The watchdog countdown is supposed to begin when the device file is opened. Instead, it would begin countdown upon the first write to or close of the device file. Now, the ping operation is called within the start operation which ensures the countdown begins. From experimenation, it does not appear possible to do this with a single write including both the start bit and the trigger bit. So, it is done as two distinct writes.

---
 drivers/watchdog/sp5100_tco.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/watchdog/sp5100_tco.c +4 -0
index fb426b7d81da..14f8d8d90920 100644
@@ -115,6 +115,10 @@ static int tco_timer_start(struct watchdog_device *wdd)
 	val |= SP5100_WDT_START_STOP_BIT;
 	writel(val, SP5100_WDT_CONTROL(tco->tcobase));
 
+	/* This must be a distinct write. */
+	val |= SP5100_WDT_TRIGGER_BIT;
+	writel(val, SP5100_WDT_CONTROL(tco->tcobase));
+
 	return 0;
 }
 
Signature · 1 line
2.39.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Gregory Oakes

The watchdog countdown is supposed to begin when the device file is opened. Instead, it would begin countdown upon the first write to or close of the device file. Now, the ping operation is called within the start operation which ensures the countdown begins. From experimenation, it does not appear possible to do this with a single write including both the start bit and the trigger bit. So, it is done as two distinct writes.

In the future, please remember to provide change logs. Fortunately I still remember v1, so

Guenter

Quoted 22 lines
---
 drivers/watchdog/sp5100_tco.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/watchdog/sp5100_tco.c +4 -0
index fb426b7d81da..14f8d8d90920 100644
@@ -115,6 +115,10 @@ static int tco_timer_start(struct watchdog_device *wdd)
 	val |= SP5100_WDT_START_STOP_BIT;
 	writel(val, SP5100_WDT_CONTROL(tco->tcobase));
 
+	/* This must be a distinct write. */
+	val |= SP5100_WDT_TRIGGER_BIT;
+	writel(val, SP5100_WDT_CONTROL(tco->tcobase));
+
 	return 0;
 }
 
Signature · 1 line
2.39.1