| Message ID | 20261104-v2026-10-next-topic-am62-hs-se-fix-unlock-race-v4-7-e211cba9f3ea@baylibre.com |
|---|---|
| State | New |
| Delegated to: | Tom Rini |
| Headers | show |
| Series | K3: wait for TIFS init before CTRL_MMR unlock | expand |
On Wed, 04 Nov 2026 11:58:25 +0100, Markus Schneider-Pargmann <msp@baylibre.com> wrote: > On HS-SE platforms TIFS takes longer to initialize. TIFS only removes > the firewall on the registers at the end of initialization. On HS-SE the > U-Boot ctrl_mmr_unlock() can happen before TIFS removed the firewall > leading to a race condition. This leads to a broken watchdog since the > signal configuration doesn't succeed because the write doesn't take > effect. > > [...] Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index 3c567f50b223..a952638fc282 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -33,6 +33,7 @@ config SOC_K3_J721S2 config SOC_K3_J722S bool "TI's K3 based J722S SoC Family Support" + select SPL_DM_EVENT if SPL config SOC_K3_J784S4 bool "TI's K3 based J784S4 SoC Family Support" diff --git a/arch/arm/mach-k3/j722s/j722s_init.c b/arch/arm/mach-k3/j722s/j722s_init.c index 1180c75f551d..7b09691998c9 100644 --- a/arch/arm/mach-k3/j722s/j722s_init.c +++ b/arch/arm/mach-k3/j722s/j722s_init.c @@ -11,6 +11,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <event.h> #include "../sysfw-loader.h" #include "../common.h" @@ -70,6 +71,20 @@ static void ctrl_mmr_unlock(void) mmr_unlock(PADCFG_MMR1_BASE, 1); } +/* + * Called by spl_early_init() after all devices are bound, but before any of + * them are probed. TIFS has to finish its initialization before CTRL_MMR can + * be unlocked, and any device probe may already need the unlocked CTRL_MMR. + */ +static int k3_spl_dm_post_init_f(void) +{ + k3_sysfw_wait_ready(); + ctrl_mmr_unlock(); + + return 0; +} +EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, k3_spl_dm_post_init_f); + static void k3_spl_init(void) { struct udevice *dev; @@ -84,8 +99,6 @@ static void k3_spl_init(void) */ store_boot_info_from_rom(); - ctrl_mmr_unlock(); - /* Init DM early */ ret = spl_early_init(); if (ret)