Initialize both ESM and ESM_PMIC support if available for the board.
If support is not available for either, a warning is printed out.

ESM signals are only properly routed on PM2 version of the J721E SOM,
so only probe the drivers on this device.

Signed-off-by: Tero Kristo <t-kri...@ti.com>
---
 arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index f7f7398081..2de9583937 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -18,6 +18,7 @@
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <dm/pinctrl.h>
+#include "../../../board/ti/common/board_detect.h"
 
 #ifdef CONFIG_SPL_BUILD
 #ifdef CONFIG_K3_LOAD_SYSFW
@@ -114,7 +115,8 @@ static void store_boot_index_from_rom(void)
 
 void board_init_f(ulong dummy)
 {
-#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
+#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) || \
+       defined(CONFIG__ESM_K3) || defined(CONFIG_ESM_PMIC)
        struct udevice *dev;
        int ret;
 #endif
@@ -181,6 +183,25 @@ void board_init_f(ulong dummy)
                printf("AVS init failed: %d\n", ret);
 #endif
 
+#ifdef CONFIG_ESM_K3
+       if (board_ti_k3_is("J721EX-PM2-SOM")) {
+               ret = uclass_get_device_by_driver(UCLASS_MISC,
+                                                 DM_GET_DRIVER(k3_esm), &dev);
+               if (ret)
+                       printf("MISC init failed: %d\n", ret);
+       }
+#endif
+
+#ifdef CONFIG_ESM_PMIC
+       if (board_ti_k3_is("J721EX-PM2-SOM")) {
+               ret = uclass_get_device_by_driver(UCLASS_MISC,
+                                                 DM_GET_DRIVER(pmic_esm),
+                                                 &dev);
+               if (ret)
+                       printf("ESM PMIC init failed: %d\n", ret);
+       }
+#endif
+
 #if defined(CONFIG_K3_J721E_DDRSS)
        ret = uclass_get_device(UCLASS_RAM, 0, &dev);
        if (ret)
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Reply via email to