1
2
3
4
5
6
7
8
9
10
11#include <common.h>
12#include <asm-offsets.h>
13#include <config.h>
14#include <timestamp.h>
15#include "version.h"
16#include <asm/cache.h>
17
18#ifndef CONFIG_IDENT_STRING
19#define CONFIG_IDENT_STRING ""
20#endif
21
22#define _START _start
23#define _FAULT _fault
24
25#define SAVE_ALL \
26 move.w
27 subl
28 moveml %d0-%d7/%a0-%a6,%sp@;
29
30#define RESTORE_ALL \
31 moveml %sp@,%d0-%d7/%a0-%a6; \
32 addl
33 rte;
34
35
36#define ASM_DRAMINIT (asm_dram_init - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
37#define ASM_DRAMINIT_N (asm_dram_init - CONFIG_SYS_TEXT_BASE)
38#define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
39#endif
40
41.text
42
43
44
45
46
47_vectors:
48
49
50INITSP: .long 0
51#ifdef CONFIG_CF_SBF
52INITPC: .long ASM_DRAMINIT
53#endif
54#ifdef CONFIG_SYS_NAND_BOOT
55INITPC: .long ASM_DRAMINIT_N
56#endif
57
58#else
59
60INITSP: .long 0
61INITPC: .long _START
62
63#endif
64
65vector02: .long _FAULT
66vector03: .long _FAULT
67vector04: .long _FAULT
68vector05: .long _FAULT
69vector06: .long _FAULT
70vector07: .long _FAULT
71vector08: .long _FAULT
72vector09: .long _FAULT
73vector0A: .long _FAULT
74vector0B: .long _FAULT
75vector0C: .long _FAULT
76vector0D: .long _FAULT
77vector0E: .long _FAULT
78vector0F: .long _FAULT
79
80
81vector10_17:
82.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
83
84vector18: .long _FAULT
85vector19: .long _FAULT
86vector1A: .long _FAULT
87vector1B: .long _FAULT
88vector1C: .long _FAULT
89vector1D: .long _FAULT
90vector1E: .long _FAULT
91vector1F: .long _FAULT
92
93
94
95
96vector20_2F:
97.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
98.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
99
100
101vector30_3F:
102.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
103.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
104
105vector64_127:
106.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
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
115vector128_191:
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.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
124
125vector192_255:
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.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
134#endif
135
136
137
138asm_sbf_img_hdr:
139 .long 0x00000000
140 .long 0x00040000
141 .long CONFIG_SYS_TEXT_BASE
142
143asm_dram_init:
144 move.w
145
146#ifdef CONFIG_SYS_NAND_BOOT
147
148 move.l
149 movec %d0, %RAMBAR1
150
151 move.l
152 clr.l %sp@-
153#endif
154
155#ifdef CONFIG_CF_SBF
156 move.l
157 movec %d0, %VBR
158
159 move.l
160 movec %d0, %RAMBAR1
161
162
163 move.l
164 move.l
165 move.l
166 move.l %d0, (%a1)
167 move.l %d0, (%a2)
168
169
170 move.l
171 movec %d0, %CACR
172 move.l
173 movec %d0, %ACR0
174 movec %d0, %ACR1
175 movec %d0, %ACR2
176 movec %d0, %ACR3
177
178 move.l
179 clr.l %sp@-
180
181
182 move.l
183 move.l
184 move.l
185 move.l
186 move.l
187 move.l
188#endif
189
190#ifdef CONFIG_MCF5441x
191
192
193 move.l
194
195
196 move.b
197#endif
198 move.b
199
200
201 move.l
202 move.b
203
204
205 move.l
206 move.w
207
208
209 move.l
210 move.l
211 move.l
212
213 move.l
214 move.l
215
216 move.l
217 move.l
218 move.l
219 move.l
220 move.l
221 move.l
222 move.l
223 move.l
224 move.l
225 move.l
226 move.l
227 move.l
228 move.l
229 move.l
230 move.l
231 move.l
232 move.l
233 move.l
234 move.l
235 move.l
236 move.l
237 move.l
238 move.l
239 move.l
240 move.l
241 move.l
242 move.l
243 move.l
244 move.l
245 move.l
246 move.l
247 move.l
248 move.l
249 move.l
250 move.l
251 move.l
252 move.l
253 move.l
254 move.l
255 move.l
256 move.l
257 move.l
258 move.l
259 move.l
260 move.l
261 move.l
262 move.l
263 move.l
264 tpf
265 move.l
266
267 move.l
268 jsr asm_delay
269#endif
270
271#ifdef CONFIG_MCF5445x
272
273
274 move.l
275 move.b
276 nop
277
278
279 move.l
280 move.l
281
282
283 move.l
284 move.l
285#ifdef CONFIG_SYS_SDRAM_BASE1
286 lsr.l
287#endif
288
289dramsz_loop:
290 lsr.l
291 add.l
292 cmp.l
293 bne dramsz_loop
294#ifdef CONFIG_SYS_NAND_BOOT
295 beq asm_nand_chk_status
296#endif
297
298 move.l
299 or.l %d1, (%a1)
300#ifdef CONFIG_SYS_SDRAM_BASE1
301 move.l
302 or.l %d1, (%a2)
303#endif
304 nop
305
306
307 move.l
308 move.l
309 nop
310 move.l
311 move.l
312 nop
313
314 move.l
315 move.l
316
317
318 move.l
319 nop
320
321#ifdef CONFIG_M54455EVB
322
323 move.l
324 nop
325 move.l
326 nop
327#endif
328
329 move.l
330 jsr asm_delay
331
332
333 move.l
334 nop
335
336
337 move.l
338 nop
339 move.l %d0, (%a2)
340 move.l %d0, (%a2)
341 nop
342
343#ifdef CONFIG_M54455EVB
344 move.l
345 nop
346
347
348 move.l
349 nop
350 move.l
351#endif
352
353 move.l
354 jsr asm_delay
355
356 move.l
357 and.l
358#ifdef CONFIG_M54455EVB
359 or.l
360
361 or.l
362#endif
363 move.l %d1, (%a2)
364 nop
365
366 move.l
367 jsr asm_delay
368#endif
369
370#ifdef CONFIG_CF_SBF
371
372
373
374
375
376
377
378
379
380asm_dspi_init:
381#ifdef CONFIG_MCF5441x
382 move.l
383 move.l
384 move.b
385 move.b
386#endif
387
388#ifdef CONFIG_MCF5445x
389 move.l
390 move.b
391#endif
392
393 move.l
394 move.l
395
396 move.l
397#ifdef CONFIG_MCF5441x
398 move.l
399#endif
400#ifdef CONFIG_MCF5445x
401 move.l
402#endif
403
404 move.l
405 move.l
406
407 move.l
408 move.l (%a1)+, %d5
409 move.l (%a1), %a4
410
411 move.l
412 move.l
413
414 move.l
415
416
417 move.l
418 jsr asm_dspi_wr_status
419 jsr asm_dspi_rd_status
420
421 move.l
422 jsr asm_dspi_wr_status
423 jsr asm_dspi_rd_status
424
425 move.l
426 jsr asm_dspi_wr_status
427 jsr asm_dspi_rd_status
428
429 move.l
430 jsr asm_dspi_wr_status
431 jsr asm_dspi_rd_status
432
433 move.l
434 jsr asm_dspi_wr_status
435 jsr asm_dspi_rd_status
436
437
438asm_dspi_rd_loop1:
439 move.l
440 jsr asm_dspi_wr_status
441 jsr asm_dspi_rd_status
442
443 move.b %d1, (%a0)
444
445 add.l
446 sub.l
447 bne asm_dspi_rd_loop1
448
449
450asm_dspi_rd_loop2:
451 move.l
452 jsr asm_dspi_wr_status
453 jsr asm_dspi_rd_status
454
455 move.b %d1, (%a4)
456
457 add.l
458 sub.l
459 bne asm_dspi_rd_loop2
460
461 move.l
462 jsr asm_dspi_wr_status
463 jsr asm_dspi_rd_status
464
465
466 move.l
467 jmp (%a0)
468
469asm_dspi_wr_status:
470 move.l (%a1), %d0
471 and.l
472 cmp.l
473 bgt asm_dspi_wr_status
474
475 move.l %d2, (%a2)
476 rts
477
478asm_dspi_rd_status:
479 move.l (%a1), %d0
480 and.l
481 lsr.l
482 cmp.l
483 beq asm_dspi_rd_status
484
485 move.b (%a3), %d1
486 rts
487#endif
488
489#ifdef CONFIG_SYS_NAND_BOOT
490
491
492 move.l
493 move.l
494 move.l
495
496asm_boot_nand_copy:
497 move.l (%a1)+, (%a2)+
498 subq.l
499 bne asm_boot_nand_copy
500
501
502 move.l
503 jmp (%a0)
504
505asm_nand_init:
506
507 move.l
508 or.l
509 move.l %d1, (%a1)
510
511
512 move.l
513 move.l
514 move.l
515 move.l
516 move.l %d0, (%a1)
517 move.l %d0, (%a2)
518 move.l %d0, (%a3)
519
520
521 move.l
522 movec %d0, %CACR
523 move.l
524 movec %d0, %ACR0
525 movec %d0, %ACR1
526 movec %d0, %ACR2
527 movec %d0, %ACR3
528
529
530 move.l
531 move.l
532 move.l
533 move.l
534 move.l
535 move.l
536
537
538 move.l
539 move.b
540 move.b
541 move.b
542
543
544 move.l
545 move.l
546 move.l
547 move.l
548 move.l
549 move.l
550 move.l
551 move.l
552 move.l
553 move.l
554 move.l
555 move.l
556 move.l
557
558 move.l
559 jsr asm_delay
560
561
562 move.l
563 move.l
564 move.l
565
566 move.l
567 move.l
568 move.l
569
570 move.l
571 move.l
572 move.l
573 move.l
574 move.l
575
576asm_nand_read:
577 move.l
578 or.l %d2, %d0
579 move.l %d0, (%a1)
580 add.l
581
582 move.l (%a0), %d0
583 or.l
584 move.l %d0, (%a0)
585
586 move.l
587 jsr asm_delay
588
589asm_nand_chk_status:
590 move.l
591 move.l (%a4), %d0
592 and.l
593 tst.l %d0
594 beq asm_nand_chk_status
595
596 move.l
597 move.l (%a4), %d0
598 or.l
599 move.l %d0, (%a4)
600
601 move.l
602 move.l
603asm_nand_copy:
604 move.l (%a3)+, (%a2)+
605 subq.l
606 bgt asm_nand_copy
607
608 subq.l
609 bgt asm_nand_read
610
611
612 move.l
613 jmp (%a0)
614
615#endif
616
617asm_delay:
618 nop
619 subq.l
620 bne asm_delay
621 rts
622#endif
623
624 .text
625 . = 0x400
626 .globl _start
627_start:
628
629 nop
630 nop
631 move.w
632
633
634 move.l
635 movec %d0, %VBR
636
637 move.l
638 movec %d0, %RAMBAR1
639
640
641 move.l
642 move.l
643 move.l
644 move.l %d0, (%a1)
645 move.l %d0, (%a2)
646
647
648 move.l
649 movec %d0, %CACR
650 move.l
651 movec %d0, %ACR0
652 movec %d0, %ACR1
653 movec %d0, %ACR2
654 movec %d0, %ACR3
655#else
656 move.l
657 movec %d0, %RAMBAR1
658#endif
659
660
661
662 move.l
663 clr.l %sp@-
664
665 move.l
666
667 bsr cpu_init_f
668 bsr board_init_f
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685 .globl relocate_code
686relocate_code:
687 link.w %a6,
688 move.l 8(%a6), %sp
689
690 move.l 12(%a6), %d0
691 move.l 16(%a6), %a0
692
693 move.l
694 move.l
695 move.l %a0, %a3
696
697
6981:
699 move.l (%a1)+, (%a3)+
700 cmp.l %a1,%a2
701 bgt.s 1b
702
703
704
705
706
707 move.l %a0, %a1
708 add.l
709 jmp (%a1)
710
711in_ram:
712
713clear_bss:
714
715
716
717 move.l %a0, %a1
718 add.l
719 move.l %a0, %d1
720 add.l
7216:
722 clr.l (%a1)+
723 cmp.l %a1,%d1
724 bgt.s 6b
725
726
727
728
729 move.l %a0, %a1
730 add.l
731 move.l %a1,%a5
732
733 move.l %a0, %a2
734 add.l
735
7367:
737 move.l (%a1),%d1
738 sub.l
739 add.l %a0,%d1
740 move.l %d1,(%a1)+
741 cmp.l %a2, %a1
742 bne 7b
743
744
745 move.l %a0, %a1
746 add.l
747
748
749 move.l %a0,-(%sp)
750 move.l %d0,-(%sp)
751 jsr (%a1)
752
753
754
755 .globl _fault
756_fault:
757 bra _fault
758 .globl _exc_handler
759
760_exc_handler:
761 SAVE_ALL
762 movel %sp,%sp@-
763 bsr exc_handler
764 addql
765 RESTORE_ALL
766
767 .globl _int_handler
768_int_handler:
769 SAVE_ALL
770 movel %sp,%sp@-
771 bsr int_handler
772 addql
773 RESTORE_ALL
774
775
776
777 .globl version_string
778version_string:
779 .ascii U_BOOT_VERSION_STRING, "\0"
780 .align 4
781