Skip to contentSkip to conversation

imx: Switch watchdog addressing from macros to devicetree

PATCH Superseded [email protected] 3 participants 15 messages Mar 10 – Mar 12

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover imx: Switch watchdog addressing from macros to devicetree

CI: https://github.com/u-boot/u-boot/pull/902/checks

---
Alice Guo (10):
imx: Add helper to get watchdog base address from DT alias
watchdog: ulp_wdog: Get watchdog base address from device tree
imx: soc: Get watchdog base addresses from device tree
imx7ulp: dtsi: Add wdog1 and wdog2 nodes with aliases
imx8ulp: dtsi: Add wdog3 alias and bootph-all property
imx93: dtsi: Add wdog3/wdog4/wdog5 alias and bootph-all property
imx91: dtsi: Add wdog3/wdog4/wdog5 alias and bootph-all property
imx943: dtsi: Add wdog3 and wdog4 nodes with aliases
imx95: dtsi: Add wdog3 and wdog4 nodes with aliases
imx: Remove hardcoded watchdog base address macros

 arch/arm/dts/imx7ulp.dtsi                    |  8 +++++
 arch/arm/dts/imx8ulp-u-boot.dtsi             | 10 ++++++
 arch/arm/dts/imx91-u-boot.dtsi               | 18 ++++++++++
 arch/arm/dts/imx93-u-boot.dtsi               | 18 ++++++++++
 arch/arm/dts/imx93.dtsi                      | 21 ++++++++++++
 arch/arm/dts/imx943-u-boot.dtsi              | 21 ++++++++++++
 arch/arm/dts/imx95-u-boot.dtsi               | 19 +++++++++++
 arch/arm/include/asm/arch-imx8ulp/imx-regs.h |  2 --
 arch/arm/include/asm/arch-imx9/imx-regs.h    |  9 -----
 arch/arm/include/asm/mach-imx/sys_proto.h    |  2 ++
 arch/arm/mach-imx/Makefile                   |  4 +--
 arch/arm/mach-imx/fdt.c                      | 51 ++++++++++++++++++++++++++++
 arch/arm/mach-imx/imx8ulp/soc.c              | 15 +++++++-
 arch/arm/mach-imx/imx9/scmi/soc.c            | 16 +++++++--
 arch/arm/mach-imx/imx9/soc.c                 | 17 ++++++++--
 arch/arm/mach-imx/mx7ulp/soc.c               | 16 +++++++--
 drivers/watchdog/ulp_wdog.c                  | 38 +++++++++++++++------
 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_imx93.h              |  3 --
 include/configs/toradex-smarc-imx95.h        |  2 --
 31 files changed, 252 insertions(+), 68 deletions(-)

---
base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260310-wdog-9ad08a8da9dc

Best regards,

Signature · 1 line
Alice Guo <[email protected]>
#1 lore raw

PATCH 1/10 imx: Add helper to get watchdog base address from DT alias

From: Alice Guo <[email protected]>

Add imx_wdog_alias_to_addr() to get watchdog register base address from device tree aliases. This function is used by mx7ulp, imx8ulp and imx9 SoCs to locate watchdog hardware.

The function supports:
- Matching specific alias (e.g., "wdog0") or any "wdog*" if name is NULL.
- Optional device tree status check via check_status parameter.

---
 arch/arm/include/asm/mach-imx/sys_proto.h |  2 ++
 arch/arm/mach-imx/Makefile                |  4 +--
 arch/arm/mach-imx/fdt.c                   | 51 +++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 3 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +2 -0
index 46da7a1eff5..8b88b333b4f 100644
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/mach-imx/regs-common.h>
 #include <asm/mach-imx/module_fuse.h>
+#include <fdtdec.h>
 #include <linux/bitops.h>
 #include "../arch-imx/cpu.h"
 
@@ -327,4 +328,5 @@ enum boot_device get_boot_device(void);
 int disable_cpu_nodes(void *blob, const char * const *nodes_path,
 		      u32 num_disabled_cores, u32 max_cores);
 int fixup_thermal_trips(void *blob, const char *name);
