imx8: add arch_cpu_init arch_cpu_init_dm
authorPeng Fan <peng.fan@nxp.com>
Thu, 18 Oct 2018 12:28:22 +0000 (14:28 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 22 Oct 2018 10:59:01 +0000 (12:59 +0200)
Add arch_cpu_init(_dm) mainly to open the channel between ACore and SCU.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
arch/arm/include/asm/arch-imx8/sys_proto.h
arch/arm/mach-imx/imx8/cpu.c

index f9a3016132958174c69758e2d06b79e3a88dd128..73ffaba7d55bd03f7a2b3b850faa3da15b6cca64 100644 (file)
@@ -6,5 +6,14 @@
 #include <asm/mach-imx/sys_proto.h>
 #include <linux/types.h>
 
+struct pass_over_info_t {
+       u16 barker;
+       u16 len;
+       u32 g_bt_cfg_shadow;
+       u32 card_address_mode;
+       u32 bad_block_count_met;
+       u32 g_ap_mu;
+};
+
 enum boot_device get_boot_device(void);
 int print_bootinfo(void);
index f73ce2fde3fbae85ece91ec4c9d85922bec7b65e..d80b4b175ddf2fa7381824435e666bfc48e00bb2 100644 (file)
@@ -95,6 +95,57 @@ int print_cpuinfo(void)
 }
 #endif
 
+#define BT_PASSOVER_TAG        0x504F
+struct pass_over_info_t *get_pass_over_info(void)
+{
+       struct pass_over_info_t *p =
+               (struct pass_over_info_t *)PASS_OVER_INFO_ADDR;
+
+       if (p->barker != BT_PASSOVER_TAG ||
+           p->len != sizeof(struct pass_over_info_t))
+               return NULL;
+
+       return p;
+}
+
+int arch_cpu_init(void)
+{
+       struct pass_over_info_t *pass_over = get_pass_over_info();
+
+       if (pass_over && pass_over->g_ap_mu == 0) {
+               /*
+                * When ap_mu is 0, means the U-Boot booted
+                * from first container
+                */
+               sc_misc_boot_status(-1, SC_MISC_BOOT_STATUS_SUCCESS);
+       }
+
+       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,imx8-mu");
+       ret = device_bind_driver_to_node(gd->dm_root, "imx8_scu", "imx8_scu",
+                                        offset_to_ofnode(node), &devp);
+
+       if (ret) {
+               printf("could not find scu %d\n", ret);
+               return ret;
+       }
+
+       ret = device_probe(devp);
+       if (ret) {
+               printf("scu probe failed %d\n", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
 int print_bootinfo(void)
 {
        enum boot_device bt_dev = get_boot_device();
@@ -252,7 +303,7 @@ phys_size_t get_effective_memsize(void)
                        if (start > end)
                                continue;
 
-                       /* Find the memory region runs the u-boot */
+                       /* Find the memory region runs the U-Boot */
                        if (start >= PHYS_SDRAM_1 && start <= end1 &&
                            (start <= CONFIG_SYS_TEXT_BASE &&
                            end >= CONFIG_SYS_TEXT_BASE)) {