[PATCH v2 3/4] watchdog: da9062: Add support for dlg,wdt-sd property
Primoz Fiser
primoz.fiser at norik.com
Wed Sep 23 23:50:43 PDT 2026
From: Andrej Picej <andrej.picej at norik.com>
Implement a method to change watchdog timeout configuration based on the
"dlg,wdt-sd" devicetree property. Setting the WATCHDOG_SD bit enables
SHUTDOWN mode, and clearing it enables POWERDOWN mode on watchdog
timeout.
If no devicetree property is specified, the WATCHDOG_SD bit stays in the
default configuration, not breaking behaviour of devices which might
depend on default fuse configuration.
Signed-off-by: Andrej Picej <andrej.picej at norik.com>
Tested-by: Christoph Niedermaier <cniedermaier at dh-electronics.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource at diasemi.com>
Acked-by: Guenter Roeck <linux at roeck-us.net>
Reviewed-by: Guenter Roeck <linux at roeck-us.net>
Signed-off-by: Primoz Fiser <primoz.fiser at norik.com>
---
Changes in v2:
- implement Guenter's remarks (code refactor and update commit message)
drivers/watchdog/da9062_wdt.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index 3d7bf2f351db..0c007847b7c4 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -206,6 +206,8 @@ static int da9062_wdt_probe(struct platform_device *pdev)
unsigned int timeout;
struct da9062 *chip;
struct da9062_watchdog *wdt;
+ int ret;
+ u32 val;
chip = dev_get_drvdata(dev->parent);
if (!chip)
@@ -245,6 +247,22 @@ static int da9062_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status);
}
+ /*
+ * Configure what happens on watchdog timeout. Can be specified with
+ * the "dlg,wdt-sd" devicetree property (0 -> POWERDOWN, non-zero ->
+ * SHUTDOWN). If the property is not set, leave the default in place.
+ */
+ ret = device_property_read_u32(dev, "dlg,wdt-sd", &val);
+ if (!ret) {
+ ret = regmap_update_bits(wdt->hw->regmap,
+ DA9062AA_CONFIG_I,
+ DA9062AA_WATCHDOG_SD_MASK,
+ val ? DA9062AA_WATCHDOG_SD_MASK : 0);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to set wdt reset mode\n");
+ }
+
return devm_watchdog_register_device(dev, &wdt->wdtdev);
}
--
2.34.1
More information about the linux-arm-kernel
mailing list