On 12.04.21 10:32, meng...@windriver.com wrote:
From: MengLi <meng...@windriver.com>
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...@windriver.com>
---
drivers/watchdog/designware_wdt.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/watchdog/designware_wdt.c
b/drivers/watchdog/designware_wdt.c
index 12f09a7a39..63e89d38c4 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -92,10 +92,27 @@ 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;
You add "ret" here as "__maybe_unused" and ...
designware_wdt_reset(dev);
writel(0, priv->base + DW_WDT_CR);
+#if CONFIG_IS_ENABLED(DM_RESET)
+ struct reset_ctl_bulk resets;
... here this struct. Please add both above as __maybe_unsed. I assume
that checkpatch and other tools will complain about variable
declarations in the code path.
BTW: It should be possible to change the above #if CONFIG_ to this
if (CONFIG_IS_ENABLED(DM_RESET)) {
Then you can put both variable declarations in here:
if (CONFIG_IS_ENABLED(DM_RESET)) {
struct reset_ctl_bulk resets;
int ret;
Please check if this works and resubmit.
Thanks,
Stefan
+
+ ret = reset_get_bulk(dev, &resets);
+ if (ret)
+ return ret;
+
+ ret = reset_assert_bulk(&resets);
+ if (ret)
+ return ret;
+
+ ret = reset_deassert_bulk(&resets);
+ if (ret)
+ return ret;
+#endif
+
return 0;
}