Remove #include <timestamp.h> from files which do not need it
[platform/kernel/u-boot.git] / arch / m68k / cpu / mcf5445x / start.S
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2003   Josef Baumgartner <josef.baumgartner@telex.de>
4  * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
5  *
6  * Copyright 2010-2012 Freescale Semiconductor, Inc.
7  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
8  */
9
10 #include <common.h>
11 #include <asm-offsets.h>
12 #include <config.h>
13 #include "version.h"
14 #include <asm/cache.h>
15
16 #define _START  _start
17 #define _FAULT  _fault
18
19 #define SAVE_ALL                                                \
20         move.w  #0x2700,%sr;            /* disable intrs */     \
21         subl    #60,%sp;                /* space for 15 regs */ \
22         moveml  %d0-%d7/%a0-%a6,%sp@;
23
24 #define RESTORE_ALL                                             \
25         moveml  %sp@,%d0-%d7/%a0-%a6;                           \
26         addl    #60,%sp;                /* space for 15 regs */ \
27         rte;
28
29 #if defined(CONFIG_SERIAL_BOOT)
30 #define ASM_DRAMINIT    (asm_dram_init - CONFIG_SYS_TEXT_BASE + \
31         CONFIG_SYS_INIT_RAM_ADDR)
32 #define ASM_DRAMINIT_N  (asm_dram_init - CONFIG_SYS_TEXT_BASE)
33 #define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + \
34         CONFIG_SYS_INIT_RAM_ADDR)
35 #endif
36
37 .text
38
39 /*
40  * Vector table. This is used for initial platform startup.
41  * These vectors are to catch any un-intended traps.
42  */
43 _vectors:
44 #if defined(CONFIG_SERIAL_BOOT)
45
46 INITSP: .long   0                       /* Initial SP   */
47 #ifdef CONFIG_CF_SBF
48 INITPC: .long   ASM_DRAMINIT            /* Initial PC   */
49 #endif
50 #ifdef CONFIG_SYS_NAND_BOOT
51 INITPC: .long   ASM_DRAMINIT_N          /* Initial PC   */
52 #endif
53
54 #else
55
56 INITSP: .long   0                       /* Initial SP   */
57 INITPC: .long   _START                  /* Initial PC   */
58
59 #endif
60
61 vector02_0F:
62 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
63 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
64
65 /* Reserved */
66 vector10_17:
67 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
68
69 vector18_1F:
70 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
71
72 #if !defined(CONFIG_SERIAL_BOOT)
73
74 /* TRAP #0 - #15 */
75 vector20_2F:
76 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
77 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
78
79 /* Reserved     */
80 vector30_3F:
81 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
82 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
83
84 vector64_127:
85 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
86 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
87 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
88 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
89 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
90 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
91 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
92 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
93
94 vector128_191:
95 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
96 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
97 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
98 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
99 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
100 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
101 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
102 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
103
104 vector192_255:
105 .long   _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
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 #endif
114
115 #if defined(CONFIG_SERIAL_BOOT)
116         /* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */
117 asm_sbf_img_hdr:
118         .long   0x00000000              /* checksum, not yet implemented */
119         .long   0x00040000              /* image length */
120         .long   CONFIG_SYS_TEXT_BASE    /* image to be relocated at */
121
122 asm_dram_init:
123         move.w  #0x2700,%sr             /* Mask off Interrupt */
124
125 #ifdef CONFIG_SYS_NAND_BOOT
126         /* for assembly stack */
127         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
128         movec   %d0, %RAMBAR1
129
130         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
131         clr.l   %sp@-
132 #endif
133
134 #ifdef CONFIG_CF_SBF
135         move.l  #CONFIG_SYS_INIT_RAM_ADDR, %d0
136         movec   %d0, %VBR
137
138         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
139         movec   %d0, %RAMBAR1
140
141         /* initialize general use internal ram */
142         move.l  #0, %d0
143         move.l  #(ICACHE_STATUS), %a1   /* icache */
144         move.l  #(DCACHE_STATUS), %a2   /* dcache */
145         move.l  %d0, (%a1)
146         move.l  %d0, (%a2)
147
148         /* invalidate and disable cache */
149         move.l  #(CONFIG_SYS_ICACHE_INV + CONFIG_SYS_DCACHE_INV), %d0
150         movec   %d0, %CACR              /* Invalidate cache */
151         move.l  #0, %d0
152         movec   %d0, %ACR0
153         movec   %d0, %ACR1
154         movec   %d0, %ACR2
155         movec   %d0, %ACR3
156
157         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
158         clr.l   %sp@-
159
160 #ifdef CONFIG_SYS_CS0_BASE
161         /* Must disable global address */
162         move.l  #0xFC008000, %a1
163         move.l  #(CONFIG_SYS_CS0_BASE), (%a1)
164         move.l  #0xFC008008, %a1
165         move.l  #(CONFIG_SYS_CS0_CTRL), (%a1)
166         move.l  #0xFC008004, %a1
167         move.l  #(CONFIG_SYS_CS0_MASK), (%a1)
168 #endif
169 #endif /* CONFIG_CF_SBF */
170
171 #ifdef CONFIG_MCF5441x
172         /* TC: enable all peripherals,
173         in the future only enable certain peripherals */
174         move.l  #0xFC04002D, %a1
175
176 #if defined(CONFIG_CF_SBF)
177         move.b  #23, (%a1)              /* dspi */
178 #endif
179 #endif  /* CONFIG_MCF5441x */
180
181         /* mandatory board level ddr-sdram init,
182          * for both 5441x and 5445x
183          */
184         bsr     sbf_dram_init
185
186 #ifdef CONFIG_CF_SBF
187         /*
188          * DSPI Initialization
189          * a0 - general, sram - 0x80008000 - 32, see M54455EVB.h
190          * a1 - dspi status
191          * a2 - dtfr
192          * a3 - drfr
193          * a4 - Dst addr
194          */
195         /* Enable pins for DSPI mode - chip-selects are enabled later */
196 asm_dspi_init:
197 #ifdef CONFIG_MCF5441x
198         move.l  #0xEC09404E, %a1
199         move.l  #0xEC09404F, %a2
200         move.b  #0xFF, (%a1)
201         move.b  #0x80, (%a2)
202 #endif
203
204         /* Configure DSPI module */
205         move.l  #0xFC05C000, %a0
206         move.l  #0x80FF0C00, (%a0)      /* Master, clear TX/RX FIFO */
207
208         move.l  #0xFC05C00C, %a0
209 #ifdef CONFIG_MCF5441x
210         move.l  #0x3E000016, (%a0)
211 #endif
212
213         move.l  #0xFC05C034, %a2        /* dtfr */
214         move.l  #0xFC05C03B, %a3        /* drfr */
215
216         move.l  #(ASM_SBF_IMG_HDR + 4), %a1
217         move.l  (%a1)+, %d5
218         move.l  (%a1), %a4
219
220         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_SBFHDR_DATA_OFFSET), %a0
221         move.l  #(CONFIG_SYS_SBFHDR_SIZE), %d4
222
223         move.l  #0xFC05C02C, %a1        /* dspi status */
224
225         /* Issue commands and address */
226         move.l  #0x8002000B, %d2        /* Fast Read Cmd */
227         jsr     asm_dspi_wr_status
228         jsr     asm_dspi_rd_status
229
230         move.l  #0x80020000, %d2        /* Address byte 2 */
231         jsr     asm_dspi_wr_status
232         jsr     asm_dspi_rd_status
233
234         move.l  #0x80020000, %d2        /* Address byte 1 */
235         jsr     asm_dspi_wr_status
236         jsr     asm_dspi_rd_status
237
238         move.l  #0x80020000, %d2        /* Address byte 0 */
239         jsr     asm_dspi_wr_status
240         jsr     asm_dspi_rd_status
241
242         move.l  #0x80020000, %d2        /* Dummy Wr and Rd */
243         jsr     asm_dspi_wr_status
244         jsr     asm_dspi_rd_status
245
246         /* Transfer serial boot header to sram */
247 asm_dspi_rd_loop1:
248         move.l  #0x80020000, %d2
249         jsr     asm_dspi_wr_status
250         jsr     asm_dspi_rd_status
251
252         move.b  %d1, (%a0)              /* read, copy to dst */
253
254         add.l   #1, %a0                 /* inc dst by 1 */
255         sub.l   #1, %d4                 /* dec cnt by 1 */
256         bne     asm_dspi_rd_loop1
257
258         /* Transfer u-boot from serial flash to memory */
259 asm_dspi_rd_loop2:
260         move.l  #0x80020000, %d2
261         jsr     asm_dspi_wr_status
262         jsr     asm_dspi_rd_status
263
264         move.b  %d1, (%a4)              /* read, copy to dst */
265
266         add.l   #1, %a4                 /* inc dst by 1 */
267         sub.l   #1, %d5                 /* dec cnt by 1 */
268         bne     asm_dspi_rd_loop2
269
270         move.l  #0x00020000, %d2        /* Terminate */
271         jsr     asm_dspi_wr_status
272         jsr     asm_dspi_rd_status
273
274         /* jump to memory and execute */
275         move.l  #(CONFIG_SYS_TEXT_BASE + 0x400), %a0
276         jmp     (%a0)
277
278 asm_dspi_wr_status:
279         move.l  (%a1), %d0              /* status */
280         and.l   #0x0000F000, %d0
281         cmp.l   #0x00003000, %d0
282         bgt     asm_dspi_wr_status
283
284         move.l  %d2, (%a2)
285         rts
286
287 asm_dspi_rd_status:
288         move.l  (%a1), %d0              /* status */
289         and.l   #0x000000F0, %d0
290         lsr.l   #4, %d0
291         cmp.l   #0, %d0
292         beq     asm_dspi_rd_status
293
294         move.b  (%a3), %d1
295         rts
296 #endif /* CONFIG_CF_SBF */
297
298 #ifdef CONFIG_SYS_NAND_BOOT
299         /* copy 4 boot pages to dram as soon as possible */
300         /* each page is 996 bytes (1056 total with 60 ECC bytes */
301         move.l  #0x00000000, %a1        /* src */
302         move.l  #CONFIG_SYS_TEXT_BASE, %a2              /* dst */
303         move.l  #0x3E0, %d0             /* sz in long */
304
305 asm_boot_nand_copy:
306         move.l  (%a1)+, (%a2)+
307         subq.l  #1, %d0
308         bne     asm_boot_nand_copy
309
310         /* jump to memory and execute */
311         move.l  #(asm_nand_init), %a0
312         jmp     (%a0)
313
314 asm_nand_init:
315         /* exit nand boot-mode */
316         move.l  #0xFC0FFF30, %a1
317         or.l    #0x00000040, %d1
318         move.l  %d1, (%a1)
319
320         /* initialize general use internal ram */
321         move.l  #0, %d0
322         move.l  #(CACR_STATUS), %a1     /* CACR */
323         move.l  #(ICACHE_STATUS), %a2   /* icache */
324         move.l  #(DCACHE_STATUS), %a3   /* dcache */
325         move.l  %d0, (%a1)
326         move.l  %d0, (%a2)
327         move.l  %d0, (%a3)
328
329         /* invalidate and disable cache */
330         move.l  #0x01004100, %d0        /* Invalidate cache cmd */
331         movec   %d0, %CACR              /* Invalidate cache */
332         move.l  #0, %d0
333         movec   %d0, %ACR0
334         movec   %d0, %ACR1
335         movec   %d0, %ACR2
336         movec   %d0, %ACR3
337
338 #ifdef CONFIG_SYS_CS0_BASE
339         /* Must disable global address */
340         move.l  #0xFC008000, %a1
341         move.l  #(CONFIG_SYS_CS0_BASE), (%a1)
342         move.l  #0xFC008008, %a1
343         move.l  #(CONFIG_SYS_CS0_CTRL), (%a1)
344         move.l  #0xFC008004, %a1
345         move.l  #(CONFIG_SYS_CS0_MASK), (%a1)
346 #endif
347
348         /* NAND port configuration */
349         move.l  #0xEC094048, %a1
350         move.b  #0xFD, (%a1)+
351         move.b  #0x5F, (%a1)+
352         move.b  #0x04, (%a1)+
353
354         /* reset nand */
355         move.l  #0xFC0FFF38, %a1        /* isr */
356         move.l  #0x000e0000, (%a1)
357         move.l  #0xFC0FFF08, %a2
358         move.l  #0x00000000, (%a2)+     /* car */
359         move.l  #0x11000000, (%a2)+     /* rar */
360         move.l  #0x00000000, (%a2)+     /* rpt */
361         move.l  #0x00000000, (%a2)+     /* rai */
362         move.l  #0xFC0FFF2c, %a2        /* cfg */
363         move.l  #0x00000000, (%a2)+     /* secsz */
364         move.l  #0x000e0681, (%a2)+
365         move.l  #0xFC0FFF04, %a2        /* cmd2 */
366         move.l  #0xFF404001, (%a2)
367         move.l  #0x000e0000, (%a1)
368
369         move.l  #0x2000, %d1
370         bsr     asm_delay
371
372         /* setup nand */
373         move.l  #0xFC0FFF00, %a1
374         move.l  #0x30700000, (%a1)+     /* cmd1 */
375         move.l  #0x007EF000, (%a1)+     /* cmd2 */
376
377         move.l  #0xFC0FFF2C, %a1
378         move.l  #0x00000841, (%a1)+     /* secsz */
379         move.l  #0x000e0681, (%a1)+     /* cfg */
380
381         move.l  #100, %d4               /* 100 pages ~200KB */
382         move.l  #4, %d2                 /* start at 4 */
383         move.l  #0xFC0FFF04, %a0        /* cmd2 */
384         move.l  #0xFC0FFF0C, %a1        /* rar */
385         move.l  #(CONFIG_SYS_TEXT_BASE + 0xF80), %a2
386
387 asm_nand_read:
388         move.l  #0x11000000, %d0        /* rar */
389         or.l    %d2, %d0
390         move.l  %d0, (%a1)
391         add.l   #1, %d2
392
393         move.l  (%a0), %d0              /* cmd2 */
394         or.l    #1, %d0
395         move.l  %d0, (%a0)
396
397         move.l  #0x200, %d1
398         bsr     asm_delay
399
400 asm_nand_chk_status:
401         move.l  #0xFC0FFF38, %a4        /* isr */
402         move.l  (%a4), %d0
403         and.l   #0x40000000, %d0
404         tst.l   %d0
405         beq     asm_nand_chk_status
406
407         move.l  #0xFC0FFF38, %a4        /* isr */
408         move.l  (%a4), %d0
409         or.l    #0x000E0000, %d0
410         move.l  %d0, (%a4)
411
412         move.l  #0x200, %d3
413         move.l  #0xFC0FC000, %a3        /* buf 1 */
414 asm_nand_copy:
415         move.l  (%a3)+, (%a2)+
416         subq.l  #1, %d3
417         bgt     asm_nand_copy
418
419         subq.l  #1, %d4
420         bgt     asm_nand_read
421
422         /* jump to memory and execute */
423         move.l  #(CONFIG_SYS_TEXT_BASE + 0x400), %a0
424         jmp     (%a0)
425
426 #endif                  /* CONFIG_SYS_NAND_BOOT */
427
428 .globl asm_delay
429 asm_delay:
430         nop
431         subq.l  #1, %d1
432         bne     asm_delay
433         rts
434 #endif                  /* CONFIG_CF_SBF || CONFIG_NAND_U_BOOT */
435
436 .text
437         . = 0x400
438 .globl _start
439 _start:
440 #if !defined(CONFIG_SERIAL_BOOT)
441         nop
442         nop
443         move.w  #0x2700,%sr             /* Mask off Interrupt */
444
445         /* Set vector base register at the beginning of the Flash */
446         move.l  #CONFIG_SYS_FLASH_BASE, %d0
447         movec   %d0, %VBR
448
449         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
450         movec   %d0, %RAMBAR1
451
452         /* initialize general use internal ram */
453         move.l  #0, %d0
454         move.l  #(ICACHE_STATUS), %a1   /* icache */
455         move.l  #(DCACHE_STATUS), %a2   /* dcache */
456         move.l  %d0, (%a1)
457         move.l  %d0, (%a2)
458
459         /* invalidate and disable cache */
460         move.l  #(CONFIG_SYS_ICACHE_INV + CONFIG_SYS_DCACHE_INV), %d0
461         movec   %d0, %CACR              /* Invalidate cache */
462         move.l  #0, %d0
463         movec   %d0, %ACR0
464         movec   %d0, %ACR1
465         movec   %d0, %ACR2
466         movec   %d0, %ACR3
467 #else
468         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
469         movec   %d0, %RAMBAR1
470 #endif
471
472         /* put relocation table address to a5 */
473         move.l  #__got_start, %a5
474
475         /* setup stack initially on top of internal static ram  */
476         move.l  #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp
477
478         /*
479          * if configured, malloc_f arena will be reserved first,
480          * then (and always) gd struct space will be reserved
481          */
482         move.l  %sp, -(%sp)
483         move.l  #board_init_f_alloc_reserve, %a1
484         jsr     (%a1)
485
486         /* update stack and frame-pointers */
487         move.l  %d0, %sp
488         move.l  %sp, %fp
489
490         /* initialize reserved area */
491         move.l  %d0, -(%sp)
492         move.l  #board_init_f_init_reserve, %a1
493         jsr     (%a1)
494
495         /* run low-level CPU init code (from flash) */
496         move.l  #cpu_init_f, %a1
497         jsr     (%a1)
498
499         /* run low-level board init code (from flash) */
500         clr.l   %sp@-
501         move.l  #board_init_f, %a1
502         jsr     (%a1)
503
504         /* board_init_f() does not return */
505
506 /******************************************************************************/
507
508 /*
509  * void relocate_code(addr_sp, gd, addr_moni)
510  *
511  * This "function" does not return, instead it continues in RAM
512  * after relocating the monitor code.
513  *
514  * r3 = dest
515  * r4 = src
516  * r5 = length in bytes
517  * r6 = cachelinesize
518  */
519 .globl relocate_code
520 relocate_code:
521         link.w  %a6,#0
522         move.l  8(%a6), %sp             /* set new stack pointer */
523
524         move.l  12(%a6), %d0            /* Save copy of Global Data pointer */
525         move.l  16(%a6), %a0            /* Save copy of Destination Address */
526
527         move.l  #CONFIG_SYS_MONITOR_BASE, %a1
528         move.l  #__init_end, %a2
529         move.l  %a0, %a3
530
531         /* copy the code to RAM */
532 1:
533         move.l  (%a1)+, (%a3)+
534         cmp.l   %a1,%a2
535         bgt.s   1b
536
537 /*
538  * We are done. Do not return, instead branch to second part of board
539  * initialization, now running from RAM.
540  */
541         move.l  %a0, %a1
542         add.l   #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
543         jmp     (%a1)
544
545 in_ram:
546
547 clear_bss:
548         /*
549          * Now clear BSS segment
550          */
551         move.l  %a0, %a1
552         add.l   #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
553         move.l  %a0, %d1
554         add.l   #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
555 6:
556         clr.l   (%a1)+
557         cmp.l   %a1,%d1
558         bgt.s   6b
559
560         /*
561          * fix got table in RAM
562          */
563         move.l  %a0, %a1
564         add.l   #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
565         move.l  %a1,%a5                 /* fix got pointer register a5 */
566
567         move.l  %a0, %a2
568         add.l   #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
569
570 7:
571         move.l  (%a1),%d1
572         sub.l   #_start,%d1
573         add.l   %a0,%d1
574         move.l  %d1,(%a1)+
575         cmp.l   %a2, %a1
576         bne     7b
577
578         /* calculate relative jump to board_init_r in ram */
579         move.l  %a0, %a1
580         add.l   #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
581
582         /* set parameters for board_init_r */
583         move.l  %a0,-(%sp)              /* dest_addr */
584         move.l  %d0,-(%sp)              /* gd */
585         jsr     (%a1)
586
587 /******************************************************************************/
588
589 /* exception code */
590 .globl _fault
591 _fault:
592         bra     _fault
593
594 .globl _exc_handler
595 _exc_handler:
596         SAVE_ALL
597         movel   %sp,%sp@-
598         bsr     exc_handler
599         addql   #4,%sp
600         RESTORE_ALL
601
602 .globl _int_handler
603 _int_handler:
604         SAVE_ALL
605         movel   %sp,%sp@-
606         bsr     int_handler
607         addql   #4,%sp
608         RESTORE_ALL
609
610 /******************************************************************************/
611
612 .globl version_string
613 version_string:
614 .ascii U_BOOT_VERSION_STRING, "\0"
615 .align 4