]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: imx8ulp: Probe the S400 MU device in arch init
authorYe Li <ye.li@nxp.com>
Sat, 7 Aug 2021 08:01:00 +0000 (16:01 +0800)
committerStefano Babic <sbabic@denx.de>
Mon, 9 Aug 2021 12:46:51 +0000 (14:46 +0200)
Need probe the S400 MU device in arch_cpu_init_dm, so we can use
S400 API in u-boot

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx8ulp/soc.c

index c5e20408c67f794c384417b6266f18a6efac5c18..8828a943183efac2028808e881c071aad4ad0f93 100644 (file)
 #include <asm/arch/mu_hal.h>
 #include <cpu_func.h>
 #include <asm/setup.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+#include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -322,7 +328,18 @@ int dram_init(void)
 #ifdef CONFIG_SERIAL_TAG
 void get_board_serial(struct tag_serialnr *serialnr)
 {
-       /* TODO */
+       u32 uid[4];
+       u32 res;
+       int ret;
+
+       ret = ahab_read_common_fuse(1, uid, 4, &res);
+       if (ret)
+               printf("ahab read fuse failed %d, 0x%x\n", ret, res);
+       else
+               printf("UID 0x%x,0x%x,0x%x,0x%x\n", uid[0], uid[1], uid[2], uid[3]);
+
+       serialnr->low = uid[0];
+       serialnr->high = uid[3];
 }
 #endif
 
@@ -396,6 +413,22 @@ int arch_cpu_init(void)
        return 0;
 }
 
+int arch_cpu_init_dm(void)
+{
+       struct udevice *devp;
+       int node, ret;
+
+       node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "fsl,imx8ulp-mu");
+
+       ret = uclass_get_device_by_of_offset(UCLASS_MISC, node, &devp);
+       if (ret) {
+               printf("could not get S400 mu %d\n", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
 #if defined(CONFIG_SPL_BUILD)
 __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 {