Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Support Opensource <support.opensource@diasemi.com>,
	 Wim Van Sebroeck <wim@linux-watchdog.org>,
	 Guenter Roeck <linux@roeck-us.net>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Marcus Folkesson <marcus.folkesson@gmail.com>
Subject: [PATCH v3 3/4] watchdog: da9052_wdt: do not disable wdt during probe
Date: Wed, 26 Mar 2025 09:29:50 +0100	[thread overview]
Message-ID: <20250326-da9052-fixes-v3-3-a38a560fef0e@gmail.com> (raw)
In-Reply-To: <20250326-da9052-fixes-v3-0-a38a560fef0e@gmail.com>

If the watchog is started by the bootloader, we do not want the watchdog
to be disabled.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/watchdog/da9052_wdt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
index fa9078d4c136a52f1193768fe93dc04189519679..5bef70cb74b36412b427f5cf7255f16b8eb00ac7 100644
--- a/drivers/watchdog/da9052_wdt.c
+++ b/drivers/watchdog/da9052_wdt.c
@@ -194,11 +194,15 @@ static int da9052_wdt_probe(struct platform_device *pdev)
 	if (da9052->fault_log & DA9052_FAULTLOG_VDDFAULT)
 		da9052_wdt->bootstatus |= WDIOF_POWERUNDER;
 
-	ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
-				DA9052_CONTROLD_TWDSCALE, 0);
-	if (ret < 0) {
-		dev_err(dev, "Failed to disable watchdog bits, %d\n", ret);
+	ret = da9052_reg_read(da9052, DA9052_CONTROL_D_REG);
+	if (ret < 0)
 		return ret;
+
+	/* Check if FW enabled the watchdog */
+	if (ret & DA9052_CONTROLD_TWDSCALE) {
+		/* Ensure proper initialization */
+		da9052_wdt_start(da9052_wdt);
+		set_bit(WDOG_HW_RUNNING, &da9052_wdt->status);
 	}
 
 	return devm_watchdog_register_device(dev, &driver_data->wdt);

-- 
2.48.1


  parent reply	other threads:[~2025-03-26  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26  8:29 [PATCH v3 0/4] Various fixes for the da9052 watchdog Marcus Folkesson
2025-03-26  8:29 ` [PATCH v3 1/4] watchdog: da9052_wdt: add support for nowayout Marcus Folkesson
2025-03-26  8:29 ` [PATCH v3 2/4] watchdog: da9052_wdt: use timeout value from external inputs Marcus Folkesson
2025-03-26  8:29 ` Marcus Folkesson [this message]
2025-03-26 13:51   ` [PATCH v3 3/4] watchdog: da9052_wdt: do not disable wdt during probe Guenter Roeck
2025-03-26  8:29 ` [PATCH v3 4/4] watchdog: da9052_wdt: respect TWDMIN Marcus Folkesson

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=20250326-da9052-fixes-v3-3-a38a560fef0e@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=support.opensource@diasemi.com \
    --cc=wim@linux-watchdog.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox