All of lore.kernel.org
 help / color / mirror / Atom feed
From: Meng.Li@windriver.com
To: u-boot@lists.denx.de, chin.liang.see@intel.com,
	dinh.nguyen@intel.com, sjg@chromium.org
Cc: sr@denx.de, sean.anderson@seco.com, meng.li@windriver.com
Subject: [PATCH v5, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function
Date: Mon, 24 May 2021 10:22:48 +0800	[thread overview]
Message-ID: <20210524022249.16841-1-Meng.Li@windriver.com> (raw)

From: MengLi <meng.li@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.Li@windriver.com>
Reviewed-by: Stefan Roese <sr@denx.de>

---
v5:
fix build issue, and verify this patch with latest upstream u-boot.
v4:
Remove the unauthorized signature.
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 | 19 +++++++++++++++----
 1 file 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;
 	}
-- 
2.17.1


             reply	other threads:[~2021-05-24  2:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24  2:22 Meng.Li [this message]
2021-05-24  2:22 ` [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default Meng.Li
2021-07-16 10:17   ` [PATCH v5,2/2] " Stefan Roese
2021-05-24 16:07 ` [PATCH v5,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Sean Anderson
2021-07-16 10:16 ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210524022249.16841-1-Meng.Li@windriver.com \
    --to=meng.li@windriver.com \
    --cc=chin.liang.see@intel.com \
    --cc=dinh.nguyen@intel.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.