+fdt_addr_t imx_wdog_alias_to_addr(char *name, bool check_status);
 #endif
arch/arm/mach-imx/Makefile +1 -3
index 0f6e737c0b9..b4f316d8c47 100644
@@ -21,11 +21,9 @@ obj-$(CONFIG_IMX_HAB) += hab.o
 obj-y += cpu.o
 endif
 
-ifeq ($(SOC),$(filter $(SOC),imx8m imx9))
-ifneq ($(CONFIG_XPL_BUILD),y)
+ifeq ($(SOC),$(filter $(SOC),mx7ulp imx8m imx8ulp imx9))
 obj-y += fdt.o
 endif
-endif
 
 ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
 obj-y	+= cpu.o speed.o
arch/arm/mach-imx/fdt.c +51 -0

62 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v1 01/10] imx: Add helper to get watchdog base address from DT alias

Quoted 10 lines · On Tue, Mar 10, 2026 at 03:53:35PM +0800, [email protected] wrote:

From: Alice Guo <[email protected]>

Add imx_wdog_alias_to_addr() to get watchdog register base address from device tree aliases. This function is used by mx7ulp, imx8ulp and imx9 SoCs to locate watchdog hardware.

The function supports:
- Matching specific alias (e.g., "wdog0") or any "wdog*" if name is NULL.
- Optional device tree status check via check_status parameter.

I not see wdog alias is used by anyone.

Is it feasible to iterate the dtb by searching all the wdog nodes? I think it should be fine to iterate all the wdog nodes and configure them as disabled, no need to check which is wdog1 or wdog2.

How do you think?

Regards
Peng

#3 lore raw

Re: [PATCH v1 01/10] imx: Add helper to get watchdog base address from DT alias

Quoted 7 lines · Peng Fan
Quoted 6 lines · On Tue, Mar 10, 2026 at 03:53:35PM +0800, [email protected] wrote:

From: Alice Guo <[email protected]>

Add imx_wdog_alias_to_addr() to get watchdog register base address from device tree aliases. This function is used by mx7ulp, imx8ulp and imx9 SoCs to locate watchdog hardware.

Quoted 6 lines
Quoted 4 lines

The function supports:
- Matching specific alias (e.g., "wdog0") or any "wdog*" if name is NULL.
- Optional device tree status check via check_status parameter.

I not see wdog alias is used by anyone.

Indeed, don't use the stem 'wdog'. Use the stem 'watchdog', as e.g. the linux watchdog framework does enumerate watchdog devices based on their DT alias, but using 'watchdog' as the stem:

drivers/watchdog/watchdog_core.c- /* Use alias for watchdog id if possible */
drivers/watchdog/watchdog_core.c- if (wdd->parent) {
drivers/watchdog/watchdog_core.c: ret = of_alias_get_id(wdd->parent->of_node, "watchdog");
drivers/watchdog/watchdog_core.c- if (ret >= 0)
drivers/watchdog/watchdog_core.c- id = ida_alloc_range(&watchdog_ida, ret, ret,
drivers/watchdog/watchdog_core.c- GFP_KERNEL);
drivers/watchdog/watchdog_core.c- }

Rasmus

#4 lore raw

PATCH 2/10 watchdog: ulp_wdog: Get watchdog base address from device tree

In reply to [email protected]

From: Alice Guo <[email protected]>

Replace hardcoded WDOG_BASE_ADDR with dynamic address lookup from device tree.

---
 drivers/watchdog/ulp_wdog.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)
drivers/watchdog/ulp_wdog.c +27 -11
index 83f19dc0e86..3840a3db784 100644
@@ -6,6 +6,7 @@
 #include <cpu_func.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
 #include <dm.h>
 #include <wdt.h>
 
