2 * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de>
3 * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
5 * Copyright 2010-2012 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <asm-offsets.h>
30 #include <timestamp.h>
32 #include <asm/cache.h>
34 #ifndef CONFIG_IDENT_STRING
35 #define CONFIG_IDENT_STRING ""
42 move.w #0x2700,%sr; /* disable intrs */ \
43 subl #60,%sp; /* space for 15 regs */ \
44 moveml %d0-%d7/%a0-%a6,%sp@;
47 moveml %sp@,%d0-%d7/%a0-%a6; \
48 addl #60,%sp; /* space for 15 regs */ \
51 #if defined(CONFIG_SERIAL_BOOT)
52 #define ASM_DRAMINIT (asm_dram_init - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
53 #define ASM_DRAMINIT_N (asm_dram_init - TEXT_BASE)
54 #define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
60 * Vector table. This is used for initial platform startup.
61 * These vectors are to catch any un-intended traps.
64 #if defined(CONFIG_SERIAL_BOOT)
66 INITSP: .long 0 /* Initial SP */
68 INITPC: .long ASM_DRAMINIT /* Initial PC */
70 #ifdef CONFIG_SYS_NAND_BOOT
71 INITPC: .long ASM_DRAMINIT_N /* Initial PC */
76 INITSP: .long 0 /* Initial SP */
77 INITPC: .long _START /* Initial PC */
81 vector02: .long _FAULT /* Access Error */
82 vector03: .long _FAULT /* Address Error */
83 vector04: .long _FAULT /* Illegal Instruction */
84 vector05: .long _FAULT /* Reserved */
85 vector06: .long _FAULT /* Reserved */
86 vector07: .long _FAULT /* Reserved */
87 vector08: .long _FAULT /* Privilege Violation */
88 vector09: .long _FAULT /* Trace */
89 vector0A: .long _FAULT /* Unimplemented A-Line */
90 vector0B: .long _FAULT /* Unimplemented F-Line */
91 vector0C: .long _FAULT /* Debug Interrupt */
92 vector0D: .long _FAULT /* Reserved */
93 vector0E: .long _FAULT /* Format Error */
94 vector0F: .long _FAULT /* Unitialized Int. */
98 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
100 vector18: .long _FAULT /* Spurious Interrupt */
101 vector19: .long _FAULT /* Autovector Level 1 */
102 vector1A: .long _FAULT /* Autovector Level 2 */
103 vector1B: .long _FAULT /* Autovector Level 3 */
104 vector1C: .long _FAULT /* Autovector Level 4 */
105 vector1D: .long _FAULT /* Autovector Level 5 */
106 vector1E: .long _FAULT /* Autovector Level 6 */
107 vector1F: .long _FAULT /* Autovector Level 7 */
109 #if !defined(CONFIG_SERIAL_BOOT)
113 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
114 .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
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 .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
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 .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
142 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
143 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
144 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
145 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
146 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
147 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
148 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
149 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
152 #if defined(CONFIG_SERIAL_BOOT)
153 /* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */
155 .long 0x00000000 /* checksum, not yet implemented */
156 .long 0x00040000 /* image length */
157 .long CONFIG_SYS_TEXT_BASE /* image to be relocated at */
160 move.w #0x2700,%sr /* Mask off Interrupt */
162 #ifdef CONFIG_SYS_NAND_BOOT
163 /* for assembly stack */
164 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
167 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
172 move.l #CONFIG_SYS_INIT_RAM_ADDR, %d0
175 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
178 /* initialize general use internal ram */
180 move.l #(ICACHE_STATUS), %a1 /* icache */
181 move.l #(DCACHE_STATUS), %a2 /* dcache */
185 /* invalidate and disable cache */
186 move.l #(CONFIG_SYS_ICACHE_INV + CONFIG_SYS_DCACHE_INV), %d0
187 movec %d0, %CACR /* Invalidate cache */
194 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
197 /* Must disable global address */
198 move.l #0xFC008000, %a1
199 move.l #(CONFIG_SYS_CS0_BASE), (%a1)
200 move.l #0xFC008008, %a1
201 move.l #(CONFIG_SYS_CS0_CTRL), (%a1)
202 move.l #0xFC008004, %a1
203 move.l #(CONFIG_SYS_CS0_MASK), (%a1)
204 #endif /* CONFIG_CF_SBF */
206 #ifdef CONFIG_MCF5441x
207 /* TC: enable all peripherals,
208 in the future only enable certain peripherals */
209 move.l #0xFC04002D, %a1
211 #if defined(CONFIG_CF_SBF)
212 move.b #23, (%a1) /* dspi */
214 move.b #46, (%a1) /* DDR */
217 move.l #0xEC094060, %a1
220 /* use vco instead of cpu*2 clock for ddr clock */
221 move.l #0xEC09001A, %a1
222 move.w #0xE01D, (%a1)
225 move.l #0xFC0B8180, %a1
226 move.l #0x00000000, (%a1)
227 move.l #0x40000000, (%a1)
229 move.l #0xFC0B81AC, %a1
230 move.l #0x01030203, (%a1)
232 move.l #0xFC0B8000, %a1
233 move.l #0x01010101, (%a1)+ /* 0x00 */
234 move.l #0x00000101, (%a1)+ /* 0x04 */
235 move.l #0x01010100, (%a1)+ /* 0x08 */
236 move.l #0x01010000, (%a1)+ /* 0x0C */
237 move.l #0x00010101, (%a1)+ /* 0x10 */
238 move.l #0xFC0B8018, %a1
239 move.l #0x00010100, (%a1)+ /* 0x18 */
240 move.l #0x00000001, (%a1)+ /* 0x1C */
241 move.l #0x01000001, (%a1)+ /* 0x20 */
242 move.l #0x00000100, (%a1)+ /* 0x24 */
243 move.l #0x00010001, (%a1)+ /* 0x28 */
244 move.l #0x00000200, (%a1)+ /* 0x2C */
245 move.l #0x01000002, (%a1)+ /* 0x30 */
246 move.l #0x00000000, (%a1)+ /* 0x34 */
247 move.l #0x00000100, (%a1)+ /* 0x38 */
248 move.l #0x02000100, (%a1)+ /* 0x3C */
249 move.l #0x02000407, (%a1)+ /* 0x40 */
250 move.l #0x02030007, (%a1)+ /* 0x44 */
251 move.l #0x02000100, (%a1)+ /* 0x48 */
252 move.l #0x0A030203, (%a1)+ /* 0x4C */
253 move.l #0x00020708, (%a1)+ /* 0x50 */
254 move.l #0x00050008, (%a1)+ /* 0x54 */
255 move.l #0x04030002, (%a1)+ /* 0x58 */
256 move.l #0x00000004, (%a1)+ /* 0x5C */
257 move.l #0x020A0000, (%a1)+ /* 0x60 */
258 move.l #0x0C00000E, (%a1)+ /* 0x64 */
259 move.l #0x00002004, (%a1)+ /* 0x68 */
260 move.l #0x00000000, (%a1)+ /* 0x6C */
261 move.l #0x00100010, (%a1)+ /* 0x70 */
262 move.l #0x00100010, (%a1)+ /* 0x74 */
263 move.l #0x00000000, (%a1)+ /* 0x78 */
264 move.l #0x07990000, (%a1)+ /* 0x7C */
265 move.l #0xFC0B80A0, %a1
266 move.l #0x00000000, (%a1)+ /* 0xA0 */
267 move.l #0x00C80064, (%a1)+ /* 0xA4 */
268 move.l #0x44520002, (%a1)+ /* 0xA8 */
269 move.l #0x00C80023, (%a1)+ /* 0xAC */
270 move.l #0xFC0B80B4, %a1
271 move.l #0x0000C350, (%a1) /* 0xB4 */
272 move.l #0xFC0B80E0, %a1
273 move.l #0x04000000, (%a1)+ /* 0xE0 */
274 move.l #0x03000304, (%a1)+ /* 0xE4 */
275 move.l #0x40040000, (%a1)+ /* 0xE8 */
276 move.l #0xC0004004, (%a1)+ /* 0xEC */
277 move.l #0x0642C000, (%a1)+ /* 0xF0 */
278 move.l #0x00000642, (%a1)+ /* 0xF4 */
279 move.l #0xFC0B8024, %a1
281 move.l #0x01000100, (%a1) /* 0x24 */
285 #endif /* CONFIG_MCF5441x */
287 #ifdef CONFIG_MCF5445x
288 /* Dram Initialization a1, a2, and d0 */
290 move.l #0xFC0A4074, %a1
291 move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1)
294 /* SDRAM Chip 0 and 1 */
295 move.l #0xFC0B8110, %a1
296 move.l #0xFC0B8114, %a2
298 /* calculate the size */
300 move.l #(CONFIG_SYS_SDRAM_SIZE), %d2
301 #ifdef CONFIG_SYS_SDRAM_BASE1
310 #ifdef CONFIG_SYS_NAND_BOOT
311 beq asm_nand_chk_status
313 /* SDRAM Chip 0 and 1 */
314 move.l #(CONFIG_SYS_SDRAM_BASE), (%a1)
316 #ifdef CONFIG_SYS_SDRAM_BASE1
317 move.l #(CONFIG_SYS_SDRAM_BASE1), (%a2)
322 /* dram cfg1 and cfg2 */
323 move.l #0xFC0B8008, %a1
324 move.l #(CONFIG_SYS_SDRAM_CFG1), (%a1)
326 move.l #0xFC0B800C, %a2
327 move.l #(CONFIG_SYS_SDRAM_CFG2), (%a2)
330 move.l #0xFC0B8000, %a1 /* Mode */
331 move.l #0xFC0B8004, %a2 /* Ctrl */
334 move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2)
337 #ifdef CONFIG_M54455EVB
339 move.l #(CONFIG_SYS_SDRAM_EMOD + 0x408), (%a1)
341 move.l #(CONFIG_SYS_SDRAM_MODE + 0x300), (%a1)
349 move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2)
352 /* Perform two refresh cycles */
353 move.l #(CONFIG_SYS_SDRAM_CTRL + 4), %d0
359 #ifdef CONFIG_M54455EVB
360 move.l #(CONFIG_SYS_SDRAM_MODE + 0x200), (%a1)
362 #elif defined(CONFIG_M54451EVB)
364 move.l #(CONFIG_SYS_SDRAM_MODE), (%a1)
366 move.l #(CONFIG_SYS_SDRAM_EMOD), (%a1)
372 move.l #(CONFIG_SYS_SDRAM_CTRL), %d1
373 and.l #0x7FFFFFFF, %d1
374 #ifdef CONFIG_M54455EVB
375 or.l #0x10000C00, %d1
376 #elif defined(CONFIG_M54451EVB)
377 or.l #0x10000C00, %d1
384 #endif /* CONFIG_MCF5445x */
388 * DSPI Initialization
389 * a0 - general, sram - 0x80008000 - 32, see M54455EVB.h
395 /* Enable pins for DSPI mode - chip-selects are enabled later */
397 #ifdef CONFIG_MCF5441x
398 move.l #0xEC09404E, %a1
399 move.l #0xEC09404F, %a2
404 #ifdef CONFIG_MCF5445x
405 move.l #0xFC0A4063, %a0
408 /* Configure DSPI module */
409 move.l #0xFC05C000, %a0
410 move.l #0x80FF0C00, (%a0) /* Master, clear TX/RX FIFO */
412 move.l #0xFC05C00C, %a0
413 #ifdef CONFIG_MCF5441x
414 move.l #0x3E000016, (%a0)
416 #ifdef CONFIG_MCF5445x
417 move.l #0x3E000011, (%a0)
420 move.l #0xFC05C034, %a2 /* dtfr */
421 move.l #0xFC05C03B, %a3 /* drfr */
423 move.l #(ASM_SBF_IMG_HDR + 4), %a1
427 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_SBFHDR_DATA_OFFSET), %a0
428 move.l #(CONFIG_SYS_SBFHDR_SIZE), %d4
430 move.l #0xFC05C02C, %a1 /* dspi status */
432 /* Issue commands and address */
433 move.l #0x8002000B, %d2 /* Fast Read Cmd */
434 jsr asm_dspi_wr_status
435 jsr asm_dspi_rd_status
437 move.l #0x80020000, %d2 /* Address byte 2 */
438 jsr asm_dspi_wr_status
439 jsr asm_dspi_rd_status
441 move.l #0x80020000, %d2 /* Address byte 1 */
442 jsr asm_dspi_wr_status
443 jsr asm_dspi_rd_status
445 move.l #0x80020000, %d2 /* Address byte 0 */
446 jsr asm_dspi_wr_status
447 jsr asm_dspi_rd_status
449 move.l #0x80020000, %d2 /* Dummy Wr and Rd */
450 jsr asm_dspi_wr_status
451 jsr asm_dspi_rd_status
453 /* Transfer serial boot header to sram */
455 move.l #0x80020000, %d2
456 jsr asm_dspi_wr_status
457 jsr asm_dspi_rd_status
459 move.b %d1, (%a0) /* read, copy to dst */
461 add.l #1, %a0 /* inc dst by 1 */
462 sub.l #1, %d4 /* dec cnt by 1 */
463 bne asm_dspi_rd_loop1
465 /* Transfer u-boot from serial flash to memory */
467 move.l #0x80020000, %d2
468 jsr asm_dspi_wr_status
469 jsr asm_dspi_rd_status
471 move.b %d1, (%a4) /* read, copy to dst */
473 add.l #1, %a4 /* inc dst by 1 */
474 sub.l #1, %d5 /* dec cnt by 1 */
475 bne asm_dspi_rd_loop2
477 move.l #0x00020000, %d2 /* Terminate */
478 jsr asm_dspi_wr_status
479 jsr asm_dspi_rd_status
481 /* jump to memory and execute */
482 move.l #(CONFIG_SYS_TEXT_BASE + 0x400), %a0
486 move.l (%a1), %d0 /* status */
487 and.l #0x0000F000, %d0
488 cmp.l #0x00003000, %d0
489 bgt asm_dspi_wr_status
495 move.l (%a1), %d0 /* status */
496 and.l #0x000000F0, %d0
499 beq asm_dspi_rd_status
503 #endif /* CONFIG_CF_SBF */
505 #ifdef CONFIG_SYS_NAND_BOOT
506 /* copy 4 boot pages to dram as soon as possible */
507 /* each page is 996 bytes (1056 total with 60 ECC bytes */
508 move.l #0x00000000, %a1 /* src */
509 move.l #TEXT_BASE, %a2 /* dst */
510 move.l #0x3E0, %d0 /* sz in long */
513 move.l (%a1)+, (%a2)+
515 bne asm_boot_nand_copy
517 /* jump to memory and execute */
518 move.l #(asm_nand_init), %a0
522 /* exit nand boot-mode */
523 move.l #0xFC0FFF30, %a1
524 or.l #0x00000040, %d1
527 /* initialize general use internal ram */
529 move.l #(CACR_STATUS), %a1 /* CACR */
530 move.l #(ICACHE_STATUS), %a2 /* icache */
531 move.l #(DCACHE_STATUS), %a3 /* dcache */
536 /* invalidate and disable cache */
537 move.l #0x01004100, %d0 /* Invalidate cache cmd */
538 movec %d0, %CACR /* Invalidate cache */
545 /* Must disable global address */
546 move.l #0xFC008000, %a1
547 move.l #(CONFIG_SYS_CS0_BASE), (%a1)
548 move.l #0xFC008008, %a1
549 move.l #(CONFIG_SYS_CS0_CTRL), (%a1)
550 move.l #0xFC008004, %a1
551 move.l #(CONFIG_SYS_CS0_MASK), (%a1)
553 /* NAND port configuration */
554 move.l #0xEC094048, %a1
560 move.l #0xFC0FFF38, %a1 /* isr */
561 move.l #0x000e0000, (%a1)
562 move.l #0xFC0FFF08, %a2
563 move.l #0x00000000, (%a2)+ /* car */
564 move.l #0x11000000, (%a2)+ /* rar */
565 move.l #0x00000000, (%a2)+ /* rpt */
566 move.l #0x00000000, (%a2)+ /* rai */
567 move.l #0xFC0FFF2c, %a2 /* cfg */
568 move.l #0x00000000, (%a2)+ /* secsz */
569 move.l #0x000e0681, (%a2)+
570 move.l #0xFC0FFF04, %a2 /* cmd2 */
571 move.l #0xFF404001, (%a2)
572 move.l #0x000e0000, (%a1)
578 move.l #0xFC0FFF00, %a1
579 move.l #0x30700000, (%a1)+ /* cmd1 */
580 move.l #0x007EF000, (%a1)+ /* cmd2 */
582 move.l #0xFC0FFF2C, %a1
583 move.l #0x00000841, (%a1)+ /* secsz */
584 move.l #0x000e0681, (%a1)+ /* cfg */
586 move.l #100, %d4 /* 100 pages ~200KB */
587 move.l #4, %d2 /* start at 4 */
588 move.l #0xFC0FFF04, %a0 /* cmd2 */
589 move.l #0xFC0FFF0C, %a1 /* rar */
590 move.l #(TEXT_BASE + 0xF80), %a2 /* dst */
593 move.l #0x11000000, %d0 /* rar */
598 move.l (%a0), %d0 /* cmd2 */
606 move.l #0xFC0FFF38, %a4 /* isr */
608 and.l #0x40000000, %d0
610 beq asm_nand_chk_status
612 move.l #0xFC0FFF38, %a4 /* isr */
614 or.l #0x000E0000, %d0
618 move.l #0xFC0FC000, %a3 /* buf 1 */
620 move.l (%a3)+, (%a2)+
627 /* jump to memory and execute */
628 move.l #(TEXT_BASE + 0x400), %a0
631 #endif /* CONFIG_SYS_NAND_BOOT */
638 #endif /* CONFIG_CF_SBF || CONFIG_NAND_U_BOOT */
644 #if !defined(CONFIG_SERIAL_BOOT)
647 move.w #0x2700,%sr /* Mask off Interrupt */
649 /* Set vector base register at the beginning of the Flash */
650 move.l #CONFIG_SYS_FLASH_BASE, %d0
653 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
656 /* initialize general use internal ram */
658 move.l #(ICACHE_STATUS), %a1 /* icache */
659 move.l #(DCACHE_STATUS), %a2 /* dcache */
663 /* invalidate and disable cache */
664 move.l #(CONFIG_SYS_ICACHE_INV + CONFIG_SYS_DCACHE_INV), %d0
665 movec %d0, %CACR /* Invalidate cache */
672 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
676 /* set stackpointer to end of internal ram to get some stackspace for
678 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
681 move.l #__got_start, %a5 /* put relocation table address to a5 */
683 bsr cpu_init_f /* run low-level CPU init code (from flash) */
684 bsr board_init_f /* run low-level board init code (from flash) */
686 /* board_init_f() does not return */
688 /*------------------------------------------------------------------------------*/
691 * void relocate_code (addr_sp, gd, addr_moni)
693 * This "function" does not return, instead it continues in RAM
694 * after relocating the monitor code.
698 * r5 = length in bytes
704 move.l 8(%a6), %sp /* set new stack pointer */
706 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
707 move.l 16(%a6), %a0 /* Save copy of Destination Address */
709 move.l #CONFIG_SYS_MONITOR_BASE, %a1
710 move.l #__init_end, %a2
713 /* copy the code to RAM */
715 move.l (%a1)+, (%a3)+
720 * We are done. Do not return, instead branch to second part of board
721 * initialization, now running from RAM.
724 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
731 * Now clear BSS segment
734 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
736 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
743 * fix got table in RAM
746 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
747 move.l %a1,%a5 /* * fix got pointer register a5 */
750 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
760 /* calculate relative jump to board_init_r in ram */
762 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
764 /* set parameters for board_init_r */
765 move.l %a0,-(%sp) /* dest_addr */
766 move.l %d0,-(%sp) /* gd */
769 /*------------------------------------------------------------------------------*/
791 /*------------------------------------------------------------------------------*/
793 .globl version_string
795 .ascii U_BOOT_VERSION_STRING, "\0"