summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
diff options
context:
space:
mode:
authorYork Sun <york.sun@nxp.com>2017-05-15 15:51:59 (GMT)
committerYork Sun <york.sun@nxp.com>2017-06-02 02:57:24 (GMT)
commit399e2bb60cb76131c49446baf350697142af7c07 (patch)
tree5e13e5deea8e8d73302f4731e1ea1d6d42ef3236 /arch/arm/cpu/armv8/fsl-layerscape/cpu.c
parent1f55a93802ab1522e4f479d1d2730158e26b3567 (diff)
downloadu-boot-399e2bb60cb76131c49446baf350697142af7c07.tar.xz
armv8: layerscape: Make U-Boot EL2 safe
When U-Boot boots from EL2, skip some lowlevel init code requiring EL3, including CCI-400/CCN-504, trust zone, GIC, etc. These initialization tasks are carried out before U-Boot runs. This applies to the RAM version image used for SPL boot if PPA is loaded first. Signed-off-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'arch/arm/cpu/armv8/fsl-layerscape/cpu.c')
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/cpu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index c4bb311..cb3a52c 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -244,6 +244,14 @@ u64 get_page_table_size(void)
int arch_cpu_init(void)
{
+ /*
+ * This function is called before U-Boot relocates itself to speed up
+ * on system running. It is not necessary to run if performance is not
+ * critical. Skip if MMU is already enabled by SPL or other means.
+ */
+ if (get_sctlr() & CR_M)
+ return 0;
+
icache_enable();
__asm_invalidate_dcache_all();
__asm_invalidate_tlb_all();
@@ -530,7 +538,8 @@ int timer_init(void)
unsigned long cntfrq = COUNTER_FREQUENCY_REAL;
/* Update with accurate clock frequency */
- asm volatile("msr cntfrq_el0, %0" : : "r" (cntfrq) : "memory");
+ if (current_el() == 3)
+ asm volatile("msr cntfrq_el0, %0" : : "r" (cntfrq) : "memory");
#endif
#ifdef CONFIG_FSL_LSCH3