diff mbox series

[v5,4/7] watchdog: rzg2l_wdt: Fix reset control imbalance

Message ID 20220225175320.11041-5-biju.das.jz@bp.renesas.com
State New
Headers show
Series RZG2L_WDT Fixes and Improvements | expand

Commit Message

Biju Das Feb. 25, 2022, 5:53 p.m. UTC
Both rzg2l_wdt_probe() and rzg2l_wdt_start() calls reset_control_
deassert() which results in a reset control imbalance.

This patch fixes reset control imbalance by removing reset_control_
deassert() from rzg2l_wdt_start() and replaces reset_control_assert with
reset_control_reset in rzg2l_wdt_stop() as watchdog module can be stopped
only by a module reset. This change will allow us to restart WDT after
stop() by configuring WDT timeout and enable registers.

Fixes: 2cbc5cd0b55fa2 ("watchdog: Add Watchdog Timer driver for RZ/G2L")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v5:
 * New patch
---
 drivers/watchdog/rzg2l_wdt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Geert Uytterhoeven March 1, 2022, 11:20 a.m. UTC | #1
On Fri, Feb 25, 2022 at 6:53 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Both rzg2l_wdt_probe() and rzg2l_wdt_start() calls reset_control_
> deassert() which results in a reset control imbalance.
>
> This patch fixes reset control imbalance by removing reset_control_
> deassert() from rzg2l_wdt_start() and replaces reset_control_assert with
> reset_control_reset in rzg2l_wdt_stop() as watchdog module can be stopped
> only by a module reset. This change will allow us to restart WDT after
> stop() by configuring WDT timeout and enable registers.
>
> Fixes: 2cbc5cd0b55fa2 ("watchdog: Add Watchdog Timer driver for RZ/G2L")
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Guenter Roeck March 9, 2022, 11:08 p.m. UTC | #2
On Fri, Feb 25, 2022 at 05:53:17PM +0000, Biju Das wrote:
> Both rzg2l_wdt_probe() and rzg2l_wdt_start() calls reset_control_
> deassert() which results in a reset control imbalance.
> 
> This patch fixes reset control imbalance by removing reset_control_
> deassert() from rzg2l_wdt_start() and replaces reset_control_assert with
> reset_control_reset in rzg2l_wdt_stop() as watchdog module can be stopped
> only by a module reset. This change will allow us to restart WDT after
> stop() by configuring WDT timeout and enable registers.
> 
> Fixes: 2cbc5cd0b55fa2 ("watchdog: Add Watchdog Timer driver for RZ/G2L")
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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

> ---
> v5:
>  * New patch
> ---
>  drivers/watchdog/rzg2l_wdt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> index 48dfe6e5e64f..88274704b260 100644
> --- a/drivers/watchdog/rzg2l_wdt.c
> +++ b/drivers/watchdog/rzg2l_wdt.c
> @@ -88,7 +88,6 @@ static int rzg2l_wdt_start(struct watchdog_device *wdev)
>  {
>  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
>  
> -	reset_control_deassert(priv->rstc);
>  	pm_runtime_get_sync(wdev->parent);
>  
>  	/* Initialize time out */
> @@ -108,7 +107,7 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
>  	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
>  
>  	pm_runtime_put(wdev->parent);
> -	reset_control_assert(priv->rstc);
> +	reset_control_reset(priv->rstc);
>  
>  	return 0;
>  }
diff mbox series

Patch

diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
index 48dfe6e5e64f..88274704b260 100644
--- a/drivers/watchdog/rzg2l_wdt.c
+++ b/drivers/watchdog/rzg2l_wdt.c
@@ -88,7 +88,6 @@  static int rzg2l_wdt_start(struct watchdog_device *wdev)
 {
 	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
 
-	reset_control_deassert(priv->rstc);
 	pm_runtime_get_sync(wdev->parent);
 
 	/* Initialize time out */
@@ -108,7 +107,7 @@  static int rzg2l_wdt_stop(struct watchdog_device *wdev)
 	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
 
 	pm_runtime_put(wdev->parent);
-	reset_control_assert(priv->rstc);
+	reset_control_reset(priv->rstc);
 
 	return 0;
 }