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

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: rzg2l_wdt: Remove reset de-assert from probe

There is no need to de-assert the reset signal on probe as the watchdog
is not used prior executing start. Also, the clocks are not enabled in
probe (pm_runtime_enable() doesn't do that), thus this is another indicator
that the watchdog wasn't used previously like this. Instead, keep the
watchdog hardware in its previous state at probe (by default it is in
reset state), enable it when it is started and move it to reset state
when it is stopped. This saves some extra power when the watchdog is
unused.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240531065723.1085423-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Claudiu Beznea and committed by
Wim Van Sebroeck
064319c3 471e45a3

+17 -11
+17 -11
drivers/watchdog/rzg2l_wdt.c
··· 129 129 if (ret) 130 130 return ret; 131 131 132 + ret = reset_control_deassert(priv->rstc); 133 + if (ret) { 134 + pm_runtime_put(wdev->parent); 135 + return ret; 136 + } 137 + 132 138 /* Initialize time out */ 133 139 rzg2l_wdt_init_timeout(wdev); 134 140 ··· 152 146 struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); 153 147 int ret; 154 148 155 - rzg2l_wdt_reset(priv); 149 + ret = reset_control_assert(priv->rstc); 150 + if (ret) 151 + return ret; 156 152 157 153 ret = pm_runtime_put(wdev->parent); 158 154 if (ret < 0) ··· 194 186 clk_prepare_enable(priv->osc_clk); 195 187 196 188 if (priv->devtype == WDT_RZG2L) { 189 + int ret; 190 + 191 + ret = reset_control_deassert(priv->rstc); 192 + if (ret) 193 + return ret; 194 + 197 195 /* Generate Reset (WDTRSTB) Signal on parity error */ 198 196 rzg2l_wdt_write(priv, 0, PECR); 199 197 ··· 250 236 .restart = rzg2l_wdt_restart, 251 237 }; 252 238 253 - static void rzg2l_wdt_reset_assert_pm_disable(void *data) 239 + static void rzg2l_wdt_pm_disable(void *data) 254 240 { 255 241 struct watchdog_device *wdev = data; 256 - struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); 257 242 258 243 pm_runtime_disable(wdev->parent); 259 - reset_control_assert(priv->rstc); 260 244 } 261 245 262 246 static int rzg2l_wdt_probe(struct platform_device *pdev) ··· 297 285 return dev_err_probe(&pdev->dev, PTR_ERR(priv->rstc), 298 286 "failed to get cpg reset"); 299 287 300 - ret = reset_control_deassert(priv->rstc); 301 - if (ret) 302 - return dev_err_probe(dev, ret, "failed to deassert"); 303 - 304 288 priv->devtype = (uintptr_t)of_device_get_match_data(dev); 305 289 306 290 if (priv->devtype == WDT_RZV2M) { ··· 317 309 priv->wdev.timeout = WDT_DEFAULT_TIMEOUT; 318 310 319 311 watchdog_set_drvdata(&priv->wdev, priv); 320 - ret = devm_add_action_or_reset(&pdev->dev, 321 - rzg2l_wdt_reset_assert_pm_disable, 322 - &priv->wdev); 312 + ret = devm_add_action_or_reset(&pdev->dev, rzg2l_wdt_pm_disable, &priv->wdev); 323 313 if (ret < 0) 324 314 return ret; 325 315