[U-Boot] [PATCH v1 05/20] arm: socfpga: Override 'lowlevel_init' to support ATF
chee.hong.ang at intel.com
chee.hong.ang at intel.com
Mon Dec 2 11:25:06 CET 2019
From: Chee Hong Ang <chee.hong.ang at intel.com>
Override 'lowlevel_init' to support booting ATF from SPL
on Intel SOCFPGA (64bits) platforms.
Signed-off-by: Chee Hong Ang <chee.hong.ang at intel.com>
---
arch/arm/mach-socfpga/Makefile | 2 ++
arch/arm/mach-socfpga/lowlevel_init.S | 48 +++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
create mode 100644 arch/arm/mach-socfpga/lowlevel_init.S
diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile
index 418f543..3310e92 100644
--- a/arch/arm/mach-socfpga/Makefile
+++ b/arch/arm/mach-socfpga/Makefile
@@ -29,6 +29,7 @@ endif
ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
obj-y += clock_manager_s10.o
+obj-y += lowlevel_init.o
obj-y += mailbox_s10.o
obj-y += misc_s10.o
obj-y += mmu-arm64_s10.o
@@ -41,6 +42,7 @@ endif
ifdef CONFIG_TARGET_SOCFPGA_AGILEX
obj-y += clock_manager_agilex.o
+obj-y += lowlevel_init.o
obj-y += mailbox_s10.o
obj-y += misc_s10.o
obj-y += mmu-arm64_s10.o
diff --git a/arch/arm/mach-socfpga/lowlevel_init.S b/arch/arm/mach-socfpga/lowlevel_init.S
new file mode 100644
index 0000000..2fb2f3c
--- /dev/null
+++ b/arch/arm/mach-socfpga/lowlevel_init.S
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2019, Intel Corporation
+ */
+
+#include <asm-offsets.h>
+#include <config.h>
+#include <linux/linkage.h>
+#include <asm/macro.h>
+
+ENTRY(lowlevel_init)
+ mov x29, lr /* Save LR */
+
+#if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
+ branch_if_slave x0, 2f
+
+ ldr x0, =GICD_BASE
+ bl gic_init_secure
+#ifdef CONFIG_SPL_BUILD
+ b 2f
+#else
+ b 3f
+#endif
+
+#if defined(CONFIG_GICV3)
+ ldr x0, =GICR_BASE
+ bl gic_init_secure_percpu
+#elif defined(CONFIG_GICV2)
+ ldr x0, =GICD_BASE
+ ldr x1, =GICC_BASE
+ bl gic_init_secure_percpu
+#endif
+#endif
+
+2:
+#ifdef CONFIG_SPL_BUILD
+ ldr x4, =CPU_RELEASE_ADDR
+ ldr x5, [x4]
+ cbz x5, checkslavecpu
+ br x5
+checkslavecpu:
+ branch_if_slave x0, 2b
+#endif
+
+3:
+ mov lr, x29 /* Restore LR */
+ ret
+ENDPROC(lowlevel_init)
--
2.7.4
More information about the U-Boot
mailing list