[U-Boot] [PATCH 17/41] imx8: add arch_cpu_init

Peng Fan peng.fan at nxp.com
Mon May 28 12:25:02 UTC 2018


Add arch_cpu_init mainly to open the channel between ACore and SCU.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/include/asm/arch-imx8/imx-regs.h  |  2 ++
 arch/arm/include/asm/arch-imx8/sys_proto.h |  9 +++++++
 arch/arm/mach-imx/imx8/cpu.c               | 40 ++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)

diff --git a/arch/arm/include/asm/arch-imx8/imx-regs.h b/arch/arm/include/asm/arch-imx8/imx-regs.h
index bfba2daae2..8a92275ae7 100644
--- a/arch/arm/include/asm/arch-imx8/imx-regs.h
+++ b/arch/arm/include/asm/arch-imx8/imx-regs.h
@@ -38,6 +38,8 @@
 #define MXS_GPMI_BASE		(APBH_DMA_ARB_BASE_ADDR + 0x02000)
 #define MXS_BCH_BASE		(APBH_DMA_ARB_BASE_ADDR + 0x04000)
 
+#define PASS_OVER_INFO_ADDR	0x0010fe00
+
 #define USB_BASE_ADDR		0x5b0d0000
 #define USB_PHY0_BASE_ADDR	0x5b100000
 
diff --git a/arch/arm/include/asm/arch-imx8/sys_proto.h b/arch/arm/include/asm/arch-imx8/sys_proto.h
index f9a3016132..73ffaba7d5 100644
--- a/arch/arm/include/asm/arch-imx8/sys_proto.h
+++ b/arch/arm/include/asm/arch-imx8/sys_proto.h
@@ -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);
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 5223726b59..9ea90f1215 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -82,6 +82,46 @@ 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)
+{
+	sc_ipc_t ipchndl;
+	sc_err_t scierr;
+	struct pass_over_info_t *pass_over;
+
+	gd->arch.ipc_channel_handle = 0;
+
+	/* Open IPC channel */
+	scierr = sc_ipc_open(&ipchndl, SC_IPC_CH);
+	if (scierr != SC_ERR_NONE)
+		return -EPERM;
+
+	gd->arch.ipc_channel_handle = ipchndl;
+
+	pass_over = get_pass_over_info();
+	if (pass_over && pass_over->g_ap_mu == 0) {
+		/*
+		 * When ap_mu is 0, means the u-boot is boot
+		 * from first container
+		 */
+		sc_misc_boot_status(ipchndl, SC_MISC_BOOT_STATUS_SUCCESS);
+	}
+
+	return 0;
+}
+
 #if defined(CONFIG_IMX8QXP)
 #define FUSE_MAC0_WORD0 708
 #define FUSE_MAC0_WORD1 709
-- 
2.14.1



More information about the U-Boot mailing list