diff mbox series

[v3,3/4] watchdog: da9052_wdt: do not disable wdt during probe

Message ID 20250326-da9052-fixes-v3-3-a38a560fef0e@gmail.com
State New
Headers show
Series Various fixes for the da9052 watchdog | expand

Commit Message

Marcus Folkesson March 26, 2025, 8:29 a.m. UTC
If the watchog is started by the bootloader, we do not want the watchdog
to be disabled.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/watchdog/da9052_wdt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Guenter Roeck March 26, 2025, 1:51 p.m. UTC | #1
On 3/26/25 01:29, Marcus Folkesson wrote:
> If the watchog is started by the bootloader, we do not want the watchdog
> to be disabled.
> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
diff mbox series

Patch

diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
index fa9078d4c136a52f1193768fe93dc04189519679..5bef70cb74b36412b427f5cf7255f16b8eb00ac7 100644
--- a/drivers/watchdog/da9052_wdt.c
+++ b/drivers/watchdog/da9052_wdt.c
@@ -194,11 +194,15 @@  static int da9052_wdt_probe(struct platform_device *pdev)
 	if (da9052->fault_log & DA9052_FAULTLOG_VDDFAULT)
 		da9052_wdt->bootstatus |= WDIOF_POWERUNDER;
 
-	ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
-				DA9052_CONTROLD_TWDSCALE, 0);
-	if (ret < 0) {
-		dev_err(dev, "Failed to disable watchdog bits, %d\n", ret);
+	ret = da9052_reg_read(da9052, DA9052_CONTROL_D_REG);
+	if (ret < 0)
 		return ret;
+
+	/* Check if FW enabled the watchdog */
+	if (ret & DA9052_CONTROLD_TWDSCALE) {
+		/* Ensure proper initialization */
+		da9052_wdt_start(da9052_wdt);
+		set_bit(WDOG_HW_RUNNING, &da9052_wdt->status);
 	}
 
 	return devm_watchdog_register_device(dev, &driver_data->wdt);