]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
authorNeha Malcom Francis <n-francis@ti.com>
Wed, 16 Jul 2025 06:21:56 +0000 (11:51 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 24 Jul 2025 17:50:21 +0000 (11:50 -0600)
Trigger all tests of PBIST and LBIST using appropriate calls to set the
core under test (MAIN R5 2_0) to it's required state.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
arch/arm/mach-k3/j784s4/j784s4_init.c

index 0f11511bda010e698800149e808eb5c39aae3413..53f152ccd9c6dd7c5129669ece9ab92a9eb6f0ad 100644 (file)
@@ -17,6 +17,7 @@
 #include <dm/pinctrl.h>
 #include <mmc.h>
 #include <remoteproc.h>
+#include <k3_bist.h>
 
 #include "../sysfw-loader.h"
 #include "../common.h"
@@ -122,6 +123,48 @@ static void setup_navss_nb(void)
        writel(NB_THREADMAP_BIT2, (uintptr_t)NAVSS0_NBSS_NB1_CFG_NB_THREADMAP);
 }
 
+/* Execute and check results of BIST executed on MCU1_x and MCU4_O */
+static void run_bist_j784s4(struct udevice *dev)
+{
+       struct bist_ops *ops;
+       struct ti_sci_handle *handle;
+       int ret;
+
+       ops = (struct bist_ops *)device_get_ops(dev);
+       handle = get_ti_sci_handle();
+
+       /* get status of HW POST PBIST on MCU1_x */
+       if (ops->run_pbist_post())
+               panic("HW POST LBIST on MCU1_x failed\n");
+
+       /* trigger PBIST tests on MCU4_0 */
+       ret = prepare_pbist(handle);
+       ret |= ops->run_pbist_neg();
+       ret |= deprepare_pbist(handle);
+
+       ret |= prepare_pbist(handle);
+       ret |= ops->run_pbist();
+       ret |= deprepare_pbist(handle);
+
+       ret |= prepare_pbist(handle);
+       ret |= ops->run_pbist_rom();
+       ret |= deprepare_pbist(handle);
+
+       if (ret)
+               panic("PBIST on MCU4_0 failed: %d\n", ret);
+
+       /* get status of HW POST PBIST on MCU1_x */
+       if (ops->run_lbist_post())
+               panic("HW POST LBIST on MCU1_x failed\n");
+
+       /* trigger LBIST tests on MCU1_x */
+       ret = prepare_lbist(handle);
+       ret |= ops->run_lbist();
+       ret |= deprepare_lbist(handle);
+       if (ret)
+               panic("LBIST on MCU4_0 failed: %d\n", ret);
+}
+
 /*
  * This uninitialized global variable would normal end up in the .bss section,
  * but the .bss is cleared between writing and reading this variable, so move
@@ -266,6 +309,15 @@ void board_init_f(ulong dummy)
                        printf("AVS init failed: %d\n", ret);
        }
 
+       if (!IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_BIST)) {
+               ret = uclass_get_device_by_driver(UCLASS_MISC,
+                                                 DM_DRIVER_GET(k3_bist),
+                                                 &dev);
+               if (ret)
+                       panic("Failed to get BIST device: %d\n", ret);
+               run_bist_j784s4(dev);
+       }
+
        if (IS_ENABLED(CONFIG_CPU_V7R))
                setup_navss_nb();