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 .globl rcar_atf_boot_args
27 ENTRY(save_boot_params)
28 adr x8, rcar_atf_boot_args
31 b save_boot_params_ret
32 ENDPROC(save_boot_params)
35 mov x29, lr /* Save LR */
37 #ifndef CONFIG_ARMV8_MULTIENTRY
39 * For single-entry systems the lowlevel init is very simple.
44 #else /* CONFIG_ARMV8_MULTIENTRY is set */
46 #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
47 branch_if_slave x0, 1f
51 #if defined(CONFIG_GICV3)
53 bl gic_init_secure_percpu
54 #elif defined(CONFIG_GICV2)
57 bl gic_init_secure_percpu
61 branch_if_master x0, x1, 2f
64 * Slave should wait for master clearing spin table.
65 * This sync prevent salves observing incorrect
66 * value of spin table and jumping to wrong place.
68 #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3)
72 bl gic_wait_for_interrupt
76 * All slaves will enter EL2 and optionally EL1.
78 adr x4, lowlevel_in_el2
79 ldr x5, =ES_TO_AARCH64
80 bl armv8_switch_to_el2
83 #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
84 adr x4, lowlevel_in_el1
85 ldr x5, =ES_TO_AARCH64
86 bl armv8_switch_to_el1
90 #endif /* CONFIG_ARMV8_MULTIENTRY */
95 mov lr, x29 /* Restore LR */
97 ENDPROC(lowlevel_init)