Signed-off-by: Markus Schneider-Pargmann <[email protected]>
---
 arch/arm/mach-k3/Kconfig            |  1 +
 arch/arm/mach-k3/j722s/j722s_init.c | 20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index a32ed3a9683f..ec3e95c11a39 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -30,6 +30,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..685c4d98a8a5 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,18 @@ static void ctrl_mmr_unlock(void)
        mmr_unlock(PADCFG_MMR1_BASE, 1);
 }
 
+/*
+ * Called by spl_early_init() before anything is probed.
+ */
+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,9 +97,10 @@ static void k3_spl_init(void)
         */
        store_boot_info_from_rom();
 
-       ctrl_mmr_unlock();
-
-       /* Init DM early */
+       /*
+        * Init DM early. Note that this calls k3_spl_dm_post_init_f before
+        * probing to do ctrl_mmr_unlock.
+        */
        ret = spl_early_init();
        if (ret)
                panic("spl_early_init() failed: %d\n", ret);
-- 
2.56.0

Reply via email to