From: "Herve Codina (Schneider Electric)" <herve.codina@bootlin.com>
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-clk@vger.kernel.org,
Pascal Eberhard <pascal.eberhard@se.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
"Herve Codina (Schneider Electric)" <herve.codina@bootlin.com>
Subject: [PATCH 5/5] watchdog: rzn1: Add support for direct hardware reset
Date: Tue, 10 Mar 2026 18:32:46 +0100 [thread overview]
Message-ID: <20260310173249.161354-6-herve.codina@bootlin.com> (raw)
In-Reply-To: <20260310173249.161354-1-herve.codina@bootlin.com>
The watchdog timeout is signaled using an interrupt and, on this
interrupt, a software initiated reset is performed.
The watchdog is able to control directly the hardware reset without
any operation done by the interrupt handler. This feature allows the
watchdog to not depend on the software to reset the system when the
watchdog timeout occurs.
The 'renesas,reset-line' device-tree property has been recently
introduced in order to describe the hardware reset line used by the
watchdog on its timeout.
Handle this property in the driver and add support for the related
direct hardware reset.
Signed-off-by: Herve Codina (Schneider Electric) <herve.codina@bootlin.com>
---
drivers/watchdog/rzn1_wdt.c | 41 +++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/watchdog/rzn1_wdt.c b/drivers/watchdog/rzn1_wdt.c
index 98978b5cc5b4..bf623ea31be1 100644
--- a/drivers/watchdog/rzn1_wdt.c
+++ b/drivers/watchdog/rzn1_wdt.c
@@ -17,7 +17,9 @@
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
+#include <linux/soc/renesas/r9a06g032-sysctrl.h>
#include <linux/watchdog.h>
+#include <dt-bindings/watchdog/renesas,rzn1-wdt.h>
#define DEFAULT_TIMEOUT 60
@@ -98,6 +100,41 @@ static const struct watchdog_ops rzn1_wdt_ops = {
.ping = rzn1_wdt_ping,
};
+static int rzn1_wdt_setup_rst_line(struct device *dev)
+{
+ enum r9a06g032_sysctrl_rst_src rst_src;
+ u32 reset_line;
+ int ret;
+
+ ret = of_property_read_u32(dev->of_node, "renesas,reset-line", &reset_line);
+ if (ret) {
+ if (ret == -EINVAL)
+ return 0; /* Property not present -> Ok, nothing to do */
+
+ return dev_err_probe(dev, ret, "Read 'renesas,reset-line' failed\n");
+ }
+
+ switch (reset_line) {
+ case RZN1_WDT_A7_0:
+ rst_src = R9A06G032_RST_WATCHDOG_CA7_0;
+ break;
+ case RZN1_WDT_A7_1:
+ rst_src = R9A06G032_RST_WATCHDOG_CA7_1;
+ break;
+
+ default:
+ return dev_err_probe(dev, -EINVAL,
+ "Invalid 'renesas,reset-line' (%u)\n",
+ reset_line);
+ }
+
+ ret = r9a06g032_sysctrl_enable_rst(rst_src);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable reset\n");
+
+ return 0;
+}
+
static int rzn1_wdt_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -116,6 +153,10 @@ static int rzn1_wdt_probe(struct platform_device *pdev)
if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base);
+ ret = rzn1_wdt_setup_rst_line(dev);
+ if (ret)
+ return ret;
+
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
--
2.53.0
next prev parent reply other threads:[~2026-03-10 17:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 17:32 [PATCH 0/5] " Herve Codina (Schneider Electric)
2026-03-10 17:32 ` [PATCH 1/5] watchdog: rzn1: Fix reverse xmas tree declaration Herve Codina (Schneider Electric)
2026-03-10 17:32 ` [PATCH 2/5] watchdog: rzn1: Use dev_err_probe() Herve Codina (Schneider Electric)
2026-03-10 17:32 ` [PATCH 3/5] dt-bindings: watchdog: renesas,rzn1-wdt: Document the reset line Herve Codina (Schneider Electric)
2026-03-10 17:38 ` Krzysztof Kozlowski
2026-03-10 18:12 ` Herve Codina
2026-03-10 20:14 ` Krzysztof Kozlowski
2026-03-10 17:32 ` [PATCH 4/5] clk: renesas: r9a06g032: Introduce a helper to set rsten register Herve Codina (Schneider Electric)
2026-03-10 17:32 ` Herve Codina (Schneider Electric) [this message]
2026-03-11 2:12 ` [PATCH 5/5] watchdog: rzn1: Add support for direct hardware reset kernel test robot
2026-03-11 6:07 ` kernel test robot
2026-03-10 21:53 ` [PATCH 0/5] " Wolfram Sang
2026-03-11 15:09 ` Herve Codina
2026-03-11 15:27 ` Wolfram Sang
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=20260310173249.161354-6-herve.codina@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=magnus.damm@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=mturquette@baylibre.com \
--cc=pascal.eberhard@se.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wim@linux-watchdog.org \
--cc=wsa+renesas@sang-engineering.com \
/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
all inboxes | Powered by JetHome®