summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/imx9
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2021-12-27 15:39:01 +0800
committerYe Li <ye.li@nxp.com>2022-07-06 22:35:57 +0800
commitef03a19193a2316c4782bf5825d171e534700976 (patch)
tree8f8ae0224d794725d2afe7c499ad5f61fb60ab12 /arch/arm/mach-imx/imx9
parent1133b8e7bebd6fb5cf57612ddb8db3ebbdd6a877 (diff)
LFU-330-19 arm: imx9: Get the chip revision through S400 API
Update the get chip revision methond to use S400 API, also record other information like lifecycle and UID to global data. Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx/imx9')
-rw-r--r--arch/arm/mach-imx/imx9/soc.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index 4e9af1a102..67b86649d7 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -27,6 +27,7 @@
#include <asm/setup.h>
#include <asm/bootm.h>
#include <asm/arch-imx/cpu.h>
+#include <asm/mach-imx/s400_api.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -148,9 +149,17 @@ int board_usb_gadget_port_auto(void)
}
#endif
+static void set_cpu_info(struct sentinel_get_info_data *info)
+{
+ gd->arch.soc_rev = info->soc;
+ gd->arch.lifecycle = info->lc;
+ memcpy((void *)&gd->arch.uid, &info->uid, 4 * sizeof(u32));
+}
+
u32 get_cpu_rev(void)
{
- return (MXC_CPU_IMX93 << 12) | CHIP_REV_1_0;
+ u32 rev = (gd->arch.soc_rev >> 24) - 0xa0;
+ return (MXC_CPU_IMX93 << 12) | (CHIP_REV_1_0 + rev);
}
#define UNLOCK_WORD 0xD928C520 /* unlock word */
@@ -262,6 +271,17 @@ int ft_system_setup(void *blob, struct bd_info *bd)
return 0;
}
+#if defined(CONFIG_SERIAL_TAG) || defined(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+ printf("UID: 0x%x 0x%x 0x%x 0x%x\n",
+ gd->arch.uid[0], gd->arch.uid[1], gd->arch.uid[2], gd->arch.uid[3]);
+
+ serialnr->low = gd->arch.uid[0];
+ serialnr->high = gd->arch.uid[3];
+}
+#endif
+
int arch_cpu_init(void)
{
if (IS_ENABLED(CONFIG_SPL_BUILD)) {
@@ -276,6 +296,28 @@ int arch_cpu_init(void)
return 0;
}
+int arch_cpu_init_dm(void)
+{
+ struct udevice *devp;
+ int node, ret;
+ u32 res;
+ struct sentinel_get_info_data info;
+
+ node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "fsl,imx93-mu-s4");
+
+ ret = uclass_get_device_by_of_offset(UCLASS_MISC, node, &devp);
+ if (ret)
+ return ret;
+
+ ret = ahab_get_info(&info, &res);
+ if (ret)
+ return ret;
+
+ set_cpu_info(&info);
+
+ return 0;
+}
+
int timer_init(void)
{
#ifdef CONFIG_SPL_BUILD