@@ -51,11 +52,22 @@ struct ulp_wdt_priv {
 #define CLK_RATE_1KHZ			1000
 #define CLK_RATE_32KHZ			125
 
-void hw_watchdog_set_timeout(u16 val)
+static struct wdog_regs *ulp_watchdog_get_wdog_regs(void)
 {
-	/* setting timeout value */
-	struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR;
+	fdt_addr_t addr;
+
+	addr = imx_wdog_alias_to_addr(NULL, true);
+	if (addr == FDT_ADDR_T_NONE) {
+		printf("Error: Failed to get watchdog base address from DT\n");
+		return NULL;
+	}
+
+	return (struct wdog_regs *)addr;
+}
 
+void hw_watchdog_set_timeout(struct wdog_regs *wdog, u16 val)
+{
+	/* setting timeout value */
 	writel(val, &wdog->toval);
 }
 
@@ -89,7 +101,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,16 +119,17 @@ void ulp_watchdog_init(struct wdog_regs *wdog, u16 timeout)
 	ulp_watchdog_reset(wdog);
 }
 
-void hw_watchdog_reset(void)
+void hw_watchdog_reset(struct wdog_regs *wdog)
 {
-	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;
+	struct wdog_regs *wdog = ulp_watchdog_get_wdog_regs();
+
+	if (!wdog)
+		return;
 
 	ulp_watchdog_init(wdog, CONFIG_WATCHDOG_TIMEOUT_MSECS);
 }
@@ -124,9 +137,12 @@ void hw_watchdog_init(void)
 #if !CONFIG_IS_ENABLED(SYSRESET)
 void reset_cpu(void)
 {
-	struct wdog_regs *wdog = (struct wdog_regs *)WDOG_BASE_ADDR;
+	struct wdog_regs *wdog = ulp_watchdog_get_wdog_regs();
 	u32 cmd32 = 0;
 
+	if (!wdog)
+		return;
+
 	if (readl(&wdog->cs) & WDGCS_CMD32EN) {
 		writel(UNLOCK_WORD, &wdog->cnt);
 		cmd32 = WDGCS_CMD32EN;
@@ -141,7 +157,7 @@ void reset_cpu(void)
 	while (!(readl(&wdog->cs) & WDGCS_ULK))
 		;
 
-	hw_watchdog_set_timeout(5); /* 5ms timeout for general; 40ms timeout for imx93 */
+	hw_watchdog_set_timeout(wdog, 5); /* 5ms timeout for general; 40ms timeout for imx93 */
 	writel(0, &wdog->win);
 
 	/* enable counter running */
@@ -155,7 +171,7 @@ void reset_cpu(void)
 	while (!(readl(&wdog->cs) & WDGCS_RCS))
 		;
 
-	hw_watchdog_reset();
+	hw_watchdog_reset(wdog);
 
 	while (1);
 }
Signature · 1 line
2.43.0
#5 lore raw

Re: [PATCH v1 02/10] watchdog: ulp_wdog: Get watchdog base address from device tree

Quoted 4 lines · On Tue, Mar 10, 2026 at 03:53:36PM +0800, [email protected] wrote:

From: Alice Guo <[email protected]>

Replace hardcoded WDOG_BASE_ADDR with dynamic address lookup from device tree.

We need to convert this driver to DM, not patching non-DM.

Stefan requested to convert to DM quite some time ago.

Thanks,
Peng

#6 lore raw

PATCH 3/10 imx: soc: Get watchdog base addresses from device tree

In reply to [email protected]

From: Alice Guo <[email protected]>

Replace hardcoded watchdog base addresses with dynamic address lookup from device tree.

---
 arch/arm/mach-imx/imx8ulp/soc.c   | 15 ++++++++++++++-
 arch/arm/mach-imx/imx9/scmi/soc.c | 16 ++++++++++++++--
 arch/arm/mach-imx/imx9/soc.c      | 17 ++++++++++++++---
 arch/arm/mach-imx/mx7ulp/soc.c    | 16 ++++++++++++++--
 4 files changed, 56 insertions(+), 8 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +14 -1
index 1ee483065e8..081ba9d60b6 100644
@@ -341,9 +341,22 @@ static void disable_wdog(void __iomem *wdog_base)
 		;
 }
 
