]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
imx9: Add v2x_status and ele_info commands
authorYe Li <ye.li@nxp.com>
Fri, 26 Jun 2026 11:11:53 +0000 (19:11 +0800)
committerFabio Estevam <festevam@gmail.com>
Sat, 27 Jun 2026 02:02:46 +0000 (23:02 -0300)
Add v2x_status and ele_info commands to print useful information
for development and debug purpose.

Signed-off-by: Ye Li <ye.li@nxp.com>
arch/arm/mach-imx/imx9/Makefile
arch/arm/mach-imx/imx9/misc.c [new file with mode: 0644]

index 80b697396ea5b6f560c43a5510a9a11d1cc2b550..ec08430d41d2f8c206829c83edbaddb779c78003 100644 (file)
@@ -11,7 +11,7 @@ obj-y += soc.o clock.o clock_root.o trdc.o
 endif
 
 ifneq ($(CONFIG_SPL_BUILD),y)
-obj-y += imx_bootaux.o
+obj-y += imx_bootaux.o misc.o
 endif
 
 obj-$(CONFIG_$(PHASE_)IMX_QB) += qb.o
diff --git a/arch/arm/mach-imx/imx9/misc.c b/arch/arm/mach-imx/imx9/misc.c
new file mode 100644 (file)
index 0000000..3cad67a
--- /dev/null
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2023-2026 NXP
+ *
+ */
+
+#include <command.h>
+#include <cpu_func.h>
+#include <init.h>
+#include <log.h>
+#include <asm/io.h>
+#include <errno.h>
+#include <linux/bitops.h>
+#include <asm/arch-imx/cpu.h>
+#include <asm/mach-imx/ele_api.h>
+#include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
+#include <linux/sizes.h>
+#include <display_options.h>
+
+static int do_v2x_status(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+       int ret;
+       u32 resp = 0;
+       struct v2x_get_state state;
+
+       if (is_imx91() || is_imx93()) {
+               printf("No V2X supported\n");
+               return CMD_RET_FAILURE;
+       }
+
+       ret = ele_v2x_get_state(&state, &resp);
+       if (ret) {
+               printf("get v2x state failed, resp 0x%x, ret %d\n", resp, ret);
+               return CMD_RET_FAILURE;
+       }
+
+       printf("V2X state: 0x%x\n", state.v2x_state);
+       printf("V2X power state: 0x%x\n", state.v2x_power_state);
+       printf("V2X err code: 0x%x\n", state.v2x_err_code);
+
+       return CMD_RET_SUCCESS;
+}
+
+static int do_ele_info(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+       int ret;
+       u32 res = 0, length;
+       struct ele_get_info_data *info;
+
+       /* ELE can't access full DDR */
+       info = (struct ele_get_info_data *)(CONFIG_TEXT_BASE + SZ_2M -
+               sizeof(struct ele_get_info_data));
+       flush_dcache_range((ulong)info, (ulong)info + sizeof(struct ele_get_info_data));
+
+       ret = ele_get_info(info, &res);
+       if (ret) {
+               printf("Get ELE info failed, resp 0x%x, ret %d\n", res, ret);
+               return CMD_RET_FAILURE;
+       }
+
+       invalidate_dcache_range((ulong)info, (ulong)info + sizeof(struct ele_get_info_data));
+
+       printf("SOC: 0x%x\n", info->soc);
+       printf("LC: 0x%x\n", info->lc);
+
+       printf("\nUID:\n");
+       print_buffer(0, &info->uid, 4, 4, 0);
+
+       printf("\nSHA256 ROM PATCH:\n");
+       print_buffer(0, &info->sha256_rom_patch, 4, 8, 0);
+
+       printf("\nSHA FW:\n");
+       print_buffer(0, &info->sha_fw, 4, 8, 0);
+
+       printf("\nOEM SRKH:\n");
+       print_buffer(0, &info->oem_srkh, 4, 16, 0);
+
+       printf("\nSTATE: 0x%x\n", info->state);
+
+       length = (info->hdr >> 16) & 0xffff;
+       if (length == sizeof(struct ele_get_info_data)) {
+               printf("\nOEM PQC SRKH:\n");
+               print_buffer(0, &info->oem_pqc_srkh, 4, 16, 0);
+       }
+
+       return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(v2x_status, CONFIG_SYS_MAXARGS, 1, do_v2x_status,
+          "display v2x status",
+          ""
+);
+
+U_BOOT_CMD(ele_info, CONFIG_SYS_MAXARGS, 1, do_ele_info,
+          "display ELE information",
+          ""
+);