mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] watchdog: gpio_wdt: add reset-from-wdt status gpio
@ 2026-10-13  5:54 Steffen Trumtrar
  2026-10-13  5:54 ` [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding Steffen Trumtrar
  2026-10-13  5:54 ` [PATCH 2/2] watchdog: gpio: add reset-from-wdt support Steffen Trumtrar
  0 siblings, 2 replies; 6+ messages in thread
From: Steffen Trumtrar @ 2026-10-13  5:54 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Robert Marko
  Cc: linux-watchdog, devicetree, linux-kernel, Steffen Trumtrar

In cases where the wdt-gpio buffers the reset signal over a reboot, this
can be used to decide if the watchdog caused the reset. Watchdogs have
the bootstatus for this information.

Add a device-tree binding for this gpio and evaluate the gpio in the
driver and set bootstatus accordingly.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
Steffen Trumtrar (2):
      dt-bindings: watchdog: add reset-from-wdt-gpios binding
      watchdog: gpio: add reset-from-wdt support

 .../devicetree/bindings/watchdog/linux,wdt-gpio.yaml      |  5 +++++
 drivers/watchdog/gpio_wdt.c                               | 15 +++++++++++++++
 2 files changed, 20 insertions(+)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20261012-v7-3-topic-gpio-wdt-787a48ff022c

Best regards,
--  
Steffen Trumtrar <s.trumtrar@pengutronix.de>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding
  2026-10-13  5:54 [PATCH 0/2] watchdog: gpio_wdt: add reset-from-wdt status gpio Steffen Trumtrar
@ 2026-10-13  5:54 ` Steffen Trumtrar
  2026-10-27 12:43   ` Rob Herring (Arm)
  2026-10-27 15:20   ` Guenter Roeck
  2026-10-13  5:54 ` [PATCH 2/2] watchdog: gpio: add reset-from-wdt support Steffen Trumtrar
  1 sibling, 2 replies; 6+ messages in thread
From: Steffen Trumtrar @ 2026-10-13  5:54 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Robert Marko
  Cc: linux-watchdog, devicetree, linux-kernel, Steffen Trumtrar

A wdt-gpio can buffer the reset signal over the reboot, to signal that the
reset was issued by the watchdog.

Add support for a new gpio 'reset-from-wdt-gpios' that allows reading this
buffered value.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 Documentation/devicetree/bindings/watchdog/linux,wdt-gpio.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/linux,wdt-gpio.yaml b/Documentation/devicetree/bindings/watchdog/linux,wdt-gpio.yaml
index 499f1b7e03f96..b9b64f938daa7 100644
--- a/Documentation/devicetree/bindings/watchdog/linux,wdt-gpio.yaml
+++ b/Documentation/devicetree/bindings/watchdog/linux,wdt-gpio.yaml
@@ -46,6 +46,11 @@ properties:
       It will only cease to toggle the signal when the device is open and the
       timeout elapsed.
 
+  reset-from-wdt-gpios:
+    description:
+      gpio connection that signals, that the last reset was issued by this watchdog.
+    maxItems: 1
+
 required:
   - compatible
   - gpios

