]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/arm926ejs/mxs/start.S
mxs: change setup of exception vt
[karo-tx-uboot.git] / arch / arm / cpu / arm926ejs / mxs / start.S
1 /*
2  *  armboot - Startup Code for ARM926EJS CPU-core
3  *
4  *  Copyright (c) 2003  Texas Instruments
5  *
6  *  ----- Adapted for OMAP1610 OMAP730 from ARM925t code ------
7  *
8  *  Copyright (c) 2001  Marius Groger <mag@sysgo.de>
9  *  Copyright (c) 2002  Alex Zupke <azu@sysgo.de>
10  *  Copyright (c) 2002  Gary Jennejohn <garyj@denx.de>
11  *  Copyright (c) 2003  Richard Woodruff <r-woodruff2@ti.com>
12  *  Copyright (c) 2003  Kshitij <kshitij@ti.com>
13  *  Copyright (c) 2010  Albert Aribaud <albert.u.boot@aribaud.net>
14  *
15  * Change to support call back into iMX28 bootrom
16  * Copyright (c) 2011 Marek Vasut <marek.vasut@gmail.com>
17  * on behalf of DENX Software Engineering GmbH
18  *
19  * SPDX-License-Identifier:     GPL-2.0+
20  */
21
22 #include <asm-offsets.h>
23 #include <config.h>
24 #include <common.h>
25 #include <version.h>
26
27 /*
28  *************************************************************************
29  *
30  * Jump vector table as in table 3.1 in [1]
31  *
32  *************************************************************************
33  */
34
35
36 .globl _start
37 _start:
38         b       reset
39         ldr     pc, _undefined_instruction
40         ldr     pc, _software_interrupt
41         ldr     pc, _prefetch_abort
42         ldr     pc, _data_abort
43         ldr     pc, _not_used
44         ldr     pc, _irq
45         ldr     pc, _fiq
46
47 #ifdef CONFIG_SPL_BUILD
48 _undefined_instruction:
49         .word   _undefined_instruction
50 _software_interrupt:
51         .word   _software_interrupt
52 _prefetch_abort:
53         .word   _prefetch_abort
54 _data_abort:
55         .word   _data_abort
56 _not_used:
57         .word   _not_used
58 _irq:
59         .word   _irq
60 _fiq:
61         .word   _fiq
62 #else
63 /*
64  * Vector table, located at address 0x20.
65  * This table allows the code running AFTER SPL, the U-Boot, to install it's
66  * interrupt handlers here. The problem is that the U-Boot is loaded into RAM,
67  * including it's interrupt vectoring table and the table at 0x0 is still the
68  * SPLs. So if interrupt happens in U-Boot, the SPLs interrupt vectoring table
69  * is still used.
70  */
71 _undefined_instruction:
72         .word   undefined_instruction
73 _software_interrupt:
74         .word   software_interrupt
75 _prefetch_abort:
76         .word   prefetch_abort
77 _data_abort:
78         .word   data_abort
79 _not_used:
80         .word   not_used
81 _irq:
82         .word   irq
83 _fiq:
84         .word   fiq
85 #endif /* CONFIG_SPL_BUILD */
86         .balignl 16, 0xdeadbeef
87
88 /*
89  *************************************************************************
90  *
91  * Startup Code (reset vector)
92  *
93  * do important init only if we don't start from memory!
94  * setup Memory and board specific bits prior to relocation.
95  * relocate armboot to ram
96  * setup stack
97  *
98  *************************************************************************
99  */
100
101 .globl _TEXT_BASE
102 _TEXT_BASE:
103 #ifdef CONFIG_SPL_TEXT_BASE
104         .word   CONFIG_SPL_TEXT_BASE
105 #else
106         .word   CONFIG_SYS_TEXT_BASE
107 #endif
108
109 /*
110  * These are defined in the board-specific linker script.
111  * Subtracting _start from them lets the linker put their
112  * relative position in the executable instead of leaving
113  * them null.
114  */
115 .globl _bss_start_ofs
116 _bss_start_ofs:
117         .word __bss_start - _start
118
119 .globl _bss_end_ofs
120 _bss_end_ofs:
121         .word __bss_end - _start
122
123 .globl _end_ofs
124 _end_ofs:
125         .word _end - _start
126
127 #ifdef CONFIG_USE_IRQ
128 /* IRQ stack memory (calculated at run-time) */
129 .globl IRQ_STACK_START
130 IRQ_STACK_START:
131         .word   0x0badc0de
132
133 /* IRQ stack memory (calculated at run-time) */
134 .globl FIQ_STACK_START
135 FIQ_STACK_START:
136         .word 0x0badc0de
137 #endif
138
139 /* IRQ stack memory (calculated at run-time) + 8 bytes */
140 .globl IRQ_STACK_START_IN
141 IRQ_STACK_START_IN:
142         .word   0x0badc0de
143
144 /*
145  * the actual reset code
146  */
147
148 reset:
149         /*
150          * Store all registers on old stack pointer, this will allow us later to
151          * return to the BootROM and let the BootROM load U-Boot into RAM.
152          */
153         push    {r0-r12,r14}
154
155         /* save control register c1 */
156         mrc     p15, 0, r0, c1, c0, 0
157         push    {r0}
158
159         /*
160          * set the cpu to SVC32 mode and store old CPSR register content
161          */
162         mrs     r0,cpsr
163         push    {r0}
164         bic     r0,r0,#0x1f
165         orr     r0,r0,#0xd3
166         msr     cpsr,r0
167
168         bl      board_init_ll
169
170         /*
171          * restore bootrom's cpu mode (especially FIQ)
172          */
173         pop     {r0}
174         msr     cpsr,r0
175
176         /*
177          * restore c1 register
178          * (especially set exception vector location back to
179          * bootrom space which is required by bootrom for USB boot)
180          */
181         pop     {r0}
182         mcr     p15, 0, r0, c1, c0, 0
183
184         pop     {r0-r12,r14}
185         bx      lr
186