[PATCH v3,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function

Sean Anderson sean.anderson at seco.com
Fri Apr 30 16:28:12 CEST 2021



On 4/30/21 1:26 AM, Meng.Li at windriver.com wrote:
 > From: MengLi <meng.li at windriver.com>
 >
 > In uboot command line environment, watchdog is not able to be
 > stopped with below commands:
 > SOCFPGA_STRATIX10 # wdt dev watchdog at ffd00200
 > SOCFPGA_STRATIX10 # wdt stop
 > Refer to watchdog driver in linux kernel, it is also need to reset
 > watchdog after disable it so that the disable action takes effect.
 >
 > Signed-off-by: Meng Li <Meng.Li at windriver.com>
 > Reviewed-by: Stefan Roese <sr at denx.de>
 > Reviewed-by: Sean Anderson <sean.anderson at seco.com>

I did not review your previous version. Please do not add a
"Reviewed-by" tag for people who did not send you one.

 >
 > ---
 > v3:
 > Add the resets to designware_wdt_priv and initialize it in probe().
 > v2:
 > Change "#if CONFIG_IS_ENABLED(DM_RESET)" into
 > "if (CONFIG_IS_ENABLED(DM_RESET)) {", and define the variable
 > into if condition sentence.
 > ---
 >   drivers/watchdog/designware_wdt.c | 31 +++++++++++++++++++++----------
 >   1 file changed, 21 insertions(+), 10 deletions(-)
 >
 > diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
 > index 12f09a7a39..cdf6b5709b 100644
 > --- a/drivers/watchdog/designware_wdt.c
 > +++ b/drivers/watchdog/designware_wdt.c
 > @@ -23,6 +23,7 @@
 >   struct designware_wdt_priv {
 >   	void __iomem	*base;
 >   	unsigned int	clk_khz;
 > +	struct reset_ctl_bulk *resets;
 >   };
 >
 >   /*
 > @@ -96,6 +97,18 @@ static int designware_wdt_stop(struct udevice *dev)
 >   	designware_wdt_reset(dev);
 >   	writel(0, priv->base + DW_WDT_CR);
 >
 > +        if (CONFIG_IS_ENABLED(DM_RESET)) {
 > +		int ret;
 > +
 > +		ret = reset_assert_bulk(priv->resets);
 > +		if (ret)
 > +			return ret;
 > +
 > +		ret = reset_deassert_bulk(priv->resets);
 > +		if (ret)
 > +			return ret;
 > +	}
 > +
 >   	return 0;
 >   }
 >
 > @@ -137,17 +150,15 @@ static int designware_wdt_probe(struct udevice *dev)
 >   	priv->clk_khz = CONFIG_DW_WDT_CLOCK_KHZ;
 >   #endif
 >
 > -#if CONFIG_IS_ENABLED(DM_RESET)
 > -	struct reset_ctl_bulk resets;
 > +	if (CONFIG_IS_ENABLED(DM_RESET)) {
 > +		ret = reset_get_bulk(dev, priv->resets);
 > +		if (ret)
 > +			return ret;
 >
 > -	ret = reset_get_bulk(dev, &resets);
 > -	if (ret)
 > -		return ret;
 > -
 > -	ret = reset_deassert_bulk(&resets);
 > -	if (ret)
 > -		return ret;
 > -#endif
 > +		ret = reset_deassert_bulk(priv->resets);
 > +		if (ret)
 > +			return ret;
 > +	}
 >
 >   	/* reset to disable the watchdog */
 >   	return designware_wdt_stop(dev);
 >

However, this version LGTM.

Reviewed-by: Sean Anderson <sean.anderson at seco.com>


More information about the U-Boot mailing list