imx: Switch watchdog addressing from macros to devicetree
v2 cover imx: Switch watchdog addressing from macros to devicetree
CI: https://github.com/u-boot/u-boot/pull/935/checks
Changes for v2:
- Iterate all watchdog nodes in device tree instead of wdog alias
- Delete non-DM implementation of the ULP watchdog driver
---
Alice Guo (5):
imx: soc: Get watchdog base addresses from device tree
arm: dts: imx: Update watchdog nodes for dynamic base address lookup
watchdog: ulp_wdog: Use driver model for reset_cpu()
arm: dts: imx: Enable watchdog driver model support
imx: Remove hardcoded watchdog base address macros
arch/arm/dts/imx7ulp.dtsi | 6 ++ arch/arm/dts/imx8ulp-evk-u-boot.dtsi | 4 -- arch/arm/dts/imx8ulp-u-boot.dtsi | 4 ++ arch/arm/dts/imx91-u-boot.dtsi | 12 ++++ arch/arm/dts/imx93-u-boot.dtsi | 12 ++++ arch/arm/dts/imx93.dtsi | 18 ++++++ arch/arm/dts/imx943-evk-u-boot.dtsi | 4 -- arch/arm/dts/imx943-u-boot.dtsi | 16 +++++ arch/arm/dts/imx95-15x15-evk-u-boot.dtsi | 4 -- arch/arm/dts/imx95-19x19-evk-u-boot.dtsi | 4 -- arch/arm/dts/imx95-toradex-smarc-dev-u-boot.dtsi | 4 -- arch/arm/dts/imx95-u-boot.dtsi | 14 +++++ arch/arm/dts/imx952-u-boot.dtsi | 14 +++++ arch/arm/include/asm/arch-imx8ulp/imx-regs.h | 2 - arch/arm/include/asm/arch-imx9/imx-regs.h | 9 --- arch/arm/mach-imx/imx8ulp/soc.c | 14 ++++- arch/arm/mach-imx/imx9/scmi/soc.c | 15 ++++- arch/arm/mach-imx/imx9/soc.c | 16 ++++- arch/arm/mach-imx/mx7ulp/soc.c | 24 +++++-- configs/imx8ulp_evk_defconfig | 1 + configs/imx93-phycore_defconfig | 1 + configs/imx943_evk_defconfig | 1 + configs/imx95_15x15_evk_defconfig | 1 + configs/imx95_evk.config | 1 + configs/mx7ulp_com_defconfig | 1 + configs/toradex-smarc-imx95_defconfig | 1 + drivers/watchdog/ulp_wdog.c | 79 +++++++++--------------- include/configs/imx8ulp_evk.h | 2 - include/configs/imx91_evk.h | 2 - include/configs/imx91_frdm.h | 2 - include/configs/imx93_evk.h | 3 - include/configs/imx93_frdm.h | 3 - include/configs/imx93_qsb.h | 2 - include/configs/imx93_var_som.h | 3 - include/configs/imx94_evk.h | 3 - include/configs/imx95_evk.h | 2 - include/configs/kontron-osm-s-mx93.h | 2 - include/configs/mx7ulp_com.h | 3 - include/configs/mx7ulp_evk.h | 3 - include/configs/phycore_imx91_93.h | 3 - include/configs/toradex-smarc-imx95.h | 2 - 41 files changed, 187 insertions(+), 130 deletions(-)
---
base-commit: e3405917a1806971d9e72a94186b299f05581e1a
change-id: 20260421-wdt-0e95080be4d4
Best regards,
Signature · 1 line
Alice Guo <[email protected]>
PATCH v2 1/5 imx: soc: Get watchdog base addresses from device tree
From: Alice Guo <[email protected]>
Replace hardcoded watchdog base addresses with dynamic address lookup from device tree for i.MX7ULP, i.MX8ULP, i.MX91, i.MX93, i.MX943, i.MX95 and i.MX952.
Move i.MX7ULP watchdog initialization from s_init() to arch_cpu_init() because ofnode_* APIs depend on FDT, which is not available during s_init().
--- arch/arm/mach-imx/imx8ulp/soc.c | 14 +++++++++++++- arch/arm/mach-imx/imx9/scmi/soc.c | 15 ++++++++++++--- arch/arm/mach-imx/imx9/soc.c | 16 +++++++++++++--- arch/arm/mach-imx/mx7ulp/soc.c | 24 ++++++++++++++++++------ 4 files changed, 56 insertions(+), 13 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +13 -1
@@ -343,7 +343,19 @@ static void disable_wdog(void __iomem *wdog_base)void init_wdog (void ) { -disable_wdog ((void __iomem *)WDG3_RBASE ); +ofnode node; + +for (node =ofnode_by_compatible (ofnode_null (),"fsl,imx8ulp-wdt" ); +ofnode_valid (node); + node =ofnode_by_compatible (node,"fsl,imx8ulp-wdt" )) { +phys_addr_t base; + + base =ofnode_get_addr (node); +if (base ==FDT_ADDR_T_NONE ) +continue ; + +disable_wdog ((void __iomem *)base); + } }static struct mm_region imx8ulp_arm64_mem_map[] = {
arch/arm/mach-imx/imx9/scmi/soc.c +12 -3
@@ -786,9 +786,18 @@ static void gpio_reset(ulong gpio_base)int arch_cpu_init (void ) {if (IS_ENABLED (CONFIG_SPL_BUILD )) { -if (!IS_ENABLED (CONFIG_IMX952 )) { -disable_wdog ((void __iomem *)WDG3_BASE_ADDR ); -disable_wdog ((void __iomem *)WDG4_BASE_ADDR ); +ofnode node; + +for (node =ofnode_by_compatible (ofnode_null (),"fsl,imx93-wdt" ); +ofnode_valid (node); + node =ofnode_by_compatible (node,"fsl,imx93-wdt" )) { +phys_addr_t base; + + base =ofnode_get_addr (node); +if (base ==FDT_ADDR_T_NONE ) +continue ; + +disable_wdog ((void __iomem *)base); }gpio_reset (GPIO2_BASE_ADDR );
arch/arm/mach-imx/imx9/soc.c +13 -3
@@ -281,9 +281,19 @@ static void disable_wdog(void __iomem *wdog_base)void init_wdog (void ) { -disable_wdog ((void __iomem *)WDG3_BASE_ADDR ); -disable_wdog ((void __iomem *)WDG4_BASE_ADDR ); -disable_wdog ((void __iomem *)WDG5_BASE_ADDR ); +ofnode node; + +for (node =ofnode_by_compatible (ofnode_null (),"fsl,imx93-wdt" ); +ofnode_valid (node); + node =ofnode_by_compatible (node,"fsl,imx93-wdt" )) { +phys_addr_t base; + + base =ofnode_get_addr (node); +if (base ==FDT_ADDR_T_NONE ) +continue ; + +disable_wdog ((void __iomem *)base); + } }static struct mm_region imx93_mem_map[] = {
arch/arm/mach-imx/mx7ulp/soc.c +18 -6
@@ -83,8 +83,12 @@ enum bt_mode get_boot_mode(void)return LOW_POWER_BOOT ; } +static void init_wdog (void );int arch_cpu_init (void ) { +/* Disable wdog */ +init_wdog (); +enable_ca7_smp ();return 0 ; }
@@ -146,7 +150,7 @@ static void disable_wdog(u32 wdog_base)while (!(readl (wdog_base +0x00 ) &0x400 )); } -void init_wdog (void ) +static void init_wdog (void ) {/* * ROM will configure WDOG1, disable it or enable it
@@ -161,8 +165,19 @@ void init_wdog(void)* In this function, we will disable both WDOG1 and WDOG2, * and set update bit for both. So that kernel can reconfigure them. */ -disable_wdog (WDG1_RBASE ); -disable_wdog (WDG2_RBASE ); +ofnode node; + +for (node =ofnode_by_compatible (ofnode_null (),"fsl,imx7ulp-wdt" ); +ofnode_valid (node); + node =ofnode_by_compatible (node,"fsl,imx7ulp-wdt" )) { +phys_addr_t base; + + base =ofnode_get_addr (node); +if (base ==FDT_ADDR_T_NONE ) +continue ; + +disable_wdog ((u32 )base); + } }static bool ldo_mode_is_enabled (void )
@@ -221,9 +236,6 @@ static void init_ldo_mode(void)void s_init (void ) { -/* Disable wdog */ -init_wdog (); -/* clock configuration. */ clock_init ();
Signature · 1 line
2.34.1
PATCH v2 2/5 arm: dts: imx: Update watchdog nodes for dynamic base address lookup
In reply to [email protected]From: Alice Guo <[email protected]>
Update watchdog device tree nodes to enable dynamic base address retrieval for i.MX7ULP, i.MX8ULP, i.MX91, i.MX93, i.MX943, i.MX95 and i.MX952. This allows the bootloader to obtain watchdog base addresses from the device tree instead of using hardcoded values.
- imx7ulp: Add wdog2 node
- imx8ulp: Mark wdog3 available
- imx91/imx93: Add wdog4 and wdog5 nodes
Mark wdog3/wdog4/wdog5 available
- imx943: Add wdog4 node and mark wdog3/wdog4 available
- imx95/imx952: Add wdog4 node and mark wdog3/wdog4 available
Watchdog nodes are marked with "bootph-all" to ensure availability during early boot stages when init_wdog() occurs.
--- arch/arm/dts/imx7ulp.dtsi | 6 ++++++ arch/arm/dts/imx8ulp-u-boot.dtsi | 4 ++++ arch/arm/dts/imx91-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx93-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx93.dtsi | 18 ++++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 16 ++++++++++++++++ arch/arm/dts/imx95-u-boot.dtsi | 14 ++++++++++++++ arch/arm/dts/imx952-u-boot.dtsi | 14 ++++++++++++++ 8 files changed, 96 insertions(+)
arch/arm/dts/imx7ulp.dtsi +6 -0
@@ -295,6 +295,12 @@ clock-names = "divcore", "hsrun_divcore"; }; + wdog2: watchdog@40430000 { + compatible = "fsl,imx7ulp-wdt"; + reg = <0x40430000 0x10000>; + timeout-sec = <40>; + }; + pcc3: clock-controller@40b30000 { compatible = "fsl,imx7ulp-pcc3"; reg = <0x40b30000 0x10000>;
arch/arm/dts/imx8ulp-u-boot.dtsi +4 -0
@@ -61,3 +61,7 @@ }; }; #endif + +&wdog3 { + bootph-all; +};
arch/arm/dts/imx91-u-boot.dtsi +12 -0
@@ -90,3 +90,15 @@ }; }; }; + +&wdog3 { + bootph-all; +}; + +&wdog4 { + bootph-all; +}; + +&wdog5 { + bootph-all; +};
arch/arm/dts/imx93-u-boot.dtsi +12 -0
@@ -96,3 +96,15 @@ 0x000001b2 0x800001b6>; #thermal-sensor-cells = <1>; }; + +&wdog3 { + bootph-all; +}; + +&wdog4 { + bootph-all; +}; + +&wdog5 { + bootph-all; +};
arch/arm/dts/imx93.dtsi +18 -0
@@ -414,6 +414,24 @@ timeout-sec = <40>; }; + wdog4: watchdog@424a0000 { + compatible = "fsl,imx93-wdt"; + reg = <0x424a0000 0x10000>; + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_WDOG4_GATE>; + timeout-sec = <40>; + status = "disabled"; + }; + + wdog5: watchdog@424b0000 { + compatible = "fsl,imx93-wdt"; + reg = <0x424b0000 0x10000>; + interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_WDOG5_GATE>; + timeout-sec = <40>; + status = "disabled"; + }; + tpm3: pwm@424e0000 { compatible = "fsl,imx7ulp-pwm"; reg = <0x424e0000 0x1000>;
arch/arm/dts/imx943-u-boot.dtsi +16 -0
@@ -159,6 +159,18 @@ }; }; +&aips4 { + bootph-all; + + wdog4: watchdog@49230000 { + bootph-all; + + compatible = "fsl,imx94-wdt", "fsl,imx93-wdt"; + reg = <0x49230000 0x10000>; + status = "disabled"; + }; +}; + &clk_ext1 { bootph-all; };
@@ -460,3 +472,7 @@ &sram0 { bootph-all; }; + +&wdog3 { + bootph-all; +};
arch/arm/dts/imx95-u-boot.dtsi +14 -0
@@ -138,6 +138,16 @@ &aips2 { bootph-all; + + wdog4: watchdog@424a0000 { + bootph-all; + + compatible = "fsl,imx93-wdt"; + reg = <0x424a0000 0x10000>; + clocks = <&scmi_clk IMX95_CLK_BUSWAKEUP>; + timeout-sec = <40>; + status = "disabled"; + }; }; &aips3 {
@@ -238,3 +248,7 @@ &scmi_buf1 { bootph-all; }; + +&wdog3 { + bootph-all; +};
arch/arm/dts/imx952-u-boot.dtsi +14 -0
@@ -115,6 +115,16 @@ &aips2 { bootph-all; + + wdog4: watchdog@420c0000 { + bootph-all; + + compatible = "fsl,imx93-wdt"; + reg = <0x420c0000 0x10000>; + clocks = <&scmi_clk IMX952_CLK_BUSWAKEUP>; + timeout-sec = <40>; + status = "disabled"; + }; }; &aips3 {
@@ -237,6 +247,10 @@ bootph-pre-ram; }; +&wdog3 { + bootph-all; +}; + &scmi_iomuxc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_hog>;
Signature · 1 line
2.34.1
Re: [PATCH v2 2/5] arm: dts: imx: Update watchdog nodes for dynamic base address lookup
Quoted 165 lines · On 4/21/26 16:01, [email protected] wrote:
From: Alice Guo <[email protected]>
Update watchdog device tree nodes to enable dynamic base address retrieval for i.MX7ULP, i.MX8ULP, i.MX91, i.MX93, i.MX943, i.MX95 and i.MX952. This allows the bootloader to obtain watchdog base addresses from the device tree instead of using hardcoded values.
- imx7ulp: Add wdog2 node
- imx8ulp: Mark wdog3 available
- imx91/imx93: Add wdog4 and wdog5 nodes
Mark wdog3/wdog4/wdog5 available
- imx943: Add wdog4 node and mark wdog3/wdog4 available
- imx95/imx952: Add wdog4 node and mark wdog3/wdog4 availableWatchdog nodes are marked with "bootph-all" to ensure availability during early boot stages when
init_wdog()occurs.Signed-off-by Alice Guo <[email protected]>--- arch/arm/dts/imx7ulp.dtsi | 6 ++++++ arch/arm/dts/imx8ulp-u-boot.dtsi | 4 ++++ arch/arm/dts/imx91-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx93-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx93.dtsi | 18 ++++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 16 ++++++++++++++++ arch/arm/dts/imx95-u-boot.dtsi | 14 ++++++++++++++ arch/arm/dts/imx952-u-boot.dtsi | 14 ++++++++++++++ 8 files changed, 96 insertions(+)arch/arm/dts/imx7ulp.dtsi +6
-0@@ -295,6 +295,12 @@ clock-names = "divcore", "hsrun_divcore"; }; + wdog2: watchdog@40430000 { + compatible = "fsl,imx7ulp-wdt"; + reg = <0x40430000 0x10000>; + timeout-sec = <40>; + }; + pcc3: clock-controller@40b30000 { compatible = "fsl,imx7ulp-pcc3"; reg = <0x40b30000 0x10000>;arch/arm/dts/imx8ulp-u-boot.dtsi +4
-0@@ -61,3 +61,7 @@ }; }; #endif + +&wdog3 { + bootph-all; +};arch/arm/dts/imx91-u-boot.dtsi +12
-0@@ -90,3 +90,15 @@ }; }; }; + +&wdog3 { + bootph-all; +}; + +&wdog4 { + bootph-all; +}; + +&wdog5 { + bootph-all; +};arch/arm/dts/imx93-u-boot.dtsi +12
-0@@ -96,3 +96,15 @@ 0x000001b2 0x800001b6>; #thermal-sensor-cells = <1>; }; + +&wdog3 { + bootph-all; +}; + +&wdog4 { + bootph-all; +}; + +&wdog5 { + bootph-all; +};arch/arm/dts/imx93.dtsi +18
-0@@ -414,6 +414,24 @@ timeout-sec = <40>; }; + wdog4: watchdog@424a0000 { + compatible = "fsl,imx93-wdt"; + reg = <0x424a0000 0x10000>; + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_WDOG4_GATE>; + timeout-sec = <40>; + status = "disabled"; + }; + + wdog5: watchdog@424b0000 { + compatible = "fsl,imx93-wdt"; + reg = <0x424b0000 0x10000>; + interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_WDOG5_GATE>; + timeout-sec = <40>; + status = "disabled"; + }; + tpm3: pwm@424e0000 { compatible = "fsl,imx7ulp-pwm"; reg = <0x424e0000 0x1000>;arch/arm/dts/imx943-u-boot.dtsi +16
-0@@ -159,6 +159,18 @@ }; }; +&aips4 { + bootph-all; + + wdog4: watchdog@49230000 { + bootph-all; + + compatible = "fsl,imx94-wdt", "fsl,imx93-wdt"; + reg = <0x49230000 0x10000>; + status = "disabled"; + }; +}; + &clk_ext1 { bootph-all; };@@ -460,3 +472,7 @@ &sram0 { bootph-all; }; + +&wdog3 { + bootph-all; +};arch/arm/dts/imx95-u-boot.dtsi +0
-0@@ -138,6 +138,16 @@ &aips2 {
arch/arm/dts/imx95-u-boot.dtsi line 149
Quoted 10 lines
arch/arm/dts/imx95-u-boot.dtsi +9
-0bootph-all; + + wdog4: watchdog@424a0000 { + bootph-all; + + compatible = "fsl,imx93-wdt"; + reg = <0x424a0000 0x10000>; + clocks = <&scmi_clk IMX95_CLK_BUSWAKEUP>; + timeout-sec = <40>; + status = "disabled";
I understand why "bootph-all" is in the u-boot special file. But the other main properties defining the watchdog device should be in the common dts(i) file, no?
Checking mainline kernel I see, that "bootph-all" is used there as well. It seems to be accepted. So why not move everything into the common dts/dtsi files instead?
Thanks,
Stefan
Quoted 45 lines
arch/arm/dts/imx95-u-boot.dtsi +5
-0+ }; }; &aips3 {@@ -238,3 +248,7 @@ &scmi_buf1 { bootph-all; }; + +&wdog3 { + bootph-all; +};arch/arm/dts/imx952-u-boot.dtsi +14
-0@@ -115,6 +115,16 @@ &aips2 { bootph-all; + + wdog4: watchdog@420c0000 { + bootph-all; + + compatible = "fsl,imx93-wdt"; + reg = <0x420c0000 0x10000>; + clocks = <&scmi_clk IMX952_CLK_BUSWAKEUP>; + timeout-sec = <40>; + status = "disabled"; + }; }; &aips3 {@@ -237,6 +247,10 @@ bootph-pre-ram; }; +&wdog3 { + bootph-all; +}; + &scmi_iomuxc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_hog>;
Fabio Estevam
reviewerRe: [PATCH v2 2/5] arm: dts: imx: Update watchdog nodes for dynamic base address lookup
Quoted 7 lines · Stefan Roese
I understand why "bootph-all" is in the u-boot special file. But the other main properties defining the watchdog device should be in the common dts(i) file, no?
Checking mainline kernel I see, that "bootph-all" is used there as well. It seems to be accepted. So why not move everything into the common dts/dtsi files instead?
I agree with Stefan.
回复: [PATCH v2 2/5] arm: dts: imx: Update watchdog nodes for dynamic base address lookup
In reply to Stefan RoeseQuoted 210 lines
-----邮件原件-----
发件人: Stefan Roese <[email protected]>
发送时间: 2026年4月21日 22:10
收件人: Alice Guo (OSS) <[email protected]>; dl-uboot-imx <[email protected]>; [email protected]; Christoph Stoidner <[email protected]>; [email protected]
抄送: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Tom Rini <[email protected]>; Peng Fan <[email protected]>; Ye Li <[email protected]>; Simon Glass <[email protected]>; Ross, Fedor <[email protected]>; Sébastien Szymanski <[email protected]>; João Paulo Gonçalves <[email protected]>; Primoz Fiser <[email protected]>; Frieder Schrempf <[email protected]>; Jérémie Dautheribes (Schneider Electric) <[email protected]>; Jacky Bai <[email protected]>; Francesco Dolcini <[email protected]>; Mathieu Othacehe <[email protected]>; Lukasz Majewski <[email protected]>; Ernest Van Hoecke <[email protected]>; Emanuele Ghidoli <[email protected]>; Max Krummenacher <[email protected]>; Wadim Egorov <[email protected]>; Sumit Garg <[email protected]>; [email protected]; Anshul Dalal <[email protected]>; Franz Schnyder <[email protected]>; Sam Protsenko <[email protected]>; Joseph Guo <[email protected]>; Ji Luo <[email protected]>; Marek Vasut <[email protected]>; Alice Guo <[email protected]>
主题: Re: [PATCH v2 2/5] arm: dts: imx: Update watchdog nodes for dynamic base address lookupQuoted 167 lines · On 4/21/26 16:01, [email protected] wrote:
From: Alice Guo <[email protected]>
Update watchdog device tree nodes to enable dynamic base address retrieval for i.MX7ULP, i.MX8ULP, i.MX91, i.MX93, i.MX943, i.MX95 and i.MX952. This allows the bootloader to obtain watchdog base addresses from the device tree instead of using hardcoded values.
- imx7ulp: Add wdog2 node
- imx8ulp: Mark wdog3 available
- imx91/imx93: Add wdog4 and wdog5 nodes
Mark wdog3/wdog4/wdog5 available
- imx943: Add wdog4 node and mark wdog3/wdog4 available
- imx95/imx952: Add wdog4 node and mark wdog3/wdog4 availableWatchdog nodes are marked with "bootph-all" to ensure availability during early boot stages when
init_wdog()occurs.Signed-off-by Alice Guo <[email protected]>--- arch/arm/dts/imx7ulp.dtsi | 6 ++++++ arch/arm/dts/imx8ulp-u-boot.dtsi | 4 ++++ arch/arm/dts/imx91-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx93-u-boot.dtsi | 12 ++++++++++++ arch/arm/dts/imx93.dtsi | 18 ++++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 16 ++++++++++++++++ arch/arm/dts/imx95-u-boot.dtsi | 14 ++++++++++++++ arch/arm/dts/imx952-u-boot.dtsi | 14 ++++++++++++++ 8 files changed, 96 insertions(+)arch/arm/dts/imx7ulp.dtsi +6
-0@@ -295,6 +295,12 @@ clock-names = "divcore", "hsrun_divcore"; }; + wdog2: watchdog@40430000 { + compatible = "fsl,imx7ulp-wdt"; + reg = <0x40430000 0x10000>; + timeout-sec = <40>; + }; + pcc3: clock-controller@40b30000 { compatible = "fsl,imx7ulp-pcc3"; reg = <0x40b30000 0x10000>;arch/arm/dts/imx8ulp-u-boot.dtsi +4
-0@@ -61,3 +61,7 @@ }; }; #endif + +&wdog3 { + bootph-all; +};(quoted diff) +0
-0
b/arch/arm/dts/imx91-u-boot.dtsiindex5b639c965d6..149f7bc685a100644arch/arm/dts/imx91-u-boot.dtsi +12
-0@@ -90,3 +90,15 @@ }; }; }; + +&wdog3 { + bootph-all; +}; + +&wdog4 { + bootph-all; +}; + +&wdog5 { + bootph-all; +};(quoted diff) +0
-0
b/arch/arm/dts/imx93-u-boot.dtsiindexdc86746ac90..a84cdf2bc45100644arch/arm/dts/imx93-u-boot.dtsi +12
-0@@ -96,3 +96,15 @@ 0x000001b2 0x800001b6>; #thermal-sensor-cells = <1>; }; + +&wdog3 { + bootph-all; +}; + +&wdog4 { + bootph-all; +}; + +&wdog5 { + bootph-all; +};arch/arm/dts/imx93.dtsi index renamed from arch/arm/dts/imx93.dtsi +0
-0
d6964714ea0..511e9594e37100644arch/arm/dts/imx93.dtsi +18
-0@@ -414,6 +414,24 @@ timeout-sec = <40>; }; + wdog4: watchdog@424a0000 { + compatible = "fsl,imx93-wdt"; + reg = <0x424a0000 0x10000>; + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_WDOG4_GATE>; + timeout-sec = <40>; + status = "disabled"; + }; + + wdog5: watchdog@424b0000 { + compatible = "fsl,imx93-wdt"; + reg = <0x424b0000 0x10000>; + interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_WDOG5_GATE>; + timeout-sec = <40>; + status = "disabled"; + }; + tpm3: pwm@424e0000 { compatible = "fsl,imx7ulp-pwm"; reg = <0x424e0000 0x1000>;(quoted diff) +0
-0
b/arch/arm/dts/imx943-u-boot.dtsiindex3457442a3b0..fca0f10c865100644arch/arm/dts/imx943-u-boot.dtsi +16
-0@@ -159,6 +159,18 @@ }; }; +&aips4 { + bootph-all; + + wdog4: watchdog@49230000 { + bootph-all; + + compatible = "fsl,imx94-wdt", "fsl,imx93-wdt"; + reg = <0x49230000 0x10000>; + status = "disabled"; + }; +}; + &clk_ext1 { bootph-all; };@@ -460,3 +472,7 @@ &sram0 { bootph-all; }; + +&wdog3 { + bootph-all; +};(quoted diff) +0
-0
b/arch/arm/dts/imx95-u-boot.dtsiindex6dec159752b..2fdb7e331b6100644arch/arm/dts/imx95-u-boot.dtsi +0
-0@@ -138,6 +138,16 @@ &aips2 {arch/arm/dts/imx95-u-boot.dtsi line 149
Quoted 10 lines
arch/arm/dts/imx95-u-boot.dtsi +9
-0bootph-all; + + wdog4: watchdog@424a0000 { + bootph-all; + + compatible = "fsl,imx93-wdt"; + reg = <0x424a0000 0x10000>; + clocks = <&scmi_clk IMX95_CLK_BUSWAKEUP>; + timeout-sec = <40>; + status = "disabled";I understand why "bootph-all" is in the u-boot special file. But the other main properties defining the watchdog device should be in the common dts(i) file, no?
Quoted 7 lines
Checking mainline kernel I see, that "bootph-all" is used there as well. It seems to be accepted. So why not move everything into the common dts/dtsi files instead?
Thanks,
Stefan
Hi Stefan,
For platforms with CONFIG_OF_UPSTREAM enabled, the DTS/DTSI files come directly from the upstream kernel tree and should not be modified in U-Boot, so the watchdog node is added in the corresponding xxx-u-boot.dtsi.
For platforms without CONFIG_OF_UPSTREAM, the DTS/DTSI files are maintained locally in U-Boot, and the watchdog node is added directly to xxx.dtsi.
Thanks,
Alice
Fabio Estevam
reviewerRe: [PATCH v2 2/5] arm: dts: imx: Update watchdog nodes for dynamic base address lookup
Hi Alice,
On Wed, Apr 22, 2026 at 12:49 AM Alice Guo (OSS) <[email protected]> wrote:
[Please trim your replies]
Quoted 3 lines
Hi Stefan,
For platforms with
CONFIG_OF_UPSTREAMenabled, the DTS/DTSI files come directly from the upstream kernel tree and should not be modified in U-Boot, so the watchdog node is added in the correspondingxxx-u-boot.dtsi.
Please send the watchdog changes to the upstream kernel, so that u-boot.dtsi does not grow unnecessarily.
Then mention the upstream lore URL in the U-Boot patch.
We can accept the u-boot.dtsi changes temporarily, but please make it clear in the U-Boot patch that an effort is being made to get the u-boot.dtsi change to the upstream kernel.
Quoted 1 line
For platforms without
CONFIG_OF_UPSTREAM, the DTS/DTSI files are maintained locally in U-Boot, and the watchdog node is added directly toxxx.dtsi.
Please help convert the NXP platforms to CONFIG_OF_UPSTREAM.
PATCH v2 3/5 watchdog: ulp_wdog: Use driver model for reset_cpu()
In reply to [email protected]From: Alice Guo <[email protected]>
Replace hardcoded WDOG_BASE_ADDR with driver model based dynamic address lookup from device tree.
- Remove hardcoded WDOG_BASE_ADDR from hw_watchdog_* functions
- Reimplement reset_cpu() using UCLASS_WDT device iteration
- Add ulp_wdt_expire_now() callback for standard WDT interface
- Pass wdog register pointer to hw_watchdog_set_timeout()
--- drivers/watchdog/ulp_wdog.c | 79 ++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 51 deletions(-)
drivers/watchdog/ulp_wdog.c +28 -51
@@ -7,6 +7,7 @@#include <asm/io.h> #include <asm/arch/imx-regs.h> #include <dm.h> +#include <linux/delay.h> #include <wdt.h> /*
@@ -51,11 +52,9 @@ struct ulp_wdt_priv {#define CLK_RATE_1KHZ 1000#define CLK_RATE_32KHZ 125 -void hw_watchdog_set_timeout (u16 val) +void hw_watchdog_set_timeout (struct wdog_regs *wdog,u16 val) {/* setting timeout value */ -struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR ; -writel (val, &wdog->toval); }
@@ -89,7 +88,7 @@ void ulp_watchdog_init(struct wdog_regs *wdog, u16 timeout)while (!(readl (&wdog->cs) &WDGCS_ULK )) ; -hw_watchdog_set_timeout (timeout); +hw_watchdog_set_timeout (wdog, timeout);writel (0 , &wdog->win);/* setting 1-kHz clock source, enable counter running, and clear interrupt */
@@ -107,57 +106,20 @@ void ulp_watchdog_init(struct wdog_regs *wdog, u16 timeout)ulp_watchdog_reset (wdog); } -void hw_watchdog_reset (void ) -{ -struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR ; - -ulp_watchdog_reset (wdog); -} - -void hw_watchdog_init (void ) -{ -struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR ; - -ulp_watchdog_init (wdog,CONFIG_WATCHDOG_TIMEOUT_MSECS ); -} - -#if !CONFIG_IS_ENABLED (SYSRESET ) +#if !CONFIG_IS_ENABLED (SYSRESET ) &&CONFIG_IS_ENABLED (WDT )void reset_cpu (void ) { -struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR ; -u32 cmd32 =0 ; - -if (readl (&wdog->cs) &WDGCS_CMD32EN ) { -writel (UNLOCK_WORD , &wdog->cnt); - cmd32 =WDGCS_CMD32EN ; - }else { -dmb (); -__raw_writel (UNLOCK_WORD0 , &wdog->cnt); -__raw_writel (UNLOCK_WORD1 , &wdog->cnt); -dmb (); - } +struct udevice *wdt; -/* Wait WDOG Unlock */ -while (!(readl (&wdog->cs) &WDGCS_ULK )) - ; +for (uclass_first_device (UCLASS_WDT , &wdt); + wdt; +uclass_next_device (&wdt)) { +if (!dev_read_enabled (wdt)) +continue ; -hw_watchdog_set_timeout (5 );/* 5ms timeout for general; 40ms timeout for imx93 */ -writel (0 , &wdog->win); - -/* enable counter running */ -if (IS_ENABLED (CONFIG_ARCH_IMX9 )) -writel ((cmd32 |WDGCS_WDGE | (WDG_LPO_CLK <<8 ) |WDOG_CS_PRES | -WDGCS_INT ), &wdog->cs); -else -writel ((cmd32 |WDGCS_WDGE | (WDG_LPO_CLK <<8 )), &wdog->cs); - -/* Wait WDOG reconfiguration */ -while (!(readl (&wdog->cs) &WDGCS_RCS )) - ; - -hw_watchdog_reset (); - -while (1 ); +wdt_expire_now (wdt,0 ); +break ; + } }#endif
@@ -184,6 +146,20 @@ static int ulp_wdt_reset(struct udevice *dev)return 0 ; } +static int ulp_wdt_expire_now (struct udevice *dev,ulong flags) +{ +int ret; + +/* 5ms timeout for all others; 40ms timeout for "fsl,imx93-wdt" */ + ret =ulp_wdt_start (dev,5 , flags); +if (ret) +return ret; + +mdelay (50 ); + +return 0 ; +} +static int ulp_wdt_probe (struct udevice *dev) {struct ulp_wdt_priv *priv =dev_get_priv (dev);
@@ -202,6 +178,7 @@ static int ulp_wdt_probe(struct udevice *dev)static const struct wdt_ops ulp_wdt_ops = { .start = ulp_wdt_start, .reset = ulp_wdt_reset, + .expire_now = ulp_wdt_expire_now, };static const struct udevice_id ulp_wdt_ids[] = {
Signature · 1 line
2.34.1
PATCH v2 4/5 arm: dts: imx: Enable watchdog driver model support
In reply to [email protected]From: Alice Guo <[email protected]>
Enable CONFIG_WDT for boards using ULP watchdog to allow reset_cpu() to use watchdog driver model instead of hardcoded base addresses.
Remove wdog3 status = "disabled" overrides from U-Boot device tree overlays, as the watchdog device needs to be accessible for driver model based reset functionality.
--- arch/arm/dts/imx8ulp-evk-u-boot.dtsi | 4 ---- arch/arm/dts/imx943-evk-u-boot.dtsi | 4 ---- arch/arm/dts/imx95-15x15-evk-u-boot.dtsi | 4 ---- arch/arm/dts/imx95-19x19-evk-u-boot.dtsi | 4 ---- arch/arm/dts/imx95-toradex-smarc-dev-u-boot.dtsi | 4 ---- configs/imx8ulp_evk_defconfig | 1 + configs/imx93-phycore_defconfig | 1 + configs/imx943_evk_defconfig | 1 + configs/imx95_15x15_evk_defconfig | 1 + configs/imx95_evk.config | 1 + configs/mx7ulp_com_defconfig | 1 + configs/toradex-smarc-imx95_defconfig | 1 + 12 files changed, 7 insertions(+), 20 deletions(-)
arch/arm/dts/imx8ulp-evk-u-boot.dtsi +0 -4
@@ -26,10 +26,6 @@ status = "disabled"; }; -&wdog3 { - status = "disabled"; -}; - &per_bridge4 { bootph-pre-ram; };
arch/arm/dts/imx943-evk-u-boot.dtsi +0 -4
@@ -153,10 +153,6 @@ bootph-pre-ram; }; -&wdog3 { - status = "disabled"; -}; - &xspi1 { bootph-pre-ram; pinctrl-names = "default";
arch/arm/dts/imx95-15x15-evk-u-boot.dtsi +0 -4
@@ -44,10 +44,6 @@ bootph-pre-ram; }; -&wdog3 { - status = "disabled"; -}; - &pinctrl_uart1 { bootph-pre-ram; };
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi +0 -4
@@ -28,10 +28,6 @@ bootph-pre-ram; }; -&wdog3 { - status = "disabled"; -}; - &pinctrl_uart1 { bootph-pre-ram; };
arch/arm/dts/imx95-toradex-smarc-dev-u-boot.dtsi +0 -4
@@ -104,7 +104,3 @@ &usdhc2 { bootph-pre-ram; }; - -&wdog3 { - status = "disabled"; -};
configs/imx8ulp_evk_defconfig +1 -0
@@ -92,3 +92,4 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_NXP_FSPI=y CONFIG_ULP_WATCHDOG=y +CONFIG_WDT=y
configs/imx93-phycore_defconfig +1 -0
@@ -156,6 +156,7 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9 CONFIG_USB_GADGET_PRODUCT_NUM=0x0152 CONFIG_CI_UDC=y CONFIG_ULP_WATCHDOG=y +CONFIG_WDT=y # CONFIG_RSA is not set # CONFIG_SPL_SHA256 is not set CONFIG_LZO=y
configs/imx943_evk_defconfig +1 -0
@@ -151,3 +151,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_SDP_LOADADDR=0x90400000 CONFIG_SPL_USB_SDP_SUPPORT=y CONFIG_ULP_WATCHDOG=y +CONFIG_WDT=y
configs/imx95_15x15_evk_defconfig +1 -0
@@ -147,5 +147,6 @@ CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_NXP_FSPI=y CONFIG_ULP_WATCHDOG=y +CONFIG_WDT=y CONFIG_LZO=y CONFIG_BZIP2=y
configs/imx95_evk.config +1 -0
@@ -150,3 +150,4 @@ CONFIG_NXP_FSPI=y CONFIG_ULP_WATCHDOG=y CONFIG_LZO=y CONFIG_BZIP2=y +CONFIG_WDT=y
configs/mx7ulp_com_defconfig +1 -0
@@ -63,3 +63,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_ULP_WATCHDOG=y +CONFIG_WDT=y
configs/toradex-smarc-imx95_defconfig +1 -0
@@ -174,6 +174,7 @@ CONFIG_USB_GADGET_OS_DESCRIPTORS=y CONFIG_CI_UDC=y CONFIG_SDP_LOADADDR=0x90400000 CONFIG_ULP_WATCHDOG=y +CONFIG_WDT=y # CONFIG_SPL_SHA1 is not set CONFIG_LZO=y CONFIG_HEXDUMP=y
Signature · 1 line
2.34.1
PATCH v2 5/5 imx: Remove hardcoded watchdog base address macros
In reply to [email protected]From: Alice Guo <[email protected]>
The watchdog base addresses are now obtained from the devicetree via ofnode_* functions. Remove the hardcoded macro definitions as they are no longer needed.
--- arch/arm/include/asm/arch-imx8ulp/imx-regs.h | 2 -- arch/arm/include/asm/arch-imx9/imx-regs.h | 9 --------- include/configs/imx8ulp_evk.h | 2 -- include/configs/imx91_evk.h | 2 -- include/configs/imx91_frdm.h | 2 -- include/configs/imx93_evk.h | 3 --- include/configs/imx93_frdm.h | 3 --- include/configs/imx93_qsb.h | 2 -- include/configs/imx93_var_som.h | 3 --- include/configs/imx94_evk.h | 3 --- include/configs/imx95_evk.h | 2 -- include/configs/kontron-osm-s-mx93.h | 2 -- include/configs/mx7ulp_com.h | 3 --- include/configs/mx7ulp_evk.h | 3 --- include/configs/phycore_imx91_93.h | 3 --- include/configs/toradex-smarc-imx95.h | 2 -- 16 files changed, 46 deletions(-)
arch/arm/include/asm/arch-imx8ulp/imx-regs.h +0 -2
@@ -20,8 +20,6 @@#define SIM1_BASE_ADDR 0x29290000 -#define WDG3_RBASE 0x292a0000UL -#define SIM_SEC_BASE_ADDR 0x2802B000#define CGC1_SOSCDIV_ADDR 0x292C0108
arch/arm/include/asm/arch-imx9/imx-regs.h +0 -9
@@ -17,15 +17,6 @@#define ANATOP_BASE_ADDR 0x44480000UL -#ifdef CONFIG_IMX94 -#define WDG3_BASE_ADDR 0x49220000UL -#define WDG4_BASE_ADDR 0x49230000UL -#else -#define WDG3_BASE_ADDR 0x42490000UL -#define WDG4_BASE_ADDR 0x424a0000UL -#endif -#define WDG5_BASE_ADDR 0x424b0000UL -#define GPIO2_BASE_ADDR 0x43810000UL#define GPIO3_BASE_ADDR 0x43820000UL#define GPIO4_BASE_ADDR 0x43840000UL
include/configs/imx8ulp_evk.h +0 -2
@@ -30,6 +30,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE 0x80000000/* 2GB DDR */ -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG3_RBASE#endif
include/configs/imx91_evk.h +0 -2
@@ -16,6 +16,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE 0x80000000/* 2GB DDR */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx91_frdm.h +0 -2
@@ -20,6 +20,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE SZ_2G/* 2GB DDR */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx93_evk.h +0 -3
@@ -26,7 +26,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE 0x80000000/* 2GB DDR */ -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx93_frdm.h +0 -3
@@ -20,7 +20,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE 0x80000000/* 2GB DDR */ -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx93_qsb.h +0 -2
@@ -16,6 +16,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE 0x80000000/* 2GB DDR */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx93_var_som.h +0 -3
@@ -38,7 +38,4 @@#define CFG_SYS_FSL_USDHC_NUM 2 -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx94_evk.h +0 -3
@@ -18,7 +18,4 @@#define PHYS_SDRAM_SIZE 0x70000000UL/* 2GB - 256MB DDR */ #define PHYS_SDRAM_2_SIZE 0x180000000/* 8GB */ -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/imx95_evk.h +0 -2
@@ -23,6 +23,4 @@#define PHYS_SDRAM_2_SIZE 0x380000000/* 14GB (Totally 16GB) */ #endif -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
include/configs/kontron-osm-s-mx93.h +0 -2
@@ -25,6 +25,4 @@#define CFG_MXC_USB_FLAGS 0#endif -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif /* __KONTRON_MX93_CONFIG_H */
include/configs/mx7ulp_com.h +0 -3
@@ -15,9 +15,6 @@#include "imx7ulp_spl.h" #endif -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG1_RBASE -#define CFG_SYS_HZ_CLOCK 1000000/* Fixed at 1MHz from TSTMR */ /* UART */
include/configs/mx7ulp_evk.h +0 -3
@@ -11,9 +11,6 @@#include <linux/sizes.h> #include <asm/arch/imx-regs.h> -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG1_RBASE -#define CFG_SYS_HZ_CLOCK 1000000/* Fixed at 1Mhz from TSTMR */ /* UART */
include/configs/phycore_imx91_93.h +0 -3
@@ -22,7 +22,4 @@#define PHYS_SDRAM 0x80000000#define PHYS_SDRAM_SIZE 0x80000000 -/* Using ULP WDOG for reset */ -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif /* __PHYCORE_IMX91_93_H */
include/configs/toradex-smarc-imx95.h +0 -2
@@ -19,6 +19,4 @@#define PHYS_SDRAM_SIZE (SZ_2G - SZ_256M)#define PHYS_SDRAM_2_SIZE SZ_6G -#define WDOG_BASE_ADDR WDG3_BASE_ADDR -#endif
Signature · 1 line
2.34.1
Hello Alice
Quoted 6 lines · On Tue, Apr 21, 2026 at 10:01:26PM +0800, [email protected] wrote:
CI: https://github.com/u-boot/u-boot/pull/935/checks
Changes for v2:
- Iterate all watchdog nodes in device tree instead of wdog alias
- Delete non-DM implementation of the ULP watchdog driver
Please be aware of https://lore.kernel.org/all/[email protected]/
In case it gets merged before this series.
Francesco
Quoted 38 lines
-----邮件原件-----
发件人: Francesco Dolcini <[email protected]>
发送时间: 2026年4月21日 23:48
收件人: Alice Guo (OSS) <[email protected]>
抄送: dl-uboot-imx <[email protected]>; [email protected]; Christoph Stoidner <[email protected]>; [email protected]; Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>; Tom Rini <[email protected]>; Peng Fan <[email protected]>; Ye Li <[email protected]>; Simon Glass <[email protected]>; Ross, Fedor <[email protected]>; Sé bastien Szymanski <[email protected]>; João Paulo Gonçalves <[email protected]>; Primoz Fiser <[email protected]>; Frieder Schrempf <[email protected]>; J érémie Dautheribes (Schneider Electric) <[email protected]>; Jacky Bai <[email protected]>; Stefan Roese <[email protected]>; Francesco Dolcini <[email protected]>; Mathieu Othacehe <[email protected]>; Lukasz Majewski <[email protected]>; Ernest Van Hoecke <[email protected]>; Emanuele Ghidoli <[email protected]>; Max Krummenacher <[email protected]>; Wadim Egorov <[email protected]>; Sumit Garg <[email protected]>; [email protected]; Anshul Dalal <[email protected]>; Franz Schnyder <[email protected]>; Sam Protsenko <[email protected]>; Joseph Guo <[email protected]>; Ji Luo <[email protected]>; Marek Vasut <[email protected]>; Alice Guo <[email protected]>
主题: Re: [PATCH v2 0/5] imx: Switch watchdog addressing from macros to devicetreeHello Alice
Quoted 6 lines · On Tue, Apr 21, 2026 at 10:01:26PM +0800, [email protected] wrote:
CI: https://github.com/u-boot/u-boot/pull/935/checks
Changes for v2:
- Iterate all watchdog nodes in device tree instead of wdog alias
- Delete non-DM implementation of the ULP watchdog driver
Quoted 7 lines
Please be aware of
https://lore.kernel.org/all/20260416084535.1490476-1-ghidoliemanuele@gmai
l.com/In case it gets merged before this series.
Francesco
Hi Francesco,
Thanks for the heads-up, I'll keep an eye on it.
Best regards,
Alice