]> git.sur5r.net Git - u-boot/blob - arch/arm/cpu/armv7/rmobile/lowlevel_init.S
arm: rmobile: Support build with gcc-4.6 or later
[u-boot] / arch / arm / cpu / armv7 / rmobile / lowlevel_init.S
1 /*
2  * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.Iwamatsu.yj@renesas.com>
3  * Copyright (C) 2012 Renesas Solutions Corp.
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23
24 #include <config.h>
25 #include <linux/linkage.h>
26
27 ENTRY(lowlevel_init)
28         ldr             r0, =MERAM_BASE
29         mov             r1, #0x0
30         str             r1, [r0]
31
32         mrc             p15, 0, r0, c0, c0, 5
33         ands    r0, r0, #0xF
34         beq             lowlevel_init__
35         b               wait_interrupt
36
37         .pool
38         .align 4
39
40 wait_interrupt:
41         ldr     r1, =ICCICR
42         mov     r2, #0x0
43         str     r2, [r1]
44         mov     r2, #0xF0
45         adds    r1, r1, #4 /* ICCPMR */
46         str     r2, [r1]
47         ldr     r1, =ICCICR
48         mov     r2, #0x1
49         str     r2, [r1]
50
51 wait_loop:
52         .long   0xE320F003 /* wfi */
53
54         ldr             r2, [r1, #0xC]
55         str             r2, [r1, #0x10]
56
57         ldr             r0, =MERAM_BASE
58         ldr             r2, [r0]
59         cmp             r2, #0
60         movne   pc, r2
61
62         b               wait_loop
63
64 wait_loop_end:
65         .pool
66         .align 4
67
68 lowlevel_init__:
69
70         mov r0, #0x200000
71
72 loop0:
73         subs r0, r0, #1
74         bne  loop0
75
76         ldr sp, MERAM_STACK
77
78         str ip, [sp]    /* stash old link register */
79         mov ip, lr      /* save link reg across call */
80         bl  s_init
81
82         ldr ip, [sp]    /* restore save ip */
83         mov lr, ip      /* restore link reg */
84
85         /* back to arch calling code */
86         mov pc, lr
87
88         .pool
89         .align 4
90
91 ENDPROC(lowlevel_init)
92         .ltorg
93
94 MERAM_STACK:
95         .word LOW_LEVEL_MERAM_STACK