]> git.sur5r.net Git - u-boot/blob - arch/arm/cpu/armv7/sunxi/psci_head.S
sunxi: Add PSCI implementation in C
[u-boot] / arch / arm / cpu / armv7 / sunxi / psci_head.S
1 /*
2  * Copyright (C) 2013 - ARM Ltd
3  * Author: Marc Zyngier <marc.zyngier@arm.com>
4  *
5  * Based on code by Carl van Schaik <carl@ok-labs.com>.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include <config.h>
21 #include <linux/linkage.h>
22
23 #include <asm/arch-armv7/generictimer.h>
24 #include <asm/gic.h>
25 #include <asm/macro.h>
26 #include <asm/psci.h>
27 #include <asm/arch/cpu.h>
28
29 /*
30  * Memory layout:
31  *
32  * SECURE_RAM to text_end :
33  *      ._secure_text section
34  * text_end to ALIGN_PAGE(text_end):
35  *      nothing
36  * ALIGN_PAGE(text_end) to ALIGN_PAGE(text_end) + 0x1000)
37  *      1kB of stack per CPU (4 CPUs max).
38  */
39
40         .pushsection ._secure.text, "ax"
41
42         .arch_extension sec
43
44 #define GICD_BASE               (SUNXI_GIC400_BASE +  0x1000)
45 #define GICC_BASE               (SUNXI_GIC400_BASE +  0x2000)
46
47 @ {r0, r1, r2, ip} from _do_nonsec_entry(kernel_entry, 0, machid, r2) in
48 @ arch/arm/lib/bootm.c:boot_jump_linux() must remain unchanged across
49 @ this function.
50 ENTRY(psci_arch_init)
51         mov     r6, lr
52         mov     r7, r0
53         bl      psci_get_cpu_id         @ CPU ID => r0
54         bl      psci_get_cpu_stack_top  @ stack top => r0
55         sub     r0, r0, #4              @ Save space for target PC
56         mov     sp, r0
57         mov     r0, r7
58         mov     lr, r6
59
60         push    {r0, r1, r2, ip, lr}
61         bl      sunxi_gic_init
62         pop     {r0, r1, r2, ip, pc}
63 ENDPROC(psci_arch_init)
64
65 ENTRY(psci_text_end)
66         .popsection