+static char *wdog_list[] = {"wdog3"};
+
 void init_wdog(void)
 {
-	disable_wdog((void __iomem *)WDG3_RBASE);
+	fdt_addr_t addr;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+		addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+		if (addr == FDT_ADDR_T_NONE) {
+			debug("watchdog alias %s not found\n", wdog_list[i]);
+			continue;
+		}
+
+		disable_wdog((void __iomem *)addr);
+	}
 }
 
 static struct mm_region imx8ulp_arm64_mem_map[] = {
arch/arm/mach-imx/imx9/scmi/soc.c +14 -2
index c1458ccca3c..692c6743418 100644
@@ -734,11 +734,23 @@ static void gpio_reset(ulong gpio_base)
 	writel(0, gpio_base + 0x1c);
 }
 
+static char *wdog_list[] = {"wdog3", "wdog4"};
+
 int arch_cpu_init(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
-		disable_wdog((void __iomem *)WDG3_BASE_ADDR);
-		disable_wdog((void __iomem *)WDG4_BASE_ADDR);
+		fdt_addr_t addr;
+		int i;
+
+		for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+			addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+			if (addr == FDT_ADDR_T_NONE) {
+				debug("watchdog alias %s not found\n", wdog_list[i]);
+				continue;
+			}
+
+			disable_wdog((void __iomem *)addr);
+		}
 
 		gpio_reset(GPIO2_BASE_ADDR);
 		gpio_reset(GPIO3_BASE_ADDR);
arch/arm/mach-imx/imx9/soc.c +14 -3
index 583c3a5a464..031226ec97f 100644
@@ -279,11 +279,22 @@ static void disable_wdog(void __iomem *wdog_base)
 		;
 }
 
+static char *wdog_list[] = {"wdog3", "wdog4", "wdog5"};
+
 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);
+	fdt_addr_t addr;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+		addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+		if (addr == FDT_ADDR_T_NONE) {
+			debug("watchdog alias %s not found\n", wdog_list[i]);
+			continue;
+		}
+
+		disable_wdog((void __iomem *)addr);
+	}
 }
 
 static struct mm_region imx93_mem_map[] = {
arch/arm/mach-imx/mx7ulp/soc.c +14 -2
index 5306e76223f..27ba8a37162 100644
@@ -146,6 +146,8 @@ static void disable_wdog(u32 wdog_base)
 	while (!(readl(wdog_base + 0x00) & 0x400));
 }
 