-- 
2.52.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] watchdog: gpio: add reset-from-wdt support
  2026-10-13  5:54 [PATCH 0/2] watchdog: gpio_wdt: add reset-from-wdt status gpio Steffen Trumtrar
  2026-10-13  5:54 ` [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding Steffen Trumtrar
@ 2026-10-13  5:54 ` Steffen Trumtrar
  2026-10-27 15:21   ` Guenter Roeck
  1 sibling, 1 reply; 6+ messages in thread
From: Steffen Trumtrar @ 2026-10-13  5:54 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Robert Marko
  Cc: linux-watchdog, devicetree, linux-kernel, Steffen Trumtrar

The reset-from-wdt is a GPIO that signals, that the last reset was
issued by the gpio-wdt.

When this GPIO is provided, read its value and set the watchdog
bootstatus.

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

diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index 1abc7d0b78a62..ff303ae920bba 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -29,6 +29,7 @@ enum {
 
 struct gpio_wdt_priv {
 	struct gpio_desc	*gpiod;
+	struct gpio_desc	*reset_from_wdt;
 	bool			state;
 	bool			always_running;
 	unsigned int		hw_algo;
@@ -135,6 +136,20 @@ static int gpio_wdt_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->gpiod))
 		return PTR_ERR(priv->gpiod);
 
+	priv->reset_from_wdt = devm_gpiod_get_optional(dev, "reset-from-wdt", GPIOD_IN);
+	if (IS_ERR(priv->reset_from_wdt))
+		return dev_err_probe(dev, PTR_ERR(priv->reset_from_wdt),
+				     "failed to get reset-from-wdt-gpios.");
+
+	if (priv->reset_from_wdt) {
+		int val = gpiod_get_value_cansleep(priv->reset_from_wdt);
+
+		if (val < 0)
+			return val;
+
+		priv->wdd.bootstatus = val ? WDIOF_CARDRESET : 0;
+	}
+
 	ret = device_property_read_u32(dev, "hw_margin_ms", &hw_margin);
 	if (ret)
 		return ret;

-- 
2.52.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding
  2026-10-13  5:54 ` [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding Steffen Trumtrar
@ 2026-10-27 12:43   ` Rob Herring (Arm)
  2026-10-27 15:20   ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring (Arm) @ 2026-10-27 12:43 UTC (permalink / raw)
  To: Steffen Trumtrar
  Cc: Krzysztof Kozlowski, Robert Marko, Wim Van Sebroeck,
	linux-watchdog, linux-kernel, Conor Dooley, Guenter Roeck,
	devicetree


On Tue, 13 Oct 2026 07:54:27 +0200, Steffen Trumtrar wrote:
> A wdt-gpio can buffer the reset signal over the reboot, to signal that the
> reset was issued by the watchdog.
> 
> Add support for a new gpio 'reset-from-wdt-gpios' that allows reading this
> buffered value.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/watchdog/linux,wdt-gpio.yaml | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding
  2026-10-13  5:54 ` [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding Steffen Trumtrar
  2026-10-27 12:43   ` Rob Herring (Arm)
@ 2026-10-27 15:20   ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-10-27 15:20 UTC (permalink / raw)
  To: Steffen Trumtrar
  Cc: Wim Van Sebroeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Robert Marko, linux-watchdog, devicetree, linux-kernel

On Tue, Oct 13, 2026 at 07:54:27AM +0200, Steffen Trumtrar wrote:
> A wdt-gpio can buffer the reset signal over the reboot, to signal that the
> reset was issued by the watchdog.
> 
> Add support for a new gpio 'reset-from-wdt-gpios' that allows reading this
> buffered value.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] watchdog: gpio: add reset-from-wdt support
  2026-10-13  5:54 ` [PATCH 2/2] watchdog: gpio: add reset-from-wdt support Steffen Trumtrar
@ 2026-10-27 15:21   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-10-27 15:21 UTC (permalink / raw)
  To: Steffen Trumtrar
  Cc: Wim Van Sebroeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Robert Marko, linux-watchdog, devicetree, linux-kernel

On Tue, Oct 13, 2026 at 07:54:28AM +0200, Steffen Trumtrar wrote:
> The reset-from-wdt is a GPIO that signals, that the last reset was
> issued by the gpio-wdt.
> 
> When this GPIO is provided, read its value and set the watchdog
> bootstatus.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-27 15:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13  5:54 [PATCH 0/2] watchdog: gpio_wdt: add reset-from-wdt status gpio Steffen Trumtrar
2026-10-13  5:54 ` [PATCH 1/2] dt-bindings: watchdog: add reset-from-wdt-gpios binding Steffen Trumtrar
2026-10-27 12:43   ` Rob Herring (Arm)
2026-10-27 15:20   ` Guenter Roeck
2026-10-13  5:54 ` [PATCH 2/2] watchdog: gpio: add reset-from-wdt support Steffen Trumtrar
2026-10-27 15:21   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®