Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: sp805_wdt: deassert the reset if available

According to the datasheet, the core has an WDOGRESn input signal that
needs to be deasserted before being operational. Implement it in the
driver.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240221-hisi-wdt-v3-1-9642613dc2e6@outlook.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Yang Xiwen and committed by
Wim Van Sebroeck
575f100c 12b8ab42

+8
+8
drivers/watchdog/sp805_wdt.c
··· 25 25 #include <linux/moduleparam.h> 26 26 #include <linux/pm.h> 27 27 #include <linux/property.h> 28 + #include <linux/reset.h> 28 29 #include <linux/slab.h> 29 30 #include <linux/spinlock.h> 30 31 #include <linux/types.h> ··· 233 232 sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) 234 233 { 235 234 struct sp805_wdt *wdt; 235 + struct reset_control *rst; 236 236 u64 rate = 0; 237 237 int ret = 0; 238 238 ··· 265 263 dev_err(&adev->dev, "no clock-frequency property\n"); 266 264 return -ENODEV; 267 265 } 266 + 267 + rst = devm_reset_control_get_optional_exclusive(&adev->dev, NULL); 268 + if (IS_ERR(rst)) 269 + return dev_err_probe(&adev->dev, PTR_ERR(rst), "Can not get reset\n"); 270 + 271 + reset_control_deassert(rst); 268 272 269 273 wdt->adev = adev; 270 274 wdt->wdd.info = &wdt_info;