summaryrefslogtreecommitdiff
path: root/firmware/target/arm/crt0.S
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/crt0.S')
-rw-r--r--firmware/target/arm/crt0.S187
1 files changed, 182 insertions, 5 deletions
diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S
index e7a0a38f36..56876ca9b1 100644
--- a/firmware/target/arm/crt0.S
+++ b/firmware/target/arm/crt0.S
@@ -33,9 +33,8 @@ start:
33 33
34 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ 34 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */
35 35
36#ifndef BOOTLOADER 36#if !defined(BOOTLOADER) || (CONFIG_CPU == DM320)
37 37#if !defined(DEBUG)
38#ifndef DEBUG
39 /* Copy exception handler code to address 0 */ 38 /* Copy exception handler code to address 0 */
40 ldr r2, =_vectorsstart 39 ldr r2, =_vectorsstart
41 ldr r3, =_vectorsend 40 ldr r3, =_vectorsend
@@ -52,8 +51,11 @@ start:
52 ldr r0, =fiq_handler 51 ldr r0, =fiq_handler
53 str r0, [r1, #28] 52 str r0, [r1, #28]
54#endif 53#endif
55 54#endif
56#ifndef STUB 55
56#if !defined(BOOTLOADER)
57
58#if !defined(STUB)
57 /* Zero out IBSS */ 59 /* Zero out IBSS */
58 ldr r2, =_iedata 60 ldr r2, =_iedata
59 ldr r3, =_iend 61 ldr r3, =_iend
@@ -98,6 +100,159 @@ start:
98/* Code for ARM bootloader targets other than iPod go here */ 100/* Code for ARM bootloader targets other than iPod go here */
99 101
100#if CONFIG_CPU == S3C2440 102#if CONFIG_CPU == S3C2440
103 /* Proper initialization pulled from 0x5070 */
104
105 /* BWSCON
106 * Reserved 0
107 * Bank 0:
108 * Bus width 10 (16 bit)
109 * Bank 1:
110 * Buswidth 00 (8 bit)
111 * Disable wait 0
112 * Not using UB/LB 0
113 * Bank 2:
114 * Buswidth 10 (32 bit)
115 * Disable wait 0
116 * Not using UB/LB 0
117 * Bank 3:
118 * Buswidth 10 (32 bit)
119 * Disable wait 0
120 * Use UB/LB 1
121 * Bank 4:
122 * Buswidth 10 (32 bit)
123 * Disable wait 0
124 * Use UB/LB 1
125 * Bank 5:
126 * Buswidth 00 (8 bit)
127 * Disable wait 0
128 * Not using UB/LB 0
129 * Bank 6:
130 * Buswidth 10 (32 bit)
131 * Disable wait 0
132 * Not using UB/LB 0
133 * Bank 7:
134 * Buswidth 00 (8 bit)
135 * Disable wait 0
136 * Not using UB/LB 0
137 */
138 ldr r2,=0x01055102
139 mov r1, #0x48000000
140 str r2, [r1]
141
142 /* BANKCON0
143 * Pagemode: normal (1 data) 00
144 * Pagemode access cycle: 2 clocks 00
145 * Address hold: 2 clocks 10
146 * Chip selection hold time: 1 clock 10
147 * Access cycle: 8 clocks 101
148 * Chip select setup time: 1 clock 01
149 * Address setup time: 0 clock 00
150 */
151 ldr r2,=0x00000D60
152 str r2, [r1, #4]
153
154
155 /* BANKCON1
156 * Pagemode: normal (1 data) 00
157 * Pagemode access cycle: 2 clocks 00
158 * Address hold: 0 clocks 00
159 * Chip selection hold time: 0 clock 00
160 * Access cycle: 1 clocks 000
161 * Chip select setup time: 0 clocks 00
162 * Address setup time: 0 clocks 00
163 */
164 ldr r2,=0x00000000
165 str r2, [r1, #8]
166
167 /* BANKCON2
168 * Pagemode: normal (1 data) 00
169 * Pagemode access cycle: 2 clocks 00
170 * Address hold: 2 clocks 10
171 * Chip selection hold time: 2 clocks 10
172 * Access cycle: 14 clocks 111
173 * Chip select setup time: 4 clocks 11
174 * Address setup time: 0 clocks 00
175 */
176 ldr r2,=0x00001FA0
177 str r2, [r1, #0xC]
178
179 /* BANKCON3 */
180 ldr r2,=0x00001D80
181 str r2, [r1, #0x10]
182 /* BANKCON4 */
183 str r2, [r1, #0x14]
184
185 /* BANKCON5 */
186 ldr r2,=0x00000000
187 str r2, [r1, #0x18]
188
189 /* BANKCON6/7
190 * SCAN: 9 bit 01
191 * Trcd: 3 clocks 01
192 * Tcah: 0 clock 00
193 * Tcoh: 0 clock 00
194 * Tacc: 1 clock 000
195 * Tcos: 0 clock 00
196 * Tacs: 0 clock 00
197 * MT: Sync DRAM 11
198 */
199 ldr r2,=0x00018005
200 str r2, [r1, #0x1C]
201 /* BANKCON7 */
202 str r2, [r1, #0x20]
203
204 /* REFRESH */
205 ldr r2,=0x00980501
206 str r2, [r1, #0x24]
207
208 /* BANKSIZE
209 * BK76MAP: 32M/32M 000
210 * Reserved: 0 0 (was 1)
211 * SCLK_EN: always 1 (was 0)
212 * SCKE_EN: disable 0
213 * Reserved: 0 0
214 * BURST_EN: enabled 1
215 */
216 ldr r2,=0x00000090
217 str r2, [r1, #0x28]
218
219 /* MRSRB6 */
220 ldr r2,=0x00000030
221 str r2, [r1, #0x2C]
222 /* MRSRB7 */
223 str r2, [r1, #0x30]
224
225#if 0
226 /* This next part I am not sure of the purpose */
227
228 /* GPACON */
229 mov r2,#0x01FFFCFF
230 str r2,=0x56000000
231
232 /* GPADAT */
233 mov r2,#0x01FFFEFF
234 str r2,=0x56000004
235
236 /* MRSRB6 */
237 mov r2,#0x00000000
238 str r2,=0x4800002C
239
240 /* GPADAT */
241 ldr r2,=0x01FFFFFF
242 mov r1, #0x56000000
243 str r2, [r1, #4]
244
245 /* MRSRB6 */
246 mov r2,#0x00000030
247 str r2,=0x4800002C
248
249 /* GPACON */
250 mov r2,#0x01FFFFFF
251 str r2,=0x56000000
252
253 /* End of the unknown */
254#endif
255
101 /* get the high part of our execute address */ 256 /* get the high part of our execute address */
102 ldr r2, =0xffffff00 257 ldr r2, =0xffffff00
103 and r4, pc, r2 258 and r4, pc, r2
@@ -118,6 +273,28 @@ start:
118 273
119start_loc: 274start_loc:
120 bl main 275 bl main
276
277#else
278 /* get the high part of our execute address */
279 ldr r2, =0xffffff00
280 and r4, pc, r2
281
282 /* Copy bootloader to safe area - 0x01900000 */
283 mov r5, #0x00900000
284 add r5, r5, #0x01000000
285 ldr r6, = _dataend
286 sub r0, r6, r5 /* length of loader */
287 add r0, r4, r0 /* r0 points to start of loader */
2881:
289 cmp r5, r6
290 ldrcc r2, [r4], #4
291 strcc r2, [r5], #4
292 bcc 1b
293
294 ldr pc, =start_loc /* jump to the relocated start_loc: */
295
296start_loc:
297 bl main
121#endif 298#endif
122 299
123#else /* BOOTLOADER */ 300#else /* BOOTLOADER */