From: Quentin Schulz Date: Tue, 15 Nov 2022 10:20:14 +0000 (+0100) Subject: watchdog: designware: make reset really optional X-Git-Tag: v2025.01-rc5-pxa1908~1206^2~1 X-Git-Url: http://git.dujemihanovic.xyz/html/index.html?a=commitdiff_plain;h=dca313ff9dea03d523e3a63568b5ed265f811c91;p=u-boot.git watchdog: designware: make reset really optional Checking for DM_RESET is not enough since not all watchdog implementations use a reset lane. Such is the case for Rockchip implementation for example. Since reset_assert_bulk will only succeed if the resets property exists in the watchdog DT node, it needs to be called only if a reset property is present. This adds a condition on the resets property presence in the watchdog DT node before assuming a reset lane needs to be fetched with reset_assert_bulk, by calling ofnode_read_prop. Cc: Quentin Schulz Reviewed-by: Stefan Roese Signed-off-by: Quentin Schulz --- diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c index cad756aeaf..f8df1916b5 100644 --- a/drivers/watchdog/designware_wdt.c +++ b/drivers/watchdog/designware_wdt.c @@ -72,13 +72,13 @@ static int designware_wdt_reset(struct udevice *dev) static int designware_wdt_stop(struct udevice *dev) { struct designware_wdt_priv *priv = dev_get_priv(dev); + __maybe_unused int ret; designware_wdt_reset(dev); writel(0, priv->base + DW_WDT_CR); - if (CONFIG_IS_ENABLED(DM_RESET)) { - int ret; - + if (CONFIG_IS_ENABLED(DM_RESET) && + ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) { ret = reset_assert_bulk(&priv->resets); if (ret) return ret; @@ -135,7 +135,8 @@ static int designware_wdt_probe(struct udevice *dev) priv->clk_khz = CONFIG_DW_WDT_CLOCK_KHZ; #endif - if (CONFIG_IS_ENABLED(DM_RESET)) { + if (CONFIG_IS_ENABLED(DM_RESET) && + ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) { ret = reset_get_bulk(dev, &priv->resets); if (ret) goto err;