1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * arch/arm/cpu/armv8/rcar_gen3/lowlevel_init.S
4 * This file is lowlevel initialize routine.
6 * (C) Copyright 2015 Renesas Electronics Corporation
8 * This file is based on the arch/arm/cpu/armv8/start.S
11 * David Feng <fenghua@phytium.com.cn>
14 #include <asm-offsets.h>
16 #include <linux/linkage.h>
17 #include <asm/macro.h>
20 mov x29, lr /* Save LR */
22 #ifndef CONFIG_ARMV8_MULTIENTRY
24 * For single-entry systems the lowlevel init is very simple.
29 #else /* CONFIG_ARMV8_MULTIENTRY is set */
31 #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
32 branch_if_slave x0, 1f
36 #if defined(CONFIG_GICV3)
38 bl gic_init_secure_percpu
39 #elif defined(CONFIG_GICV2)
42 bl gic_init_secure_percpu
46 branch_if_master x0, x1, 2f
49 * Slave should wait for master clearing spin table.
50 * This sync prevent salves observing incorrect
51 * value of spin table and jumping to wrong place.
53 #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
57 bl gic_wait_for_interrupt
61 * All slaves will enter EL2 and optionally EL1.
63 adr x4, lowlevel_in_el2
64 ldr x5, =ES_TO_AARCH64
65 bl armv8_switch_to_el2
68 #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
69 adr x4, lowlevel_in_el1
70 ldr x5, =ES_TO_AARCH64
71 bl armv8_switch_to_el1
75 #endif /* CONFIG_ARMV8_MULTIENTRY */
80 mov lr, x29 /* Restore LR */
82 ENDPROC(lowlevel_init)