1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <asm-offsets.h>
25#include <config.h>
26#include <timestamp.h>
27#include "version.h"
28#include <asm/cache.h>
29
30#ifndef CONFIG_IDENT_STRING
31#define CONFIG_IDENT_STRING ""
32#endif
33
34#define _START _start
35#define _FAULT _fault
36
37#define SAVE_ALL \
38 move.w
39 subl
40 moveml %d0-%d7/%a0-%a6,%sp@;
41
42#define RESTORE_ALL \
43 moveml %sp@,%d0-%d7/%a0-%a6; \
44 addl
45 rte;
46
47
48#define ASM_DRAMINIT (asm_dram_init - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
49#define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
50#endif
51
52.text
53
54
55
56
57_vectors:
58
59
60INITSP: .long 0
61INITPC: .long ASM_DRAMINIT
62#else
63INITSP: .long 0
64INITPC: .long _START
65#endif
66
67vector02: .long _FAULT
68vector03: .long _FAULT
69vector04: .long _FAULT
70vector05: .long _FAULT
71vector06: .long _FAULT
72vector07: .long _FAULT
73vector08: .long _FAULT
74vector09: .long _FAULT
75vector0A: .long _FAULT
76vector0B: .long _FAULT
77vector0C: .long _FAULT
78vector0D: .long _FAULT
79vector0E: .long _FAULT
80vector0F: .long _FAULT
81
82
83vector10_17:
84.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
85
86vector18: .long _FAULT
87vector19: .long _FAULT
88vector1A: .long _FAULT
89vector1B: .long _FAULT
90vector1C: .long _FAULT
91vector1D: .long _FAULT
92vector1E: .long _FAULT
93vector1F: .long _FAULT
94
95
96
97vector20_2F:
98.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
99.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
100
101
102vector30_3F:
103.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
104.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
105
106vector64_127:
107.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
108.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
109.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
110.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
111.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
112.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
113.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
114.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
115
116vector128_191:
117.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
118.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
119.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
120.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
121.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
122.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
123.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
124.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
125
126vector192_255:
127.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
128.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
129.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
130.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
131.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
132.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
133.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
134.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
135#endif
136
137
138
139asm_sbf_img_hdr:
140 .long 0x00000000
141 .long 0x00020000
142 .long CONFIG_SYS_TEXT_BASE
143
144asm_dram_init:
145 move.l
146 movec %d0, %RAMBAR1
147 move.l
148 clr.l %sp@-
149
150
151 move.l
152 move.l
153 move.l
154 move.l
155 move.l
156 move.l
157
158
159
160
161
162
163 move.l
164 move.b
165 nop
166
167
168 move.l
169 move.l
170
171
172 move.l
173 move.l
174#ifdef CONFIG_SYS_SDRAM_BASE1
175 lsr.l
176#endif
177
178dramsz_loop:
179 lsr.l
180 add.l
181 cmp.l
182 bne dramsz_loop
183
184
185 move.l
186 or.l %d1, (%a1)
187#ifdef CONFIG_SYS_SDRAM_BASE1
188 move.l
189 or.l %d1, (%a2)
190#endif
191 nop
192
193
194 move.l
195 move.l
196 nop
197 move.l
198 move.l
199 nop
200
201 move.l
202 move.l
203
204
205 move.l
206 nop
207
208
209 move.l
210 nop
211 move.l
212 nop
213
214 move.l
215wait1000:
216 nop
217 subq.l
218 bne wait1000
219
220
221 move.l
222 nop
223
224
225 move.l
226 nop
227 move.l %d0, (%a2)
228 move.l %d0, (%a2)
229 nop
230
231 move.l
232 and.l
233 or.l
234 move.l %d0, (%a2)
235 nop
236
237
238
239
240
241
242
243
244
245
246
247 move.l
248 move.b
249 move.b %d0, (%a0)
250
251
252#ifdef CONFIG_SYS_DSPI_CS0
253 move.b (%a0), %d0
254 or.l
255 move.b %d0, (%a0)
256#endif
257#ifdef CONFIG_SYS_DSPI_CS2
258 move.l
259 move.b (%a0), %d0
260 or.l
261 move.b %d0, (%a0)
262#endif
263 nop
264
265
266 move.l
267 move.l
268
269 move.l
270 move.l
271
272 move.l
273 move.l
274
275 move.l
276 move.l (%a1)+, %d5
277 move.l (%a1), %a4
278
279 move.l
280 move.l
281
282 move.l
283
284
285 move.l
286 jsr asm_dspi_wr_status
287 jsr asm_dspi_rd_status
288
289 move.l
290 jsr asm_dspi_wr_status
291 jsr asm_dspi_rd_status
292
293 move.l
294 jsr asm_dspi_wr_status
295 jsr asm_dspi_rd_status
296
297 move.l
298 jsr asm_dspi_wr_status
299 jsr asm_dspi_rd_status
300
301 move.l
302 jsr asm_dspi_wr_status
303 jsr asm_dspi_rd_status
304
305
306asm_dspi_rd_loop1:
307 move.l
308 jsr asm_dspi_wr_status
309 jsr asm_dspi_rd_status
310
311 move.b %d1, (%a0)
312
313 add.l
314 sub.l
315 bne asm_dspi_rd_loop1
316
317
318asm_dspi_rd_loop2:
319 move.l
320 jsr asm_dspi_wr_status
321 jsr asm_dspi_rd_status
322
323 move.b %d1, (%a4)
324
325 add.l
326 sub.l
327 bne asm_dspi_rd_loop2
328
329 move.l
330 jsr asm_dspi_wr_status
331 jsr asm_dspi_rd_status
332
333
334 move.l
335 move.l %a0, (%a1)
336 jmp (%a0)
337
338asm_dspi_wr_status:
339 move.l (%a1), %d0
340 and.l
341 cmp.l
342 bgt asm_dspi_wr_status
343
344 move.l %d2, (%a2)
345 rts
346
347asm_dspi_rd_status:
348 move.l (%a1), %d0
349 and.l
350 lsr.l
351 cmp.l
352 beq asm_dspi_rd_status
353
354 move.b (%a3), %d1
355 rts
356#endif
357
358 .text
359 . = 0x400
360 .globl _start
361_start:
362 nop
363 nop
364 move.w
365
366
367
368 move.l
369 movec %d0, %VBR
370#else
371 move.l
372 movec %d0, %VBR
373
374 move.l
375 movec %d0, %RAMBAR1
376#endif
377
378
379 move.l
380 movec %d0, %CACR
381 move.l
382 movec %d0, %ACR0
383 movec %d0, %ACR1
384
385
386 move.l
387 move.l
388 move.l
389 move.l %d0, (%a1)
390 move.l %d0, (%a2)
391
392
393
394 move.l
395 clr.l %sp@-
396
397 move.l
398
399 bsr cpu_init_f
400 bsr board_init_f
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417 .globl relocate_code
418relocate_code:
419 link.w %a6,
420 move.l 8(%a6), %sp
421
422 move.l 12(%a6), %d0
423 move.l 16(%a6), %a0
424
425 move.l
426 move.l
427 move.l %a0, %a3
428
429
4301:
431 move.l (%a1)+, (%a3)+
432 cmp.l %a1,%a2
433 bgt.s 1b
434
435
436
437
438
439 move.l %a0, %a1
440 add.l
441 jmp (%a1)
442
443in_ram:
444
445clear_bss:
446
447
448
449 move.l %a0, %a1
450 add.l
451 move.l %a0, %d1
452 add.l
4536:
454 clr.l (%a1)+
455 cmp.l %a1,%d1
456 bgt.s 6b
457
458
459
460
461 move.l %a0, %a1
462 add.l
463 move.l %a1,%a5
464
465 move.l %a0, %a2
466 add.l
467
4687:
469 move.l (%a1),%d1
470 sub.l
471 add.l %a0,%d1
472 move.l %d1,(%a1)+
473 cmp.l %a2, %a1
474 bne 7b
475
476
477 move.l %a0, %a1
478 add.l
479
480
481 move.l %a0,-(%sp)
482 move.l %d0,-(%sp)
483 jsr (%a1)
484
485
486
487 .globl _fault
488_fault:
489 jmp _fault
490 .globl _exc_handler
491
492_exc_handler:
493 SAVE_ALL
494 movel %sp,%sp@-
495 bsr exc_handler
496 addql
497 RESTORE_ALL
498
499 .globl _int_handler
500_int_handler:
501 SAVE_ALL
502 movel %sp,%sp@-
503 bsr int_handler
504 addql
505 RESTORE_ALL
506
507
508
509 .globl version_string
510version_string:
511 .ascii U_BOOT_VERSION
512 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
513 .ascii CONFIG_IDENT_STRING, "\0"
514 .align 4
515