5 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm-offsets.h>
11 #include <linux/linkage.h>
12 #include <asm/macro.h>
13 #include <asm/armv8/mmu.h>
15 /*************************************************************************
17 * Startup Code (reset vector)
19 *************************************************************************/
29 .quad CONFIG_SYS_TEXT_BASE
32 * These are defined in the linker script.
40 .quad __bss_start - _start
44 .quad __bss_end - _start
48 * Could be EL3/EL2/EL1, Initial State:
49 * Little Endian, MMU Disabled, i/dCache Disabled
52 switch_el x1, 3f, 2f, 1f
54 msr cptr_el3, xzr /* Enable FP/SIMD */
55 ldr x0, =COUNTER_FREQUENCY
56 msr cntfrq_el0, x0 /* Initialize CNTFRQ */
60 msr cptr_el2, x0 /* Enable FP/SIMD */
64 msr cpacr_el1, x0 /* Enable FP/SIMD */
67 /* Cache/BPB/TLB Invalidate */
68 bl __asm_flush_dcache_all /* dCache clean&invalidate */
69 bl __asm_invalidate_icache_all /* iCache invalidate */
70 bl __asm_invalidate_tlb_all /* invalidate TLBs */
72 /* Processor specific initialization */
75 branch_if_master x0, x1, master_cpu
82 ldr x1, =CPU_RELEASE_ADDR
85 br x0 /* branch to the given address */
93 /*-----------------------------------------------------------------------*/
96 /* Initialize GIC Secure Bank Status */
97 mov x29, lr /* Save LR */
100 branch_if_master x0, x1, 1f
103 * Slave should wait for master clearing spin table.
104 * This sync prevent salves observing incorrect
105 * value of spin table and jumping to wrong place.
110 * All processors will enter EL2 and optionally EL1.
112 bl armv8_switch_to_el2
113 #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
114 bl armv8_switch_to_el1
118 mov lr, x29 /* Restore LR */
120 ENDPROC(lowlevel_init)
122 /*-----------------------------------------------------------------------*/
124 ENTRY(c_runtime_cpu_setup)
125 /* If I-cache is enabled invalidate it */
126 #ifndef CONFIG_SYS_ICACHE_OFF
127 ic iallu /* I+BTB cache invalidate */
133 switch_el x1, 3f, 2f, 1f
142 ENDPROC(c_runtime_cpu_setup)