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 <config.h>
25#include <timestamp.h>
26#include "version.h"
27
28#ifndef CONFIG_IDENT_STRING
29#define CONFIG_IDENT_STRING ""
30#endif
31
32
33#define CACR_STATUS (CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-12)
34#define ICACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END- 8)
35#define DCACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END- 4)
36
37#define _START _start
38#define _FAULT _fault
39
40#define SAVE_ALL \
41 move.w
42 subl
43 moveml %d0-%d7/%a0-%a6,%sp@;
44
45#define RESTORE_ALL \
46 moveml %sp@,%d0-%d7/%a0-%a6; \
47 addl
48 rte;
49
50
51#define ASM_DRAMINIT (asm_dram_init - TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
52#define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
53#endif
54
55.text
56
57
58
59
60
61_vectors:
62
63
64INITSP: .long 0
65INITPC: .long ASM_DRAMINIT
66
67#else
68
69INITSP: .long 0
70INITPC: .long _START
71
72#endif
73
74vector02: .long _FAULT
75vector03: .long _FAULT
76vector04: .long _FAULT
77vector05: .long _FAULT
78vector06: .long _FAULT
79vector07: .long _FAULT
80vector08: .long _FAULT
81vector09: .long _FAULT
82vector0A: .long _FAULT
83vector0B: .long _FAULT
84vector0C: .long _FAULT
85vector0D: .long _FAULT
86vector0E: .long _FAULT
87vector0F: .long _FAULT
88
89
90vector10_17:
91.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
92
93vector18: .long _FAULT
94vector19: .long _FAULT
95vector1A: .long _FAULT
96vector1B: .long _FAULT
97vector1C: .long _FAULT
98vector1D: .long _FAULT
99vector1E: .long _FAULT
100vector1F: .long _FAULT
101
102
103
104
105vector20_2F:
106.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
107.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
108
109
110vector30_3F:
111.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
112.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
113
114vector64_127:
115.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
116.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
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
124vector128_191:
125.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
126.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
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
134vector192_255:
135.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
136.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
137.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
138.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
139.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
140.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
141.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
142.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
143#endif
144
145
146
147asm_sbf_img_hdr:
148 .long 0x00000000
149 .long 0x00030000
150 .long TEXT_BASE
151
152asm_dram_init:
153 move.w
154
155 move.l
156 movec %d0, %VBR
157
158 move.l
159 movec %d0, %RAMBAR1
160
161
162 move.l
163 move.l
164 move.l
165 move.l
166 move.l %d0, (%a1)
167 move.l %d0, (%a2)
168 move.l %d0, (%a3)
169
170
171 move.l
172 movec %d0, %CACR
173 move.l
174 movec %d0, %ACR0
175 movec %d0, %ACR1
176 movec %d0, %ACR2
177 movec %d0, %ACR3
178
179 move.l
180 clr.l %sp@-
181
182
183 move.l
184 move.l
185 move.l
186 move.l
187 move.l
188 move.l
189
190
191
192 move.l
193 move.b
194 nop
195
196
197 move.l
198 move.l
199
200
201 move.l
202 move.l
203#ifdef CONFIG_SYS_SDRAM_BASE1
204 lsr.l
205#endif
206
207dramsz_loop:
208 lsr.l
209 add.l
210 cmp.l
211 bne dramsz_loop
212
213
214 move.l
215 or.l %d1, (%a1)
216#ifdef CONFIG_SYS_SDRAM_BASE1
217 move.l
218 or.l %d1, (%a2)
219#endif
220 nop
221
222
223 move.l
224 move.l
225 nop
226 move.l
227 move.l
228 nop
229
230 move.l
231 move.l
232
233
234 move.l
235 nop
236
237#ifdef CONFIG_M54455EVB
238
239 move.l
240 nop
241 move.l
242 nop
243#endif
244
245 move.l
246 jsr asm_delay
247
248
249 move.l
250 nop
251
252
253 move.l
254 nop
255 move.l %d0, (%a2)
256 move.l %d0, (%a2)
257 nop
258
259#ifdef CONFIG_M54455EVB
260 move.l
261 nop
262
263
264 move.l
265 nop
266 move.l
267#endif
268
269 move.l
270 jsr asm_delay
271
272 move.l
273 and.l
274#ifdef CONFIG_M54455EVB
275 or.l
276
277 or.l
278#endif
279 move.l %d1, (%a2)
280 nop
281
282 move.l
283 jsr asm_delay
284
285
286
287
288
289
290
291
292
293
294asm_dspi_init:
295 move.l
296 move.b
297
298
299 move.l
300 move.l
301
302 move.l
303 move.l
304
305 move.l
306 move.l
307
308 move.l
309 move.l (%a1)+, %d5
310 move.l (%a1), %a4
311
312 move.l
313 move.l
314
315 move.l
316
317
318 move.l
319 jsr asm_dspi_wr_status
320 jsr asm_dspi_rd_status
321
322 move.l
323 jsr asm_dspi_wr_status
324 jsr asm_dspi_rd_status
325
326 move.l
327 jsr asm_dspi_wr_status
328 jsr asm_dspi_rd_status
329
330 move.l
331 jsr asm_dspi_wr_status
332 jsr asm_dspi_rd_status
333
334 move.l
335 jsr asm_dspi_wr_status
336 jsr asm_dspi_rd_status
337
338
339asm_dspi_rd_loop1:
340 move.l
341 jsr asm_dspi_wr_status
342 jsr asm_dspi_rd_status
343
344 move.b %d1, (%a0)
345
346 add.l
347 sub.l
348 bne asm_dspi_rd_loop1
349
350
351asm_dspi_rd_loop2:
352 move.l
353 jsr asm_dspi_wr_status
354 jsr asm_dspi_rd_status
355
356 move.b %d1, (%a4)
357
358 add.l
359 sub.l
360 bne asm_dspi_rd_loop2
361
362 move.l
363 jsr asm_dspi_wr_status
364 jsr asm_dspi_rd_status
365
366
367 move.l
368 jmp (%a0)
369
370asm_dspi_wr_status:
371 move.l (%a1), %d0
372 and.l
373 cmp.l
374 bgt asm_dspi_wr_status
375
376 move.l %d2, (%a2)
377 rts
378
379asm_dspi_rd_status:
380 move.l (%a1), %d0
381 and.l
382 lsr.l
383 cmp.l
384 beq asm_dspi_rd_status
385
386 move.b (%a3), %d1
387 rts
388
389asm_delay:
390 nop
391 subq.l
392 bne asm_delay
393 rts
394#endif
395
396 .text
397 . = 0x400
398 .globl _start
399_start:
400
401 nop
402 nop
403 move.w
404
405
406 move.l
407 movec %d0, %VBR
408
409 move.l
410 movec %d0, %RAMBAR1
411
412
413 move.l
414 move.l
415 move.l
416 move.l
417 move.l %d0, (%a1)
418 move.l %d0, (%a2)
419 move.l %d0, (%a3)
420
421
422 move.l
423 movec %d0, %CACR
424 move.l
425 movec %d0, %ACR0
426 movec %d0, %ACR1
427 movec %d0, %ACR2
428 movec %d0, %ACR3
429
430
431
432 move.l
433 clr.l %sp@-
434#endif
435
436 move.l
437
438 bsr cpu_init_f
439 bsr board_init_f
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456 .globl relocate_code
457relocate_code:
458 link.w %a6,
459 move.l 8(%a6), %sp
460
461 move.l 12(%a6), %d0
462 move.l 16(%a6), %a0
463
464 move.l
465 move.l
466 move.l %a0, %a3
467
468
4691:
470 move.l (%a1)+, (%a3)+
471 cmp.l %a1,%a2
472 bgt.s 1b
473
474
475
476
477
478 move.l %a0, %a1
479 add.l
480 jmp (%a1)
481
482in_ram:
483
484clear_bss:
485
486
487
488 move.l %a0, %a1
489 add.l
490 move.l %a0, %d1
491 add.l
4926:
493 clr.l (%a1)+
494 cmp.l %a1,%d1
495 bgt.s 6b
496
497
498
499
500 move.l %a0, %a1
501 add.l
502 move.l %a1,%a5
503
504 move.l %a0, %a2
505 add.l
506
5077:
508 move.l (%a1),%d1
509 sub.l
510 add.l %a0,%d1
511 move.l %d1,(%a1)+
512 cmp.l %a2, %a1
513 bne 7b
514
515
516 move.l %a0, %a1
517 add.l
518
519
520 move.l %a0,-(%sp)
521 move.l %d0,-(%sp)
522 jsr (%a1)
523
524
525
526 .globl _fault
527_fault:
528 bra _fault
529 .globl _exc_handler
530
531_exc_handler:
532 SAVE_ALL
533 movel %sp,%sp@-
534 bsr exc_handler
535 addql
536 RESTORE_ALL
537
538 .globl _int_handler
539_int_handler:
540 SAVE_ALL
541 movel %sp,%sp@-
542 bsr int_handler
543 addql
544 RESTORE_ALL
545
546
547
548 .globl icache_enable
549icache_enable:
550 move.l
551 move.l (%a1), %d1
552
553 move.l
554 movec %d0, %CACR
555
556 move.l
557 movec %d0, %ACR2
558
559 move.l
560 movec %d0, %CACR
561
562 move.l
563 moveq
564 move.l %d0, (%a1)
565 rts
566
567 .globl icache_disable
568icache_disable:
569 move.l
570 move.l (%a1), %d0
571
572 move.l
573 or.l
574 movec %d0, %CACR
575 clr.l %d0
576 movec %d0, %ACR2
577 movec %d0, %ACR3
578
579 move.l
580 moveq
581 move.l %d0, (%a1)
582 rts
583
584 .globl icache_status
585icache_status:
586 move.l
587 move.l (%a1), %d0
588 rts
589
590 .globl icache_invalid
591icache_invalid:
592 move.l
593 move.l (%a1), %d0
594
595 move.l
596 movec %d0, %CACR
597 rts
598
599 .globl dcache_enable
600dcache_enable:
601 move.l
602 move.l (%a1), %d1
603
604 move.l
605 movec %d0, %CACR
606
607 move.l
608 movec %d0, %CACR
609
610 move.l
611 moveq
612 move.l %d0, (%a1)
613 rts
614
615 .globl dcache_disable
616dcache_disable:
617 move.l
618 move.l (%a1), %d0
619
620 and.l
621 or.l
622 movec %d0, %CACR
623 clr.l %d0
624 movec %d0, %ACR0
625 movec %d0, %ACR1
626
627 move.l
628 moveq
629 move.l %d0, (%a1)
630 rts
631
632 .globl dcache_invalid
633dcache_invalid:
634 move.l
635 move.l (%a1), %d0
636
637 move.l
638 movec %d0, %CACR
639 rts
640
641 .globl dcache_status
642dcache_status:
643 move.l
644 move.l (%a1), %d0
645 rts
646
647
648
649 .globl version_string
650version_string:
651 .ascii U_BOOT_VERSION
652 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
653 .ascii CONFIG_IDENT_STRING, "\0"
654 .align 4
655