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.

Add a get_ti_sci_handle() call before ctrl_mmr_unlock().
get_ti_sci_handle() leads to fetching the TIFS version which only comes
back after TIFS initialization is done. If a response is not received
get_ti_sci_handle() returns after a timeout and continues as it would
have done without this patch. get_ti_sci_handle() has to happen after
spl_early_init() as it requires DM to be setup.

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/am62x/am625_init.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-k3/am62x/am625_init.c 
b/arch/arm/mach-k3/am62x/am625_init.c
index decb50bf853d..43d29a3906e7 100644
--- a/arch/arm/mach-k3/am62x/am625_init.c
+++ b/arch/arm/mach-k3/am62x/am625_init.c
@@ -158,11 +158,20 @@ void board_init_f(ulong dummy)
         */
        store_boot_info_from_rom();
 
-       ctrl_mmr_unlock();
-
        /* Init DM early */
        spl_early_init();
 
+       /*
+        * Require TIFS initialization to finish before unlocking. Otherwise
+        * TIFS may not remove the firewall before U-Boot unlocks them, breaking
+        * random things. get_ti_sci_handle() internally fetches the version
+        * which communicates with TIFS. TIFS should only respond once
+        * initialized.
+        */
+       get_ti_sci_handle();
+
+       ctrl_mmr_unlock();
+
        /*
         * Process pinctrl for the serial0 and serial3, aka WKUP_UART0 and
         * MAIN_UART1 modules and continue regardless of the result of pinctrl.

---
base-commit: 75df64103873fac09642860cedadaffb8cf6b2c7
change-id: 20260923-v2026-10-next-topic-am62-hs-se-fix-unlock-race-15fda445257e

Best regards,
--  
Markus Schneider-Pargmann <[email protected]>

Reply via email to