2 * arch/arm/cpu/armv8/rcar_gen3/lowlevel_init.S
3 * This file is lowlevel initialize routine.
5 * (C) Copyright 2015 Renesas Electronics Corporation
7 * This file is based on the arch/arm/cpu/armv8/start.S
10 * David Feng <fenghua@phytium.com.cn>
12 * SPDX-License-Identifier: GPL-2.0+
15 #include <asm-offsets.h>
17 #include <linux/linkage.h>
18 #include <asm/macro.h>
21 mov x29, lr /* Save LR */
23 #ifndef CONFIG_ARMV8_MULTIENTRY
25 * For single-entry systems the lowlevel init is very simple.
30 #else /* CONFIG_ARMV8_MULTIENTRY is set */
32 #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
33 branch_if_slave x0, 1f
37 #if defined(CONFIG_GICV3)
39 bl gic_init_secure_percpu
40 #elif defined(CONFIG_GICV2)
43 bl gic_init_secure_percpu
47 branch_if_master x0, x1, 2f
50 * Slave should wait for master clearing spin table.
51 * This sync prevent salves observing incorrect
52 * value of spin table and jumping to wrong place.
54 #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
58 bl gic_wait_for_interrupt
62 * All slaves will enter EL2 and optionally EL1.
64 adr x4, lowlevel_in_el2
65 ldr x5, =ES_TO_AARCH64
66 bl armv8_switch_to_el2
69 #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
70 adr x4, lowlevel_in_el1
71 ldr x5, =ES_TO_AARCH64
72 bl armv8_switch_to_el1
76 #endif /* CONFIG_ARMV8_MULTIENTRY */
81 mov lr, x29 /* Restore LR */
83 ENDPROC(lowlevel_init)