imx: soc: Get watchdog base addresses from device tree

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().

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Alice Guo
2026-05-19 14:22:06 +08:00
committed by Fabio Estevam
parent ce79378a19
commit 5ca1f5b54d
4 changed files with 48 additions and 13 deletions

View File

@@ -343,7 +343,17 @@ static void disable_wdog(void __iomem *wdog_base)
void init_wdog(void)
{
disable_wdog((void __iomem *)WDG3_RBASE);
ofnode node;
ofnode_for_each_compatible_node(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[] = {

View File

@@ -833,9 +833,16 @@ 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;
ofnode_for_each_compatible_node(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);

View File

@@ -270,9 +270,17 @@ 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;
ofnode_for_each_compatible_node(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[] = {

View File

@@ -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,17 @@ 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;
ofnode_for_each_compatible_node(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 +234,6 @@ static void init_ldo_mode(void)
void s_init(void)
{
/* Disable wdog */
init_wdog();
/* clock configuration. */
clock_init();