Skip to contentSkip to conversation

watchdog: sama5d4: readout initial state

PATCH In review Mathieu Othacehe 2 participants 2 messages Aug 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: sama5d4: readout initial state

Readout the AT91_WDT_MR bit at probe so that it becomes possible to get the pre-userspace handler working.

---
 drivers/watchdog/sama5d4_wdt.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/watchdog/sama5d4_wdt.c +7 -0
index aeee934ca51b..7d31bb6f6204 100644
@@ -255,6 +255,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 	struct sama5d4_wdt *wdt;
 	void __iomem *regs;
 	u32 irq = 0;
+	u32 reg;
 	int ret;
 
 	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
@@ -305,6 +306,12 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 
 	watchdog_init_timeout(wdd, wdt_timeout, dev);
 
+	reg = wdt_read(wdt, AT91_WDT_MR);
+	if (!(reg & AT91_WDT_WDDIS)) {
+		wdt->mr &= ~AT91_WDT_WDDIS;
+		set_bit(WDOG_HW_RUNNING, &wdd->status);
+	}
+
 	ret = sama5d4_wdt_init(wdt);
 	if (ret)
 		return ret;
Signature · 7 lines
2.41.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Mathieu Othacehe

Readout the AT91_WDT_MR bit at probe so that it becomes possible to get the pre-userspace handler working.

Quoted 32 lines
---
 drivers/watchdog/sama5d4_wdt.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/watchdog/sama5d4_wdt.c +7 -0
index aeee934ca51b..7d31bb6f6204 100644
@@ -255,6 +255,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 	struct sama5d4_wdt *wdt;
 	void __iomem *regs;
 	u32 irq = 0;
+	u32 reg;
 	int ret;
 
 	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
@@ -305,6 +306,12 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 
 	watchdog_init_timeout(wdd, wdt_timeout, dev);
 
+	reg = wdt_read(wdt, AT91_WDT_MR);
+	if (!(reg & AT91_WDT_WDDIS)) {
+		wdt->mr &= ~AT91_WDT_WDDIS;
+		set_bit(WDOG_HW_RUNNING, &wdd->status);
+	}
+
 	ret = sama5d4_wdt_init(wdt);
 	if (ret)
 		return ret;
Signature · 1 line
2.41.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel