mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 00/15] Update watchdogs support on STM32MP platforms
@ 2026-11-16 13:24 Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 01/15] watchdog: stm32_iwdg: set driver data before requesting interrupt Antonio Borneo
                   ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

This series allows the stm32_iwdg watchdog driver to determine
whether the watchdog is already running and adds support for
STM32MP2xx devices.

It also completes and rationalizes the configuration of secure and
non-secure watchdogs across STM32MP devices and ST boards.

For STM32MP1xx devices, it enables the ARM SMC watchdog driver in
the machine Kconfig.

Regards,
Antonio


Changes in v4:
- Add two fixes, one detected by Sashiko
- Add access-contollers property to bindingds
- Drop update on stm32mp21x DT since clock framework is still missing
- Add two fixes, one detected by Sashiko
- Integrate Sashiko comments
- Patch v4 06/15 (former v3 04/13) reposted unchanged, waiting for reply from Guenter Roeck
- Link to v3: https://lore.kernel.org/all/20261106163429.618392-1-antonio.borneo@foss.st.com/

Changes in v3:
- Add support for detecting watchdog running status
- Add pretimeout irq support on STM32MP2xx
- Build ARM SMC watchdog driver on STM32MP1xx
- Use ARM SMC watchdog on platforms that have secure IWDG1 and use the
  native stm32_iwdg driver when the IWDG1 is non-secure
- Add iwdg1 and iwdg2 nodes on STM32MP2xx platforms
- Add the alias in device trees to have the system watchdog allocated
  as watchdog0, independently from the probe order
- Link to v2: https://lore.kernel.org/lkml/20261015154826.1947492-1-antonio.borneo@foss.st.com/

Changes in v2:
- Drop addition of iwdg1 DT node, not needed as OP-TEE keep the watchdog
  secure on all boards;
- Link to v1: https://lore.kernel.org/lkml/20261007151358.1166329-1-antonio.borneo@foss.st.com/

Amelie Delaunay (3):
  ARM: dts: stm32: add iwdg1 node on stm32mp151 SoC
  ARM: dts: stm32: enable iwdg1 on stm32mp15x ST boards
  ARM: dts: stm32: enable arm smc watchdog on stm32mp15x scmi boards

Antonio Borneo (9):
  watchdog: stm32_iwdg: set driver data before requesting interrupt
  watchdog: stm32_iwdg: serialize accesses to EWCR register
  watchdog: stm32_iwdg: add pretimeout support for iwdg v4.0
  ARM: stm32: enable arm smc watchdog on stm32mp1xx
  dt-bindings: watchdog: st,stm32-iwdg: add access-controllers property
  ARM: dts: stm32: move arm smc watchdog to stm32mp151 SoC
  ARM: dts: stm32: add watchdog0 alias on ST stm32mp1xx boards
  arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp231
  arm64: dts: st: enable iwdg2 on stm32mp2xx ST boards

Clément Le Goffic (3):
  watchdog: stm32_iwdg: get hardware version during probe
  watchdog: stm32_iwdg: detect whether the watchdog is running
  arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp251

 .../bindings/watchdog/st,stm32-iwdg.yaml      |  3 +
 arch/arm/boot/dts/st/stm32mp135f-dk.dts       |  1 +
 arch/arm/boot/dts/st/stm32mp15-scmi.dtsi      |  4 +
 arch/arm/boot/dts/st/stm32mp151.dtsi          | 16 ++++
 arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts |  9 ++
 arch/arm/boot/dts/st/stm32mp157c-dk2-scmi.dts |  9 ++
 arch/arm/boot/dts/st/stm32mp157c-ed1-scmi.dts |  9 ++
 arch/arm/boot/dts/st/stm32mp157c-ed1.dts      |  6 ++
 arch/arm/boot/dts/st/stm32mp157c-ev1-scmi.dts |  9 ++
 .../arm/boot/dts/st/stm32mp157f-dk2-scmi.dtsi |  7 --
 arch/arm/boot/dts/st/stm32mp157f-dk2.dts      |  1 +
 arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi     |  6 ++
 arch/arm/mach-stm32/Kconfig                   |  2 +
 arch/arm64/boot/dts/st/stm32mp231.dtsi        | 20 +++++
 arch/arm64/boot/dts/st/stm32mp235f-dk.dts     |  6 ++
 arch/arm64/boot/dts/st/stm32mp251.dtsi        | 20 +++++
 arch/arm64/boot/dts/st/stm32mp257f-dk.dts     |  8 +-
 arch/arm64/boot/dts/st/stm32mp257f-ev1.dts    |  6 ++
 drivers/watchdog/stm32_iwdg.c                 | 86 +++++++++++++++----
 19 files changed, 201 insertions(+), 27 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.34.1


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

* [PATCH v4 01/15] watchdog: stm32_iwdg: set driver data before requesting interrupt
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 02/15] watchdog: stm32_iwdg: serialize accesses to EWCR register Antonio Borneo
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

The interrupt handler accesses the driver data, which is currently
set after devm_request_irq() returns.

If the watchdog was started by the bootloader and a pretimeout
interrupt is pending, the handler can run before the driver data
is set, resulting in a NULL pointer dereference.

Move the IRQ request after setting the driver data to ensure it
is available when the interrupt handler runs.

Fixes: 3ab1663af6c1 ("watchdog: stm32_iwdg: Add pretimeout support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261106163429.618392-1-antonio.borneo%40foss.st.com?part=3
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/watchdog/stm32_iwdg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index a8d2db2d3cf8b..2bac4ce5ed3f8 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -346,15 +346,15 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
 	wdd->max_hw_heartbeat_ms = ((RLR_MAX + 1) * wdt->data->max_prescaler *
 				    1000) / wdt->rate;
 
+	watchdog_set_drvdata(wdd, wdt);
+	watchdog_set_nowayout(wdd, WATCHDOG_NOWAYOUT);
+	watchdog_init_timeout(wdd, 0, dev);
+
 	/* Initialize IRQ, this might override wdd->info, hence it is here. */
 	ret = stm32_iwdg_irq_init(pdev, wdt);
 	if (ret)
 		return ret;
 
-	watchdog_set_drvdata(wdd, wdt);
-	watchdog_set_nowayout(wdd, WATCHDOG_NOWAYOUT);
-	watchdog_init_timeout(wdd, 0, dev);
-
 	/*
 	 * In case of CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is set
 	 * (Means U-Boot/bootloaders leaves the watchdog running)
-- 
2.34.1


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

* [PATCH v4 02/15] watchdog: stm32_iwdg: serialize accesses to EWCR register
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 01/15] watchdog: stm32_iwdg: set driver data before requesting interrupt Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 03/15] watchdog: stm32_iwdg: get hardware version during probe Antonio Borneo
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

On STM32MP1xx platforms, EWCR contains both the pretimeout
interrupt configuration and a write-only bit used to acknowledge
the interrupt.

On SMP systems, the read-modify-write operation in the pretimeout
IRQ handler can race with writes that update the pretimeout
configuration.

Protect these accesses with a spinlock to prevent concurrent
updates.
Don't use the helpers reg_read()/reg_write() in the critical
sections as they rely on relaxed memory access, which are not
ordered against locking.

Fixes: 3ab1663af6c1 ("watchdog: stm32_iwdg: Add pretimeout support")
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/watchdog/stm32_iwdg.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index 2bac4ce5ed3f8..487764b51667c 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_wakeirq.h>
+#include <linux/spinlock.h>
 #include <linux/watchdog.h>
 
 #define DEFAULT_TIMEOUT 10
@@ -82,6 +83,7 @@ struct stm32_iwdg {
 	struct clk		*clk_lsi;
 	struct clk		*clk_pclk;
 	unsigned int		rate;
+	spinlock_t		lock; /* serialize IWDG_EWCR register access */
 };
 
 static inline u32 reg_read(void __iomem *base, u32 reg)
@@ -98,6 +100,7 @@ static int stm32_iwdg_start(struct watchdog_device *wdd)
 {
 	struct stm32_iwdg *wdt = watchdog_get_drvdata(wdd);
 	u32 tout, ptot, presc, iwdg_rlr, iwdg_ewcr, iwdg_pr, iwdg_sr;
+	unsigned long flags;
 	int ret;
 
 	dev_dbg(wdd->parent, "%s\n", __func__);
@@ -124,8 +127,11 @@ static int stm32_iwdg_start(struct watchdog_device *wdd)
 	/* set prescaler & reload registers */
 	reg_write(wdt->regs, IWDG_PR, iwdg_pr);
 	reg_write(wdt->regs, IWDG_RLR, iwdg_rlr);
-	if (wdt->data->has_early_wakeup)
-		reg_write(wdt->regs, IWDG_EWCR, iwdg_ewcr | EWCR_EWIE);
+	if (wdt->data->has_early_wakeup) {
+		spin_lock_irqsave(&wdt->lock, flags);
+		writel(iwdg_ewcr | EWCR_EWIE, wdt->regs + IWDG_EWCR);
+		spin_unlock_irqrestore(&wdt->lock, flags);
+	}
 	reg_write(wdt->regs, IWDG_KR, KR_KEY_ENABLE);
 
 	/* wait for the registers to be updated (max 100ms) */
@@ -185,11 +191,16 @@ static irqreturn_t stm32_iwdg_isr(int irq, void *wdog_arg)
 {
 	struct watchdog_device *wdd = wdog_arg;
 	struct stm32_iwdg *wdt = watchdog_get_drvdata(wdd);
+	unsigned long flags;
 	u32 reg;
 
-	reg = reg_read(wdt->regs, IWDG_EWCR);
+	spin_lock_irqsave(&wdt->lock, flags);
+
+	reg = readl(wdt->regs + IWDG_EWCR);
 	reg |= EWCR_EWIC;
-	reg_write(wdt->regs, IWDG_EWCR, reg);
+	writel(reg, wdt->regs + IWDG_EWCR);
+
+	spin_unlock_irqrestore(&wdt->lock, flags);
 
 	watchdog_notify_pretimeout(wdd);
 
@@ -323,6 +334,8 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
 	if (!wdt)
 		return -ENOMEM;
 
+	spin_lock_init(&wdt->lock);
+
 	wdt->data = of_device_get_match_data(&pdev->dev);
 	if (!wdt->data)
 		return -ENODEV;
-- 
2.34.1


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

* [PATCH v4 03/15] watchdog: stm32_iwdg: get hardware version during probe
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 01/15] watchdog: stm32_iwdg: set driver data before requesting interrupt Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 02/15] watchdog: stm32_iwdg: serialize accesses to EWCR register Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 04/15] watchdog: stm32_iwdg: detect whether the watchdog is running Antonio Borneo
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

From: Clément Le Goffic <clement.legoffic@foss.st.com>

Get the hardware version of the IWDG peripheral during probe.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/watchdog/stm32_iwdg.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index 487764b51667c..9a0dc52a96bc7 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -31,6 +31,7 @@
 #define IWDG_SR		0x0C /* Status Register */
 #define IWDG_WINR	0x10 /* Windows Register */
 #define IWDG_EWCR	0x14 /* Early Wake-up Register */
+#define IWDG_VERR	0x3F4 /* Version Register */
 
 /* IWDG_KR register bit mask */
 #define KR_KEY_RELOAD	0xAAAA /* reload counter enable */
@@ -54,6 +55,9 @@
 #define EWCR_EWIC	BIT(14) /* Watchdog early interrupt acknowledge */
 #define EWCR_EWIE	BIT(15) /* Watchdog early interrupt enable */
 
+/* IWDG_VERR register mask */
+#define VERR_MASK	GENMASK(7, 0)
+
 /* set timeout to 100000 us */
 #define TIMEOUT_US	100000
 #define SLEEP_US	1000
@@ -83,6 +87,7 @@ struct stm32_iwdg {
 	struct clk		*clk_lsi;
 	struct clk		*clk_pclk;
 	unsigned int		rate;
+	unsigned int		hw_version;
 	spinlock_t		lock; /* serialize IWDG_EWCR register access */
 };
 
@@ -359,6 +364,8 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
 	wdd->max_hw_heartbeat_ms = ((RLR_MAX + 1) * wdt->data->max_prescaler *
 				    1000) / wdt->rate;
 
+	wdt->hw_version = reg_read(wdt->regs, IWDG_VERR) & VERR_MASK;
+
 	watchdog_set_drvdata(wdd, wdt);
 	watchdog_set_nowayout(wdd, WATCHDOG_NOWAYOUT);
 	watchdog_init_timeout(wdd, 0, dev);
-- 
2.34.1


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

* [PATCH v4 04/15] watchdog: stm32_iwdg: detect whether the watchdog is running
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (2 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 03/15] watchdog: stm32_iwdg: get hardware version during probe Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 05/15] watchdog: stm32_iwdg: add pretimeout support for iwdg v4.0 Antonio Borneo
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

From: Clément Le Goffic <clement.legoffic@foss.st.com>

On STM32MP13x and STM32MP2xx platforms, the ONF bit in the IWDG
status register indicates whether the watchdog is running. This
feature was introduced with IWDG hardware version 3.1 and is not
available on older versions, such as the one used on STM32MP15x.

On older hardware versions, determine the watchdog state by
writing the current reload value back to the reload register,
then checking the RVU (Reload Value Update) bit in the status
register. The update completes only if the watchdog is already
running.

Use this state information to service only watchdogs that were
started by earlier boot stages.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/watchdog/stm32_iwdg.c | 40 ++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index 9a0dc52a96bc7..1a5715ff9fab3 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -50,6 +50,7 @@
 /* IWDG_SR register bit mask */
 #define SR_PVU	BIT(0) /* Watchdog prescaler value update */
 #define SR_RVU	BIT(1) /* Watchdog counter reload value update */
+#define SR_ONF	BIT(8) /* Watchdog enable status bit */
 
 #define EWCR_EWIT	GENMASK(11, 0) /* Watchdog counter window value */
 #define EWCR_EWIC	BIT(14) /* Watchdog early interrupt acknowledge */
@@ -58,6 +59,9 @@
 /* IWDG_VERR register mask */
 #define VERR_MASK	GENMASK(7, 0)
 
+/* IWDG Compatibility */
+#define ONF_MIN_VER	0x31
+
 /* set timeout to 100000 us */
 #define TIMEOUT_US	100000
 #define SLEEP_US	1000
@@ -261,6 +265,31 @@ static int stm32_iwdg_clk_init(struct platform_device *pdev,
 	return 0;
 }
 
+static bool stm32_iwdg_is_running(struct stm32_iwdg *wdt)
+{
+	bool running;
+	u32 rlr, sr;
+	int ret;
+
+	if (wdt->hw_version >= ONF_MIN_VER)
+		return (reg_read(wdt->regs, IWDG_SR) & SR_ONF) != 0;
+
+	/*
+	 * Workaround for old versions without IWDG_SR_ONF bit:
+	 * - write in IWDG_RLR_OFFSET
+	 * - wait for sync
+	 * - if sync succeeds, then iwdg is running
+	 */
+	reg_write(wdt->regs, IWDG_KR, KR_KEY_EWA);
+	rlr = reg_read(wdt->regs, IWDG_RLR);
+	reg_write(wdt->regs, IWDG_RLR, rlr);
+	ret = readl_poll_timeout(wdt->regs + IWDG_SR, sr, !(sr & SR_RVU), SLEEP_US, TIMEOUT_US);
+	running = ret ? false : true;
+	reg_write(wdt->regs, IWDG_KR, KR_KEY_DWA);
+
+	return running;
+}
+
 static const struct watchdog_info stm32_iwdg_info = {
 	.options	= WDIOF_SETTIMEOUT |
 			  WDIOF_MAGICCLOSE |
@@ -375,16 +404,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	/*
-	 * In case of CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is set
-	 * (Means U-Boot/bootloaders leaves the watchdog running)
-	 * When we get here we should make a decision to prevent
-	 * any side effects before user space daemon will take care of it.
-	 * The best option, taking into consideration that there is no
-	 * way to read values back from hardware, is to enforce watchdog
-	 * being run with deterministic values.
-	 */
-	if (IS_ENABLED(CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED)) {
+	if (stm32_iwdg_is_running(wdt)) {
 		ret = stm32_iwdg_start(wdd);
 		if (ret)
 			return ret;
-- 
2.34.1


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

* [PATCH v4 05/15] watchdog: stm32_iwdg: add pretimeout support for iwdg v4.0
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (3 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 04/15] watchdog: stm32_iwdg: detect whether the watchdog is running Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx Antonio Borneo
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

IWDG hardware version 4.0, used on STM32MP2xx platforms, has an
independent register ICR for acknowledging the pretimeout
interrupts.
This removes the need for serializing the accesses to the
EWCR register, used in previous versions.

Use the interrupt clear register (ICR) to acknowledge pretimeout
interrupts on hardware version 4.0 and later.

Don't check for HW version in stm32_iwdg_start() and always take
the lock. This makes the code simpler, avoiding the version check
and the duplicated write with and without lock, while adding the
negligible cost of the uncontended lock on HW v4.0.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 drivers/watchdog/stm32_iwdg.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index 1a5715ff9fab3..b3d39d916735f 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -31,6 +31,7 @@
 #define IWDG_SR		0x0C /* Status Register */
 #define IWDG_WINR	0x10 /* Windows Register */
 #define IWDG_EWCR	0x14 /* Early Wake-up Register */
+#define IWDG_ICR	0x18 /* Interrupt Clear Register */
 #define IWDG_VERR	0x3F4 /* Version Register */
 
 /* IWDG_KR register bit mask */
@@ -56,11 +57,14 @@
 #define EWCR_EWIC	BIT(14) /* Watchdog early interrupt acknowledge */
 #define EWCR_EWIE	BIT(15) /* Watchdog early interrupt enable */
 
+#define ICR_EWIC	BIT(15) /* Watchdog early interrupt acknowledge */
+
 /* IWDG_VERR register mask */
 #define VERR_MASK	GENMASK(7, 0)
 
 /* IWDG Compatibility */
 #define ONF_MIN_VER	0x31
+#define ICR_MIN_VER	0x40
 
 /* set timeout to 100000 us */
 #define TIMEOUT_US	100000
@@ -203,13 +207,17 @@ static irqreturn_t stm32_iwdg_isr(int irq, void *wdog_arg)
 	unsigned long flags;
 	u32 reg;
 
-	spin_lock_irqsave(&wdt->lock, flags);
+	if (wdt->hw_version >= ICR_MIN_VER) {
+		reg_write(wdt->regs, IWDG_ICR, ICR_EWIC);
+	} else {
+		spin_lock_irqsave(&wdt->lock, flags);
 
-	reg = readl(wdt->regs + IWDG_EWCR);
-	reg |= EWCR_EWIC;
-	writel(reg, wdt->regs + IWDG_EWCR);
+		reg = readl(wdt->regs + IWDG_EWCR);
+		reg |= EWCR_EWIC;
+		writel(reg, wdt->regs + IWDG_EWCR);
 
-	spin_unlock_irqrestore(&wdt->lock, flags);
+		spin_unlock_irqrestore(&wdt->lock, flags);
+	}
 
 	watchdog_notify_pretimeout(wdd);
 
-- 
2.34.1


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

* [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (4 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 05/15] watchdog: stm32_iwdg: add pretimeout support for iwdg v4.0 Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 14:33   ` Guenter Roeck
  2026-11-16 13:24 ` [PATCH v4 07/15] dt-bindings: watchdog: st,stm32-iwdg: add access-controllers property Antonio Borneo
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

The watchdog IWDG1 is secure by default on STM32MP1xx SoCs.
On boards that keep it secure, Linux must use the arm,smc-wdt
driver to ping it.

Enable the driver for mach-stm32 when ARCH_MULTI_V7 is enabled.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm/mach-stm32/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
index 4ac3384e397aa..de09b2afa0f2e 100644
--- a/arch/arm/mach-stm32/Kconfig
+++ b/arch/arm/mach-stm32/Kconfig
@@ -13,6 +13,8 @@ menuconfig ARCH_STM32
 	select RESET_CONTROLLER
 	select STM32_EXTI if ARM_SINGLE_ARMV7M
 	select STM32_FIREWALL
+	select WATCHDOG if ARCH_MULTI_V7
+	select ARM_SMC_WATCHDOG if ARCH_MULTI_V7
 	help
 	  Support for STMicroelectronics STM32MP1 processors using Cortex-A7
 	  cores. Note that support for the earlier Cortex-M based variants
-- 
2.34.1


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

* [PATCH v4 07/15] dt-bindings: watchdog: st,stm32-iwdg: add access-controllers property
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (5 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 08/15] ARM: dts: stm32: add iwdg1 node on stm32mp151 SoC Antonio Borneo
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

Add the optional access-controllers property to reference one
domain access controllers protecting the watchdog peripheral.

Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261106163429.618392-1-antonio.borneo%40foss.st.com?part=5
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml b/Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml
index 86bd39d508500..daf782460bc09 100644
--- a/Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml
+++ b/Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml
@@ -42,6 +42,9 @@ properties:
 
   wakeup-source: true
 
+  access-controllers:
+    maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.34.1


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

* [PATCH v4 08/15] ARM: dts: stm32: add iwdg1 node on stm32mp151 SoC
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (6 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 07/15] dt-bindings: watchdog: st,stm32-iwdg: add access-controllers property Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 09/15] ARM: dts: stm32: enable iwdg1 on stm32mp15x ST boards Antonio Borneo
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

From: Amelie Delaunay <amelie.delaunay@foss.st.com>

On STM32MP15x boards where IWDG1 is exposed as a non-secure
watchdog, Linux must register and periodically ping it if it was
started by an earlier boot stage.

Add the IWDG1 node to the STM32MP151 SoC device tree as a child
of the ETZPC node.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm/boot/dts/st/stm32mp151.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/stm32mp151.dtsi
index ae31883732388..e71b2ab58aa54 100644
--- a/arch/arm/boot/dts/st/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp151.dtsi
@@ -2037,6 +2037,16 @@ i2c4: i2c@5c002000 {
 				status = "disabled";
 			};
 
+			iwdg1: watchdog@5c003000 {
+				compatible = "st,stm32mp1-iwdg";
+				reg = <0x5c003000 0x400>;
+				interrupts = <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&rcc IWDG1>, <&rcc CK_LSI>;
+				clock-names = "pclk", "lsi";
+				access-controllers = <&etzpc 2>;
+				status = "disabled";
+			};
+
 			i2c6: i2c@5c009000 {
 				compatible = "st,stm32mp15-i2c";
 				reg = <0x5c009000 0x400>;
-- 
2.34.1


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

* [PATCH v4 09/15] ARM: dts: stm32: enable iwdg1 on stm32mp15x ST boards
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (7 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 08/15] ARM: dts: stm32: add iwdg1 node on stm32mp151 SoC Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 10/15] ARM: dts: stm32: move arm smc watchdog to stm32mp151 SoC Antonio Borneo
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

From: Amelie Delaunay <amelie.delaunay@foss.st.com>

On STM32MP15x ST boards where IWDG1 is exposed as a non-secure
watchdog, Linux must register and periodically ping it if it was
started by an earlier boot stage.

Enable the IWDG1 node on ST non-SCMI boards that use this
non-secure watchdog configuration.

With two watchdogs now enabled on ST STM32MP1xx boards, assign the
watchdog0 alias to the IWDG1 watchdog that may have been started
by an earlier boot stage. This allows userspace to identify and
ping the appropriate watchdog.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm/boot/dts/st/stm32mp15-scmi.dtsi  | 4 ++++
 arch/arm/boot/dts/st/stm32mp157c-ed1.dts  | 6 ++++++
 arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi | 6 ++++++
 3 files changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/st/stm32mp15-scmi.dtsi b/arch/arm/boot/dts/st/stm32mp15-scmi.dtsi
index 98552fe45d4e0..cc9521b105262 100644
--- a/arch/arm/boot/dts/st/stm32mp15-scmi.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp15-scmi.dtsi
@@ -64,6 +64,10 @@ scmi_usb33: regulator@2 {
 	};
 };
 
+&iwdg1 {
+	status = "disabled";
+};
+
 &reg11 {
 	status = "disabled";
 };
diff --git a/arch/arm/boot/dts/st/stm32mp157c-ed1.dts b/arch/arm/boot/dts/st/stm32mp157c-ed1.dts
index 49dd555cc228c..6c7dfbee29528 100644
--- a/arch/arm/boot/dts/st/stm32mp157c-ed1.dts
+++ b/arch/arm/boot/dts/st/stm32mp157c-ed1.dts
@@ -19,6 +19,7 @@ / {
 
 	aliases {
 		serial0 = &uart4;
+		watchdog0 = &iwdg1;
 	};
 
 	chosen {
@@ -331,6 +332,11 @@ &ipcc {
 	status = "okay";
 };
 
+&iwdg1 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &iwdg2 {
 	timeout-sec = <32>;
 	status = "okay";
diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi
index 1a07ae09afb2a..9722e2ab07794 100644
--- a/arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi
@@ -13,6 +13,7 @@ aliases {
 		serial0 = &uart4;
 		serial1 = &usart3;
 		serial2 = &uart7;
+		watchdog0 = &iwdg1;
 	};
 
 	memory@c0000000 {
@@ -511,6 +512,11 @@ &ipcc {
 	status = "okay";
 };
 
+&iwdg1 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &iwdg2 {
 	timeout-sec = <32>;
 	status = "okay";
-- 
2.34.1


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

* [PATCH v4 10/15] ARM: dts: stm32: move arm smc watchdog to stm32mp151 SoC
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (8 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 09/15] ARM: dts: stm32: enable iwdg1 on stm32mp15x ST boards Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 11/15] ARM: dts: stm32: enable arm smc watchdog on stm32mp15x scmi boards Antonio Borneo
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

On boards where IWDG1 is secure and monitored by OP-TEE, Linux
must control the watchdog through SMC calls.

Move the arm,smc-wdt node to the STM32MP151 SoC device tree so
that board device trees can enable it as needed.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm/boot/dts/st/stm32mp151.dtsi           | 6 ++++++
 arch/arm/boot/dts/st/stm32mp157f-dk2-scmi.dtsi | 7 -------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/stm32mp151.dtsi
index e71b2ab58aa54..d00a36a8c93ba 100644
--- a/arch/arm/boot/dts/st/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp151.dtsi
@@ -31,6 +31,12 @@ arm-pmu {
 		interrupt-parent = <&intc>;
 	};
 
+	arm_wdt: watchdog {
+		compatible = "arm,smc-wdt";
+		arm,smc-id = <0xbc000000>;
+		status = "disabled";
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
diff --git a/arch/arm/boot/dts/st/stm32mp157f-dk2-scmi.dtsi b/arch/arm/boot/dts/st/stm32mp157f-dk2-scmi.dtsi
index 172347769e025..27ea5e79efc66 100644
--- a/arch/arm/boot/dts/st/stm32mp157f-dk2-scmi.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp157f-dk2-scmi.dtsi
@@ -13,13 +13,6 @@ optee@de000000 {
 			no-map;
 		};
 	};
-
-	arm_wdt: watchdog {
-		compatible = "arm,smc-wdt";
-		arm,smc-id = <0xbc000000>;
-		status = "disabled";
-	};
-
 };
 
 &adc {
-- 
2.34.1


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

* [PATCH v4 11/15] ARM: dts: stm32: enable arm smc watchdog on stm32mp15x scmi boards
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (9 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 10/15] ARM: dts: stm32: move arm smc watchdog to stm32mp151 SoC Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 12/15] ARM: dts: stm32: add watchdog0 alias on ST stm32mp1xx boards Antonio Borneo
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

From: Amelie Delaunay <amelie.delaunay@foss.st.com>

On STM32MP15x SCMI boards, IWDG1 is secure and monitored by OP-TEE.

Enable the arm,smc-wdt node on ST SCMI board variants so that
Linux can control the secure watchdog through SMC calls.

With two watchdogs now enabled on ST STM32MP1xx boards, assign the
watchdog0 alias to the ARM SMC watchdog that may have been started
by an earlier boot stage. This allows userspace to identify and
ping the appropriate watchdog.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts | 9 +++++++++
 arch/arm/boot/dts/st/stm32mp157c-dk2-scmi.dts | 9 +++++++++
 arch/arm/boot/dts/st/stm32mp157c-ed1-scmi.dts | 9 +++++++++
 arch/arm/boot/dts/st/stm32mp157c-ev1-scmi.dts | 9 +++++++++
 4 files changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts b/arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts
index 53e40e2f776b7..2f4d212de3e9c 100644
--- a/arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts
+++ b/arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts
@@ -13,6 +13,10 @@ / {
 	model = "STMicroelectronics STM32MP157A-DK1 SCMI Discovery Board";
 	compatible = "st,stm32mp157a-dk1-scmi", "st,stm32mp157";
 
+	aliases {
+		watchdog0 = &arm_wdt;
+	};
+
 	reserved-memory {
 		optee@de000000 {
 			reg = <0xde000000 0x2000000>;
@@ -21,6 +25,11 @@ optee@de000000 {
 	};
 };
 
+&arm_wdt {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &cpu0 {
 	clocks = <&scmi_clk CK_SCMI_MPU>;
 };
diff --git a/arch/arm/boot/dts/st/stm32mp157c-dk2-scmi.dts b/arch/arm/boot/dts/st/stm32mp157c-dk2-scmi.dts
index 0790ed426ebc0..41ba8a5b756b1 100644
--- a/arch/arm/boot/dts/st/stm32mp157c-dk2-scmi.dts
+++ b/arch/arm/boot/dts/st/stm32mp157c-dk2-scmi.dts
@@ -13,6 +13,10 @@ / {
 	model = "STMicroelectronics STM32MP157C-DK2 SCMI Discovery Board";
 	compatible = "st,stm32mp157c-dk2-scmi", "st,stm32mp157";
 
+	aliases {
+		watchdog0 = &arm_wdt;
+	};
+
 	reserved-memory {
 		optee@de000000 {
 			reg = <0xde000000 0x2000000>;
@@ -21,6 +25,11 @@ optee@de000000 {
 	};
 };
 
+&arm_wdt {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &cpu0 {
 	clocks = <&scmi_clk CK_SCMI_MPU>;
 };
diff --git a/arch/arm/boot/dts/st/stm32mp157c-ed1-scmi.dts b/arch/arm/boot/dts/st/stm32mp157c-ed1-scmi.dts
index 0a3894aff4aea..2fad04ed60161 100644
--- a/arch/arm/boot/dts/st/stm32mp157c-ed1-scmi.dts
+++ b/arch/arm/boot/dts/st/stm32mp157c-ed1-scmi.dts
@@ -13,6 +13,10 @@ / {
 	model = "STMicroelectronics STM32MP157C-ED1 SCMI eval daughter";
 	compatible = "st,stm32mp157c-ed1-scmi", "st,stm32mp157";
 
+	aliases {
+		watchdog0 = &arm_wdt;
+	};
+
 	reserved-memory {
 		optee@fe000000 {
 			reg = <0xfe000000 0x2000000>;
@@ -21,6 +25,11 @@ optee@fe000000 {
 	};
 };
 
+&arm_wdt {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &cpu0 {
 	clocks = <&scmi_clk CK_SCMI_MPU>;
 };
diff --git a/arch/arm/boot/dts/st/stm32mp157c-ev1-scmi.dts b/arch/arm/boot/dts/st/stm32mp157c-ev1-scmi.dts
index c2b6efb1cbb74..d14506e9b6f0e 100644
--- a/arch/arm/boot/dts/st/stm32mp157c-ev1-scmi.dts
+++ b/arch/arm/boot/dts/st/stm32mp157c-ev1-scmi.dts
@@ -13,6 +13,10 @@ / {
 	model = "STMicroelectronics STM32MP157C-EV1 SCMI eval daughter on eval mother";
 	compatible = "st,stm32mp157c-ev1-scmi", "st,stm32mp157c-ed1", "st,stm32mp157";
 
+	aliases {
+		watchdog0 = &arm_wdt;
+	};
+
 	reserved-memory {
 		optee@fe000000 {
 			reg = <0xfe000000 0x2000000>;
@@ -21,6 +25,11 @@ optee@fe000000 {
 	};
 };
 
+&arm_wdt {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &cpu0 {
 	clocks = <&scmi_clk CK_SCMI_MPU>;
 };
-- 
2.34.1


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

* [PATCH v4 12/15] ARM: dts: stm32: add watchdog0 alias on ST stm32mp1xx boards
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (10 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 11/15] ARM: dts: stm32: enable arm smc watchdog on stm32mp15x scmi boards Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 13/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp231 Antonio Borneo
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

With two watchdogs enabled on ST STM32MP1xx boards, assign the
watchdog0 alias to the watchdog that may have been started by an
earlier boot stage.

This allows userspace to identify and ping the appropriate
watchdog.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm/boot/dts/st/stm32mp135f-dk.dts  | 1 +
 arch/arm/boot/dts/st/stm32mp157f-dk2.dts | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/st/stm32mp135f-dk.dts b/arch/arm/boot/dts/st/stm32mp135f-dk.dts
index 2d6c5af7e4816..bd403acb1577f 100644
--- a/arch/arm/boot/dts/st/stm32mp135f-dk.dts
+++ b/arch/arm/boot/dts/st/stm32mp135f-dk.dts
@@ -24,6 +24,7 @@ aliases {
 		serial1 = &usart1;
 		serial2 = &uart8;
 		serial3 = &usart2;
+		watchdog0 = &arm_wdt;
 	};
 
 	chosen {
diff --git a/arch/arm/boot/dts/st/stm32mp157f-dk2.dts b/arch/arm/boot/dts/st/stm32mp157f-dk2.dts
index 8fa61e54d0261..02697c41a2f6c 100644
--- a/arch/arm/boot/dts/st/stm32mp157f-dk2.dts
+++ b/arch/arm/boot/dts/st/stm32mp157f-dk2.dts
@@ -20,6 +20,7 @@ / {
 	aliases {
 		ethernet0 = &ethernet0;
 		serial3 = &usart2;
+		watchdog0 = &arm_wdt;
 	};
 
 	chosen {
-- 
2.34.1


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

* [PATCH v4 13/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp231
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (11 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 12/15] ARM: dts: stm32: add watchdog0 alias on ST stm32mp1xx boards Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 14/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp251 Antonio Borneo
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

Add the watchdog nodes to the SoC device tree.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm64/boot/dts/st/stm32mp231.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp231.dtsi b/arch/arm64/boot/dts/st/stm32mp231.dtsi
index fefbf6f4f1537..db19429896eb3 100644
--- a/arch/arm64/boot/dts/st/stm32mp231.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp231.dtsi
@@ -724,6 +724,26 @@ rng: rng@42020000 {
 				status = "disabled";
 			};
 
+			iwdg1: watchdog@44010000 {
+				compatible = "st,stm32mp1-iwdg";
+				reg = <0x44010000 0x400>;
+				interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&rcc CK_BUS_IWDG1>, <&scmi_clk CK_SCMI_LSI>;
+				clock-names = "pclk", "lsi";
+				access-controllers = <&rifsc 98>;
+				status = "disabled";
+			};
+
+			iwdg2: watchdog@44020000 {
+				compatible = "st,stm32mp1-iwdg";
+				reg = <0x44020000 0x400>;
+				interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&rcc CK_BUS_IWDG2>, <&scmi_clk CK_SCMI_LSI>;
+				clock-names = "pclk", "lsi";
+				access-controllers = <&rifsc 99>;
+				status = "disabled";
+			};
+
 			spi8: spi@46020000 {
 				compatible = "st,stm32mp25-spi";
 				reg = <0x46020000 0x400>;
-- 
2.34.1


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

* [PATCH v4 14/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp251
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (12 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 13/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp231 Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 13:24 ` [PATCH v4 15/15] arm64: dts: st: enable iwdg2 on stm32mp2xx ST boards Antonio Borneo
  2026-11-16 14:37 ` [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Guenter Roeck
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

From: Clément Le Goffic <clement.legoffic@foss.st.com>

Add the watchdog nodes to the SoC device tree.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm64/boot/dts/st/stm32mp251.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index dac3d2d23ff00..02064fd05a259 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -1474,6 +1474,26 @@ rng: rng@42020000 {
 				status = "disabled";
 			};
 
+			iwdg1: watchdog@44010000 {
+				compatible = "st,stm32mp1-iwdg";
+				reg = <0x44010000 0x400>;
+				interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&rcc CK_BUS_IWDG1>, <&scmi_clk CK_SCMI_LSI>;
+				clock-names = "pclk", "lsi";
+				access-controllers = <&rifsc 98>;
+				status = "disabled";
+			};
+
+			iwdg2: watchdog@44020000 {
+				compatible = "st,stm32mp1-iwdg";
+				reg = <0x44020000 0x400>;
+				interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&rcc CK_BUS_IWDG2>, <&scmi_clk CK_SCMI_LSI>;
+				clock-names = "pclk", "lsi";
+				access-controllers = <&rifsc 99>;
+				status = "disabled";
+			};
+
 			spi8: spi@46020000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
-- 
2.34.1


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

* [PATCH v4 15/15] arm64: dts: st: enable iwdg2 on stm32mp2xx ST boards
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (13 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 14/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp251 Antonio Borneo
@ 2026-11-16 13:24 ` Antonio Borneo
  2026-11-16 14:37 ` [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Guenter Roeck
  15 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 13:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, Russell King, Wim Van Sebroeck, Guenter Roeck,
	Yannick Fertre, Christophe Roullier, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel
  Cc: Antonio Borneo, linux-watchdog, Clément Le Goffic,
	Amelie Delaunay, Sashiko

Enable the node for IWDG2 in the STM32MP2xx ST boards to make the
watchdog available for userspace.

With two watchdogs now enabled on ST STM32MP2xx boards, assign the
watchdog0 alias to the ARM SMC watchdog that may have been started
by an earlier boot stage. This allows userspace to identify and
ping the appropriate watchdog.

While there, sort alphabetically the aliases.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
---
 arch/arm64/boot/dts/st/stm32mp235f-dk.dts  | 6 ++++++
 arch/arm64/boot/dts/st/stm32mp257f-dk.dts  | 8 +++++++-
 arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 6 ++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/st/stm32mp235f-dk.dts b/arch/arm64/boot/dts/st/stm32mp235f-dk.dts
index f06b334dc9ce1..c71b914547308 100644
--- a/arch/arm64/boot/dts/st/stm32mp235f-dk.dts
+++ b/arch/arm64/boot/dts/st/stm32mp235f-dk.dts
@@ -22,6 +22,7 @@ / {
 	aliases {
 		ethernet0 = &ethernet1;
 		serial0 = &usart2;
+		watchdog0 = &arm_wdt;
 	};
 
 	chosen {
@@ -263,6 +264,11 @@ &i2c8 {
 	/delete-property/dma-names;
 };
 
+&iwdg2 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &ltdc {
 	status = "okay";
 	port {
diff --git a/arch/arm64/boot/dts/st/stm32mp257f-dk.dts b/arch/arm64/boot/dts/st/stm32mp257f-dk.dts
index a8f18508db3e4..aa922abccdbc5 100644
--- a/arch/arm64/boot/dts/st/stm32mp257f-dk.dts
+++ b/arch/arm64/boot/dts/st/stm32mp257f-dk.dts
@@ -21,9 +21,10 @@ / {
 
 	aliases {
 		ethernet0 = &ethernet1;
-		serial0 = &usart2;
 		mmc0 = &sdmmc1;
 		mmc1 = &sdmmc2;
+		serial0 = &usart2;
+		watchdog0 = &arm_wdt;
 	};
 
 	chosen {
@@ -271,6 +272,11 @@ &i2c8 {
 	/delete-property/dma-names;
 };
 
+&iwdg2 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 &ltdc {
 	status = "okay";
 	port {
diff --git a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
index 782b4bb843eeb..dcfc29c620b02 100644
--- a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
+++ b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
@@ -24,6 +24,7 @@ aliases {
 		ethernet1 = &ethernet1;
 		serial0 = &usart2;
 		serial1 = &usart6;
+		watchdog0 = &arm_wdt;
 	};
 
 	chosen {
@@ -294,6 +295,11 @@ &i2c8 {
 	/delete-property/dma-names;
 };
 
+&iwdg2 {
+	timeout-sec = <32>;
+	status = "okay";
+};
+
 /* use LPTIMER with tick broadcast for suspend mode */
 &lptimer3 {
 	status = "okay";
-- 
2.34.1


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

* Re: [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx
  2026-11-16 13:24 ` [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx Antonio Borneo
@ 2026-11-16 14:33   ` Guenter Roeck
  2026-11-16 16:45     ` Antonio Borneo
  0 siblings, 1 reply; 21+ messages in thread
From: Guenter Roeck @ 2026-11-16 14:33 UTC (permalink / raw)
  To: Antonio Borneo, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, Russell King,
	Wim Van Sebroeck, Yannick Fertre, Christophe Roullier,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel
  Cc: linux-watchdog, Clément Le Goffic, Amelie Delaunay, Sashiko

On 11/16/26 05:24, Antonio Borneo wrote:
> The watchdog IWDG1 is secure by default on STM32MP1xx SoCs.
> On boards that keep it secure, Linux must use the arm,smc-wdt
> driver to ping it.
> 
> Enable the driver for mach-stm32 when ARCH_MULTI_V7 is enabled.
> 

As mentioned before, that doesn't just enable it for STM32MP1xx SoCs,
it force-enables it for all boards running ARCH_MULTI_V7. It also
goes well beyond the current scope of "if ARCH_MULTI_V7" configurations.
I would suggest NACK for that reason, but that isn't my call to make.

Guenter

> Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
> ---
>   arch/arm/mach-stm32/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
> index 4ac3384e397aa..de09b2afa0f2e 100644
> --- a/arch/arm/mach-stm32/Kconfig
> +++ b/arch/arm/mach-stm32/Kconfig
> @@ -13,6 +13,8 @@ menuconfig ARCH_STM32
>   	select RESET_CONTROLLER
>   	select STM32_EXTI if ARM_SINGLE_ARMV7M
>   	select STM32_FIREWALL
> +	select WATCHDOG if ARCH_MULTI_V7
> +	select ARM_SMC_WATCHDOG if ARCH_MULTI_V7
>   	help
>   	  Support for STMicroelectronics STM32MP1 processors using Cortex-A7
>   	  cores. Note that support for the earlier Cortex-M based variants


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

* Re: [PATCH v4 00/15] Update watchdogs support on STM32MP platforms
  2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
                   ` (14 preceding siblings ...)
  2026-11-16 13:24 ` [PATCH v4 15/15] arm64: dts: st: enable iwdg2 on stm32mp2xx ST boards Antonio Borneo
@ 2026-11-16 14:37 ` Guenter Roeck
  15 siblings, 0 replies; 21+ messages in thread
From: Guenter Roeck @ 2026-11-16 14:37 UTC (permalink / raw)
  To: Antonio Borneo, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, Russell King,
	Wim Van Sebroeck, Yannick Fertre, Christophe Roullier,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel
  Cc: linux-watchdog, Clément Le Goffic, Amelie Delaunay, Sashiko

On 11/16/26 05:24, Antonio Borneo wrote:
> This series allows the stm32_iwdg watchdog driver to determine
> whether the watchdog is already running and adds support for
> STM32MP2xx devices.
> 
> It also completes and rationalizes the configuration of secure and
> non-secure watchdogs across STM32MP devices and ST boards.
> 
> For STM32MP1xx devices, it enables the ARM SMC watchdog driver in
> the machine Kconfig.
> 

Applied: watchdog: stm32_iwdg: set driver data before requesting interrupt
Applied: watchdog: stm32_iwdg: serialize accesses to EWCR register
Applied: watchdog: stm32_iwdg: get hardware version during probe
Applied: watchdog: stm32_iwdg: detect whether the watchdog is running
Applied: watchdog: stm32_iwdg: add pretimeout support for iwdg v4.0

Thanks,
Guenter


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

* Re: [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx
  2026-11-16 14:33   ` Guenter Roeck
@ 2026-11-16 16:45     ` Antonio Borneo
  2026-11-16 18:00       ` Guenter Roeck
  0 siblings, 1 reply; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 16:45 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, Russell King,
	Wim Van Sebroeck, Yannick Fertre, Christophe Roullier,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel
  Cc: linux-watchdog, Clément Le Goffic, Amelie Delaunay, Sashiko

On Mon, 2026-11-16 at 06:33 -0800, Guenter Roeck wrote:
> On 11/16/26 05:24, Antonio Borneo wrote:
> > The watchdog IWDG1 is secure by default on STM32MP1xx SoCs.
> > On boards that keep it secure, Linux must use the arm,smc-wdt
> > driver to ping it.
> > 
> > Enable the driver for mach-stm32 when ARCH_MULTI_V7 is enabled.
> > 
> 
> As mentioned before, that doesn't just enable it for STM32MP1xx SoCs,
> it force-enables it for all boards running ARCH_MULTI_V7. It also
> goes well beyond the current scope of "if ARCH_MULTI_V7" configurations.
> I would suggest NACK for that reason, but that isn't my call to make.
> 
> Guenter

Hi Guenter,

sorry if I take more of your time on this, but I haven't got your comments on
my reply to this patch as v3 04/13.

On platforms STM32MP1xx the trusted firmware starts the watchdog.
Since on such platforms the defconfig is multi_v7_defconfig, the upstream kernel
configured with multi_v7_defconfig would need ARM_SMC_WATCHDOG to prevent a reset
during kernel boot.

Clearly, my wish is to have an upstream kernel booting properly with defconfig.

arch/arm/mach-stm32/Kconfig handles two series of ARCH_STM32:
- the deprecated ARMv7M platforms that use stm32_defconfig;
- the ARMv7A platforms that use multi_v7_defconfig.

In this patch the condition 'if ARCH_MULTI_V7' is to enable the watchdog only
on ARMv7A, not on ARMv7M.

Clearly any driver enabled for ARCH_STM32 will automatically be enabled for
the other SoC that rely on the same defconfig.

Also reworking this patch by moving the change in drivers/watchdog/Kconfig as

 config ARM_SMC_WATCHDOG
+	default y if (ARCH_STM32 && ARCH_MULTI_V7)

would still result in the arm SMC watchdog enabled for all the SoC that use
multi_v7_defconfig.

What would be your suggestion to progress on this topic?

Thanks,
Antonio


> 
> > Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
> > ---
> >   arch/arm/mach-stm32/Kconfig | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
> > index 4ac3384e397aa..de09b2afa0f2e 100644
> > --- a/arch/arm/mach-stm32/Kconfig
> > +++ b/arch/arm/mach-stm32/Kconfig
> > @@ -13,6 +13,8 @@ menuconfig ARCH_STM32
> >         select RESET_CONTROLLER
> >         select STM32_EXTI if ARM_SINGLE_ARMV7M
> >         select STM32_FIREWALL
> > +       select WATCHDOG if ARCH_MULTI_V7
> > +       select ARM_SMC_WATCHDOG if ARCH_MULTI_V7
> >         help
> >           Support for STMicroelectronics STM32MP1 processors using Cortex-A7
> >           cores. Note that support for the earlier Cortex-M based variants
> 


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

* Re: [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx
  2026-11-16 16:45     ` Antonio Borneo
@ 2026-11-16 18:00       ` Guenter Roeck
  2026-11-16 18:26         ` Antonio Borneo
  0 siblings, 1 reply; 21+ messages in thread
From: Guenter Roeck @ 2026-11-16 18:00 UTC (permalink / raw)
  To: Antonio Borneo, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, Russell King,
	Wim Van Sebroeck, Yannick Fertre, Christophe Roullier,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel
  Cc: linux-watchdog, Clément Le Goffic, Amelie Delaunay, Sashiko

On 11/16/26 08:45, Antonio Borneo wrote:
> On Mon, 2026-11-16 at 06:33 -0800, Guenter Roeck wrote:
>> On 11/16/26 05:24, Antonio Borneo wrote:
>>> The watchdog IWDG1 is secure by default on STM32MP1xx SoCs.
>>> On boards that keep it secure, Linux must use the arm,smc-wdt
>>> driver to ping it.
>>>
>>> Enable the driver for mach-stm32 when ARCH_MULTI_V7 is enabled.
>>>
>>
>> As mentioned before, that doesn't just enable it for STM32MP1xx SoCs,
>> it force-enables it for all boards running ARCH_MULTI_V7. It also
>> goes well beyond the current scope of "if ARCH_MULTI_V7" configurations.
>> I would suggest NACK for that reason, but that isn't my call to make.
>>
>> Guenter
> 
> Hi Guenter,
> 
> sorry if I take more of your time on this, but I haven't got your comments on
> my reply to this patch as v3 04/13.
> 
> On platforms STM32MP1xx the trusted firmware starts the watchdog.
> Since on such platforms the defconfig is multi_v7_defconfig, the upstream kernel
> configured with multi_v7_defconfig would need ARM_SMC_WATCHDOG to prevent a reset
> during kernel boot.
> 
> Clearly, my wish is to have an upstream kernel booting properly with defconfig.
> 
> arch/arm/mach-stm32/Kconfig handles two series of ARCH_STM32:
> - the deprecated ARMv7M platforms that use stm32_defconfig;
> - the ARMv7A platforms that use multi_v7_defconfig.
> 
> In this patch the condition 'if ARCH_MULTI_V7' is to enable the watchdog only
> on ARMv7A, not on ARMv7M.
> 
> Clearly any driver enabled for ARCH_STM32 will automatically be enabled for
> the other SoC that rely on the same defconfig.
> 
> Also reworking this patch by moving the change in drivers/watchdog/Kconfig as
> 
>   config ARM_SMC_WATCHDOG
> +	default y if (ARCH_STM32 && ARCH_MULTI_V7)
> 
> would still result in the arm SMC watchdog enabled for all the SoC that use
> multi_v7_defconfig.
> 
> What would be your suggestion to progress on this topic?
> 

No. As you say yourself above, "the upstream kernel configured with
multi_v7_defconfig would need ARM_SMC_WATCHDOG to prevent a reset during
kernel boot". I fail to understand why you don't just add
"CONFIG_ARM_SMC_WATCHDOG=m" to multi_v7_defconfig and instead want to
force every single platform using multi_v7_defconfig to build this driver
into the kernel even though almost all of them won't need (or want) it.

Guenter


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

* Re: [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx
  2026-11-16 18:00       ` Guenter Roeck
@ 2026-11-16 18:26         ` Antonio Borneo
  0 siblings, 0 replies; 21+ messages in thread
From: Antonio Borneo @ 2026-11-16 18:26 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, Russell King,
	Wim Van Sebroeck, Yannick Fertre, Christophe Roullier,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel
  Cc: linux-watchdog, Clément Le Goffic, Amelie Delaunay, Sashiko

On Mon, 2026-11-16 at 10:00 -0800, Guenter Roeck wrote:
> On 11/16/26 08:45, Antonio Borneo wrote:
> > On Mon, 2026-11-16 at 06:33 -0800, Guenter Roeck wrote:
> > > On 11/16/26 05:24, Antonio Borneo wrote:
> > > > The watchdog IWDG1 is secure by default on STM32MP1xx SoCs.
> > > > On boards that keep it secure, Linux must use the arm,smc-wdt
> > > > driver to ping it.
> > > > 
> > > > Enable the driver for mach-stm32 when ARCH_MULTI_V7 is enabled.
> > > > 
> > > 
> > > As mentioned before, that doesn't just enable it for STM32MP1xx SoCs,
> > > it force-enables it for all boards running ARCH_MULTI_V7. It also
> > > goes well beyond the current scope of "if ARCH_MULTI_V7" configurations.
> > > I would suggest NACK for that reason, but that isn't my call to make.
> > > 
> > > Guenter
> > 
> > Hi Guenter,
> > 
> > sorry if I take more of your time on this, but I haven't got your comments on
> > my reply to this patch as v3 04/13.
> > 
> > On platforms STM32MP1xx the trusted firmware starts the watchdog.
> > Since on such platforms the defconfig is multi_v7_defconfig, the upstream kernel
> > configured with multi_v7_defconfig would need ARM_SMC_WATCHDOG to prevent a reset
> > during kernel boot.
> > 
> > Clearly, my wish is to have an upstream kernel booting properly with defconfig.
> > 
> > arch/arm/mach-stm32/Kconfig handles two series of ARCH_STM32:
> > - the deprecated ARMv7M platforms that use stm32_defconfig;
> > - the ARMv7A platforms that use multi_v7_defconfig.
> > 
> > In this patch the condition 'if ARCH_MULTI_V7' is to enable the watchdog only
> > on ARMv7A, not on ARMv7M.
> > 
> > Clearly any driver enabled for ARCH_STM32 will automatically be enabled for
> > the other SoC that rely on the same defconfig.
> > 
> > Also reworking this patch by moving the change in drivers/watchdog/Kconfig as
> > 
> >   config ARM_SMC_WATCHDOG
> > +       default y if (ARCH_STM32 && ARCH_MULTI_V7)
> > 
> > would still result in the arm SMC watchdog enabled for all the SoC that use
> > multi_v7_defconfig.
> > 
> > What would be your suggestion to progress on this topic?
> > 
> 
> No. As you say yourself above, "the upstream kernel configured with
> multi_v7_defconfig would need ARM_SMC_WATCHDOG to prevent a reset during
> kernel boot". I fail to understand why you don't just add
> "CONFIG_ARM_SMC_WATCHDOG=m" to multi_v7_defconfig and instead want to
> force every single platform using multi_v7_defconfig to build this driver
> into the kernel even though almost all of them won't need (or want) it.

Thanks for the clarification. Understand your point.
So let's drop this patch from this series.
I will send separately the proposal for multi_v7_defconfig.

Best Regards,
Antonio


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

end of thread, other threads:[~2026-11-16 18:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 13:24 [PATCH v4 00/15] Update watchdogs support on STM32MP platforms Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 01/15] watchdog: stm32_iwdg: set driver data before requesting interrupt Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 02/15] watchdog: stm32_iwdg: serialize accesses to EWCR register Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 03/15] watchdog: stm32_iwdg: get hardware version during probe Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 04/15] watchdog: stm32_iwdg: detect whether the watchdog is running Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 05/15] watchdog: stm32_iwdg: add pretimeout support for iwdg v4.0 Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 06/15] ARM: stm32: enable arm smc watchdog on stm32mp1xx Antonio Borneo
2026-11-16 14:33   ` Guenter Roeck
2026-11-16 16:45     ` Antonio Borneo
2026-11-16 18:00       ` Guenter Roeck
2026-11-16 18:26         ` Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 07/15] dt-bindings: watchdog: st,stm32-iwdg: add access-controllers property Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 08/15] ARM: dts: stm32: add iwdg1 node on stm32mp151 SoC Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 09/15] ARM: dts: stm32: enable iwdg1 on stm32mp15x ST boards Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 10/15] ARM: dts: stm32: move arm smc watchdog to stm32mp151 SoC Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 11/15] ARM: dts: stm32: enable arm smc watchdog on stm32mp15x scmi boards Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 12/15] ARM: dts: stm32: add watchdog0 alias on ST stm32mp1xx boards Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 13/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp231 Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 14/15] arm64: dts: st: add iwdg1 and iwdg2 support to stm32mp251 Antonio Borneo
2026-11-16 13:24 ` [PATCH v4 15/15] arm64: dts: st: enable iwdg2 on stm32mp2xx ST boards Antonio Borneo
2026-11-16 14:37 ` [PATCH v4 00/15] Update watchdogs support on STM32MP platforms 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®