+static char *wdog_list[] = {"wdog1", "wdog2"};
+
 void init_wdog(void)
 {
 	/*
@@ -161,8 +163,18 @@ 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);
+	fdt_addr_t addr;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+		addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+		if (addr == FDT_ADDR_T_NONE) {
+			debug("watchdog alias %s not found\n", wdog_list[i]);
+			continue;
+		}
+
+		disable_wdog((u32)addr);
+	}
 }
 
 static bool ldo_mode_is_enabled(void)
Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH v1 03/10] imx: soc: Get watchdog base addresses from device tree

Quoted 122 lines · On Tue, Mar 10, 2026 at 03:53:37PM +0800, [email protected] wrote:

From: Alice Guo <[email protected]>

Replace hardcoded watchdog base addresses with dynamic address lookup from device tree.

---

arch/arm/mach-imx/imx8ulp/soc.c   | 15 ++++++++++++++-
arch/arm/mach-imx/imx9/scmi/soc.c | 16 ++++++++++++++--
arch/arm/mach-imx/imx9/soc.c      | 17 ++++++++++++++---
arch/arm/mach-imx/mx7ulp/soc.c    | 16 ++++++++++++++--
4 files changed, 56 insertions(+), 8 deletions(-)
arch/arm/mach-imx/imx8ulp/soc.c +14 -1
index 1ee483065e8..081ba9d60b6 100644
@@ -341,9 +341,22 @@ static void disable_wdog(void __iomem *wdog_base)
 		;
 }
 
+static char *wdog_list[] = {"wdog3"};
+
 void init_wdog(void)
 {
-	disable_wdog((void __iomem *)WDG3_RBASE);
+	fdt_addr_t addr;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+		addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+		if (addr == FDT_ADDR_T_NONE) {
+			debug("watchdog alias %s not found\n", wdog_list[i]);
+			continue;
+		}
+
+		disable_wdog((void __iomem *)addr);
+	}
 }
 
 static struct mm_region imx8ulp_arm64_mem_map[] = {
arch/arm/mach-imx/imx9/scmi/soc.c +14 -2
index c1458ccca3c..692c6743418 100644
@@ -734,11 +734,23 @@ static void gpio_reset(ulong gpio_base)
 	writel(0, gpio_base + 0x1c);
 }
 
+static char *wdog_list[] = {"wdog3", "wdog4"};
+
 int arch_cpu_init(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
-		disable_wdog((void __iomem *)WDG3_BASE_ADDR);
-		disable_wdog((void __iomem *)WDG4_BASE_ADDR);
+		fdt_addr_t addr;
+		int i;
+
+		for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+			addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+			if (addr == FDT_ADDR_T_NONE) {
+				debug("watchdog alias %s not found\n", wdog_list[i]);
+				continue;
+			}
+
+			disable_wdog((void __iomem *)addr);
+		}
 
 		gpio_reset(GPIO2_BASE_ADDR);
 		gpio_reset(GPIO3_BASE_ADDR);
arch/arm/mach-imx/imx9/soc.c +14 -3
index 583c3a5a464..031226ec97f 100644
@@ -279,11 +279,22 @@ static void disable_wdog(void __iomem *wdog_base)
 		;
 }
 
+static char *wdog_list[] = {"wdog3", "wdog4", "wdog5"};
+
 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);
+	fdt_addr_t addr;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+		addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+		if (addr == FDT_ADDR_T_NONE) {
+			debug("watchdog alias %s not found\n", wdog_list[i]);
+			continue;
+		}
+
+		disable_wdog((void __iomem *)addr);
+	}
 }
 
 static struct mm_region imx93_mem_map[] = {
arch/arm/mach-imx/mx7ulp/soc.c +4 -2
index 5306e76223f..27ba8a37162 100644
@@ -146,6 +146,8 @@ static void disable_wdog(u32 wdog_base)
 	while (!(readl(wdog_base + 0x00) & 0x400));
 }
 
+static char *wdog_list[] = {"wdog1", "wdog2"};
+
 void init_wdog(void)
 {
 	/*
@@ -161,8 +163,18 @@ 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);
+	fdt_addr_t addr;
+	int i;

arch/arm/mach-imx/mx7ulp/soc.c void init_wdog(void) · line 177

Quoted 10 lines
arch/arm/mach-imx/mx7ulp/soc.c +10 -0
+
+	for (i = 0; i < ARRAY_SIZE(wdog_list); i++) {
+		addr = imx_wdog_alias_to_addr(wdog_list[i], false);
+		if (addr == FDT_ADDR_T_NONE) {
+			debug("watchdog alias %s not found\n", wdog_list[i]);
+			continue;
+		}
+
+		disable_wdog((u32)addr);
+	}

It should be better to use fdt_for_each_comaptible_node or ofnode_for_each_compatible_node

Regards
Peng

Quoted 7 lines
arch/arm/mach-imx/mx7ulp/soc.c +0 -0
 }
 
 static bool ldo_mode_is_enabled(void)
Signature · 2 lines
-- 
2.43.0
#8 lore raw

PATCH 4/10 imx7ulp: dtsi: Add wdog1 and wdog2 nodes with aliases

In reply to [email protected]

From: Alice Guo <[email protected]>

Add wdog1 and wdog2 alias entries and introduce the wdog2 device node, allowing the watchdog register base addresses to be obtained through imx_wdog_alias_to_addr().

---
 arch/arm/dts/imx7ulp.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/dts/imx7ulp.dtsi +8 -0
index bcec98b9641..8795e3ae7e9 100644
@@ -31,6 +31,8 @@
 		serial2 = &lpuart6;
 		serial3 = &lpuart7;
 		usbphy0 = &usbphy1;
+		wdog1 = &wdog1;
+		wdog2 = &wdog2;
 	};
 
 	cpus {
@@ -295,6 +297,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>;
Signature · 1 line
2.43.0
#9 lore raw

PATCH 5/10 imx8ulp: dtsi: Add wdog3 alias and bootph-all property

In reply to [email protected]

From: Alice Guo <[email protected]>

Add wdog3 alias and mark it with bootph-all to make the watchdog available in SPL and U-Boot proper. This allows the watchdog base address to be retrieved via imx_wdog_alias_to_addr().

---
 arch/arm/dts/imx8ulp-u-boot.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/dts/imx8ulp-u-boot.dtsi +10 -0
index 30baaeff8ef..e7312232b26 100644
@@ -61,3 +61,13 @@
 	};
 };
 #endif
+
+/{
+	aliases {
+		wdog3 = &wdog3;
+	};
+};
+
+&wdog3 {
+	bootph-all;
+};
Signature · 1 line
2.43.0
#10 lore raw

PATCH 6/10 imx93: dtsi: Add wdog3/wdog4/wdog5 alias and bootph-all property

In reply to [email protected]

From: Alice Guo <[email protected]>

Introduce wdog3, wdog4, and wdog5 aliases and mark the corresponding nodes with bootph-all to enable imx_wdog_alias_to_addr() to resolve the watchdog register base addresses via the device tree.

When CONFIG_OF_UPSTREAM is disabled, upstream device tree files are not used. Therefore, wdog4 and wdog5 nodes need to be added directly to arch/arm/dts/imx93.dtsi.

---
 arch/arm/dts/imx93-u-boot.dtsi | 18 ++++++++++++++++++
 arch/arm/dts/imx93.dtsi        | 21 +++++++++++++++++++++
 2 files changed, 39 insertions(+)
arch/arm/dts/imx93-u-boot.dtsi +18 -0
index dc86746ac90..c946f45c7f0 100644
@@ -4,6 +4,12 @@
  */
 
 / {
+	aliases {
+		wdog3 = &wdog3;
+		wdog4 = &wdog4;
+		wdog5 = &wdog5;
+	};
+
 	binman: binman {
 		multiple-images;
 
@@ -96,3 +102,15 @@
 			       0x000001b2 0x800001b6>;
 	#thermal-sensor-cells = <1>;
 };
+
+&wdog3 {
+	bootph-all;
+};
+
+&wdog4 {
+	bootph-all;
+};
+
+&wdog5 {
+	bootph-all;
+};
arch/arm/dts/imx93.dtsi +21 -0
index d6964714ea0..549a30fc9f0 100644
@@ -41,6 +41,9 @@
 		serial5 = &lpuart6;
 		serial6 = &lpuart7;
 		serial7 = &lpuart8;
+		wdog3 = &wdog3;
+		wdog4 = &wdog4;
+		wdog5 = &wdog5;
 	};
 
 	cpus {
@@ -414,6 +417,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>;
Signature · 1 line
2.43.0
#11 lore raw

PATCH 7/10 imx91: dtsi: Add wdog3/wdog4/wdog5 alias and bootph-all property

In reply to [email protected]

From: Alice Guo <[email protected]>

Add wdog3/wdog4/wdog5 alias and mark it with bootph-all to allow the watchdog base address to be retrieved via imx_wdog_alias_to_addr().

---
 arch/arm/dts/imx91-u-boot.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/dts/imx91-u-boot.dtsi +18 -0
index 5b639c965d6..c3df0e9e4fb 100644
@@ -4,6 +4,12 @@
  */
 
 / {
+	aliases {
+		wdog3 = &wdog3;
+		wdog4 = &wdog4;
+		wdog5 = &wdog5;
+	};
+
 	binman: binman {
 		multiple-images;
 	};
@@ -90,3 +96,15 @@
 		};
 	};
 };
