diff options
author | MengLi <meng.li@windriver.com> | 2021-05-24 05:22:48 +0300 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2021-07-16 11:28:35 +0300 |
commit | 4f7abafe1c6af5d2fc14ef6dd1679086032805f9 (patch) | |
tree | 451ab1a2e31dafef28c59693a8e4af196207cd69 | |
parent | d3fc3da9a4fb98104d004b025149ec6dadccc2cd (diff) | |
download | u-boot-4f7abafe1c6af5d2fc14ef6dd1679086032805f9.tar.xz |
driver: watchdog: reset watchdog in designware_wdt_stop() function
In uboot command line environment, watchdog is not able to be
stopped with below commands:
SOCFPGA_STRATIX10 # wdt dev watchdog@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@windriver.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
-rw-r--r-- | drivers/watchdog/designware_wdt.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c index 9e5487168c..afed81e6c6 100644 --- a/drivers/watchdog/designware_wdt.c +++ b/drivers/watchdog/designware_wdt.c @@ -22,6 +22,7 @@ struct designware_wdt_priv { void __iomem *base; unsigned int clk_khz; + struct reset_ctl_bulk *resets; }; /* @@ -95,6 +96,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; } @@ -143,13 +156,11 @@ static int designware_wdt_probe(struct udevice *dev) #endif if (CONFIG_IS_ENABLED(DM_RESET)) { - struct reset_ctl_bulk resets; - - ret = reset_get_bulk(dev, &resets); + ret = reset_get_bulk(dev, priv->resets); if (ret) goto err; - ret = reset_deassert_bulk(&resets); + ret = reset_deassert_bulk(priv->resets); if (ret) goto err; } |