Le 30/10/2026 à 13:27, Markus Schneider-Pargmann a écrit :
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]/
Tested-by: Richard Genoud <[email protected]> # on j722s HS-FS

Thanks!> Signed-off-by: Markus Schneider-Pargmann <[email protected]>
---
  arch/arm/mach-k3/Kconfig            |  1 +
  arch/arm/mach-k3/j722s/j722s_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 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)



--
Richard Genoud, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to