+
+&wdog3 {
+	bootph-all;
+};
+
+&wdog4 {
+	bootph-all;
+};
+
+&wdog5 {
+	bootph-all;
+};
Signature · 1 line
2.43.0
#12 lore raw

PATCH 8/10 imx943: dtsi: Add wdog3 and wdog4 nodes with aliases

In reply to [email protected]

From: Alice Guo <[email protected]>

Add wdog3 and wdog4 watchdog device tree nodes and their aliases to support dynamic watchdog address lookup.

---
 arch/arm/dts/imx943-u-boot.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/dts/imx943-u-boot.dtsi +21 -0
index 2b93ba9a38b..0619bcd5475 100644
@@ -4,6 +4,11 @@
  */
 
 / {
+	aliases {
+		wdog3 = &wdog3;
+		wdog4 = &wdog4;
+	};
+
 	binman {
 		multiple-images;
 
@@ -143,6 +148,18 @@
 	bootph-all;
 };
 
+&aips4 {
+	bootph-all;
+
+	wdog4: watchdog@49230000 {
+		bootph-all;
+
+		compatible = "fsl,imx94-wdt", "fsl,imx93-wdt";
+		reg = <0x49230000 0x10000>;
+		status = "disabled";
+	};
+};
+
 &clk_ext1 {
 	bootph-all;
 };
@@ -444,3 +461,7 @@
 &sram0 {
 	bootph-all;
 };
+
+&wdog3 {
+	bootph-all;
+};
Signature · 1 line
2.43.0
#13 lore raw

PATCH 9/10 imx95: dtsi: Add wdog3 and wdog4 nodes with aliases

In reply to [email protected]

From: Alice Guo <[email protected]>

Add wdog3 and wdog4 watchdog device tree nodes and their aliases to support dynamic watchdog address lookup.

---
 arch/arm/dts/imx95-u-boot.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm/dts/imx95-u-boot.dtsi +19 -0
index 6dec159752b..f4ce335e471 100644
@@ -4,6 +4,11 @@
  */
 
 / {
+	aliases {
+		wdog3 = &wdog3;
+		wdog4 = &wdog4;
+	};
+
 	binman {
 		multiple-images;
 
@@ -138,6 +143,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 +253,7 @@
 &scmi_buf1 {
 	bootph-all;
 };
+
+&wdog3 {
+	bootph-all;
+};
Signature · 1 line
2.43.0
#14 lore raw

PATCH 10/10 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 the imx_wdog_alias_to_addr() function. 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_imx93.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
index a038cc1df33..f9c5e21c14f 100644
@@ -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
index 2d084e5227a..fbf2e6a2b01 100644
@@ -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
index edfd6f70815..b4f80fb944b 100644
@@ -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
index 9c5014fd0a5..13918e2b873 100644
@@ -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
index 6d051ed88a5..480b3fb477a 100644
@@ -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
index ffd72a38bcb..67774f54790 100644
@@ -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
index c98c10774cb..bcea360b399 100644
@@ -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
index a7b94f7ab57..350f094c2a6 100644
@@ -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
index 9dc10aea407..6a425e6d1ea 100644
@@ -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
index f93c3c4e4a8..2623c13db06 100644
@@ -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
index 3d22740b3f4..1fdc9ce21ef 100644
@@ -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
index ab2b42298c8..fed75e6fa12 100644
@@ -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
index d27e9d2eaa1..501c3059cc3 100644
@@ -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
index ace1eee70cf..21dbec837f0 100644
@@ -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_imx93.h +0 -3
index 07364dff403..a6dd0478585 100644
@@ -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_IMX93_H */
include/configs/toradex-smarc-imx95.h +0 -2
index e1aebd70af2..8a880b96503 100644
@@ -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.43.0