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/am62px/am62p5_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 405c5d4fad94..3c567f50b223 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -14,6 +14,7 @@ config SOC_K3_AM62A7 config SOC_K3_AM62P5 bool "TI's K3 based AM62P5 SoC Family Support" + select SPL_DM_EVENT if SPL config SOC_K3_AM642 bool "TI's K3 based AM642 SoC Family Support" diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/am62px/am62p5_init.c index 599ea7cf2dd8..014f494c8e6c 100644 --- a/arch/arm/mach-k3/am62px/am62p5_init.c +++ b/arch/arm/mach-k3/am62px/am62p5_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" @@ -93,6 +94,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) */ @@ -116,8 +131,6 @@ void board_init_f(ulong dummy) */ store_boot_info_from_rom(); - ctrl_mmr_unlock(); - /* Init DM early */ ret = spl_early_init(); if (ret) -- 2.56.0
