board: ti: j784s4: Initialize the ESM & PMIC ESM
authorKeerthy <j-keerthy@ti.com>
Sun, 27 Apr 2025 07:03:22 +0000 (12:33 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 2 May 2025 20:24:13 +0000 (14:24 -0600)
Initialize the ESM & PMIC ESM. This allows things like
the watchdog to reset the board when tripped.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
board/ti/j784s4/evm.c

index c6e46b7..c8d01bf 100644 (file)
@@ -7,6 +7,7 @@
  *
  */
 
+#include <dm.h>
 #include <efi_loader.h>
 #include <init.h>
 #include <spl.h>
@@ -67,4 +68,27 @@ int board_late_init(void)
 
 void spl_board_init(void)
 {
+       struct udevice *dev;
+       int ret;
+
+       if (IS_ENABLED(CONFIG_ESM_K3)) {
+               const char * const esms[] = {"esm@700000", "esm@40800000", "esm@42080000"};
+
+               for (int i = 0; i < ARRAY_SIZE(esms); ++i) {
+                       ret = uclass_get_device_by_name(UCLASS_MISC, esms[i],
+                                                       &dev);
+                       if (ret) {
+                               printf("MISC init for %s failed: %d\n", esms[i], ret);
+                               break;
+                       }
+               }
+       }
+
+       if (IS_ENABLED(CONFIG_ESM_PMIC) && ret == 0) {
+               ret = uclass_get_device_by_driver(UCLASS_MISC,
+                                                 DM_DRIVER_GET(pmic_esm),
+                                                 &dev);
+               if (ret)
+                       printf("ESM PMIC init failed: %d\n", ret);
+       }
 }