diff mbox series

[1/8] arm: mach-k3: j721e_init: initialize ESM support

Message ID 20230410141546.98922-2-n-francis@ti.com
State Deferred
Delegated to: Tom Rini
Headers show
Series Add ESM support for J721E and J7200 | expand

Commit Message

Neha Malcom Francis April 10, 2023, 2:15 p.m. UTC
From: Tero Kristo <t-kristo@ti.com>

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

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
---
 arch/arm/mach-k3/j721e_init.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 9cae3ac67e..b22530f39d 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -23,6 +23,7 @@ 
 #include <fdtdec.h>
 #include <mmc.h>
 #include <remoteproc.h>
+#include "../../../board/ti/common/board_detect.h"
 
 #ifdef CONFIG_K3_LOAD_SYSFW
 struct fwl_data cbass_hc_cfg0_fwls[] = {
@@ -189,7 +190,8 @@  void do_dt_magic(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
@@ -277,6 +279,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_DRIVER_GET(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_DRIVER_GET(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)