mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org, Sascha Hauer <s.hauer@pengutronix.de>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH 1/2] watchdog: gpio: support always-running
Date: Fri, 30 Oct 2026 17:03:16 +0100	[thread overview]
Message-ID: <20261030-v2026-10-0-topic-gpio-wdt-v1-1-e81eb3470f62@pengutronix.de> (raw)
In-Reply-To: <20261030-v2026-10-0-topic-gpio-wdt-v1-0-e81eb3470f62@pengutronix.de>

The devicetree binding describes an always-running property for gpio
watchdogs that cannot be disabled. Add support for this property to the
driver.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/watchdog/gpio_wdt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index 5fa98f87c6b..3270c15ed16 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -19,6 +19,7 @@ enum {
 struct gpio_wdt_priv {
 	struct gpio_desc *gpiod;
 	bool		state;
+	bool		always_running;
 	bool		started;
 	unsigned int	hw_algo;
 	struct watchdog	wdd;
@@ -63,13 +64,17 @@ static void gpio_wdt_start(struct gpio_wdt_priv *priv)
 	priv->state = false;
 	gpiod_direction_output(priv->gpiod, priv->state);
 	priv->started = true;
+
+	priv->wdd.running = WDOG_HW_RUNNING;
 }
 
 static int gpio_wdt_set_timeout(struct watchdog *wdd, unsigned int new_timeout)
 {
 	struct gpio_wdt_priv *priv = to_gpio_wdt_priv(wdd);
 
-	if (!new_timeout) {
+	if (!new_timeout && priv->always_running) {
+		return -ENOSYS;
+	} else if (!new_timeout) {
 		gpio_wdt_disable(priv);
 		return 0;
 	}
@@ -117,11 +122,16 @@ static int gpio_wdt_probe(struct device *dev)
 	if (IS_ERR(priv->gpiod))
 		return PTR_ERR(priv->gpiod);
 
+	priv->always_running = of_property_read_bool(dev->of_node, "always-running");
+
 	priv->wdd.hwdev		= dev;
 	priv->wdd.timeout_max	= hw_margin / 1000;
 	priv->wdd.priority	= 129;
 	priv->wdd.set_timeout	= gpio_wdt_set_timeout;
 
+	if (priv->always_running)
+		gpio_wdt_start(priv);
+
 	return watchdog_register(&priv->wdd);
 }
 

-- 
2.52.0




  reply	other threads:[~2026-10-30 16:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 16:03 [PATCH 0/2] watchdog: gpio-wdt: add support for more dt-bindings Steffen Trumtrar
2026-10-30 16:03 ` Steffen Trumtrar [this message]
2026-10-30 16:03 ` [PATCH 2/2] watchdog: gpio: support reset-from-wdt gpio Steffen Trumtrar

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=20261030-v2026-10-0-topic-gpio-wdt-v1-1-e81eb3470f62@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox