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.
Wait for TIFS to be initialized using k3_sysfw_wait_ready() before doing ctrl_mmr_unlock(). As spl_early_init() may already probe some drivers, I am attaching to the EVT_DM_POST_INIT_F event to wait for TIFS and call ctrl_mmr_unlock() before anything got probed. Link: https://lore.kernel.org/u-boot/[email protected]/ Link: https://lore.kernel.org/u-boot/[email protected]/ Signed-off-by: Markus Schneider-Pargmann <[email protected]> --- arch/arm/mach-k3/Kconfig | 1 + arch/arm/mach-k3/am62x/am625_init.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index a32ed3a9683f..b1f290c1d765 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -6,6 +6,7 @@ choice config SOC_K3_AM625 bool "TI's K3 based AM625 SoC Family Support" + select SPL_DM_EVENT if SPL config SOC_K3_AM62A7 bool "TI's K3 based AM62A7 SoC Family Support" diff --git a/arch/arm/mach-k3/am62x/am625_init.c b/arch/arm/mach-k3/am62x/am625_init.c index decb50bf853d..c7e976fe5ca9 100644 --- a/arch/arm/mach-k3/am62x/am625_init.c +++ b/arch/arm/mach-k3/am62x/am625_init.c @@ -12,6 +12,7 @@ #include <dm.h> #include <dm/uclass-internal.h> #include <dm/pinctrl.h> +#include <event.h> #include "../sysfw-loader.h" #include "../common.h" @@ -100,6 +101,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 __maybe_unused void enable_mcu_esm_reset(void) { /* Set CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RST_EN_Z to '0' (low active) */ @@ -158,8 +173,6 @@ void board_init_f(ulong dummy) */ store_boot_info_from_rom(); - ctrl_mmr_unlock(); - /* Init DM early */ spl_early_init(); -- 2.56.0
