2 * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de>
3 * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
5 * (C) Copyright 2004-2008 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,
27 #include <asm-offsets.h>
29 #include <timestamp.h>
31 #include <asm/cache.h>
33 #ifndef CONFIG_IDENT_STRING
34 #define CONFIG_IDENT_STRING ""
41 move.w #0x2700,%sr; /* disable intrs */ \
42 subl #60,%sp; /* space for 15 regs */ \
43 moveml %d0-%d7/%a0-%a6,%sp@;
46 moveml %sp@,%d0-%d7/%a0-%a6; \
47 addl #60,%sp; /* space for 15 regs */ \
50 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
53 * Vector table. This is used for initial platform startup.
54 * These vectors are to catch any un-intended traps.
58 INITSP: .long 0x00000000 /* Initial SP */
59 INITPC: .long _START /* Initial PC */
60 vector02: .long _FAULT /* Access Error */
61 vector03: .long _FAULT /* Address Error */
62 vector04: .long _FAULT /* Illegal Instruction */
63 vector05: .long _FAULT /* Reserved */
64 vector06: .long _FAULT /* Reserved */
65 vector07: .long _FAULT /* Reserved */
66 vector08: .long _FAULT /* Privilege Violation */
67 vector09: .long _FAULT /* Trace */
68 vector0A: .long _FAULT /* Unimplemented A-Line */
69 vector0B: .long _FAULT /* Unimplemented F-Line */
70 vector0C: .long _FAULT /* Debug Interrupt */
71 vector0D: .long _FAULT /* Reserved */
72 vector0E: .long _FAULT /* Format Error */
73 vector0F: .long _FAULT /* Unitialized Int. */
77 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
79 vector18: .long _FAULT /* Spurious Interrupt */
80 vector19: .long _FAULT /* Autovector Level 1 */
81 vector1A: .long _FAULT /* Autovector Level 2 */
82 vector1B: .long _FAULT /* Autovector Level 3 */
83 vector1C: .long _FAULT /* Autovector Level 4 */
84 vector1D: .long _FAULT /* Autovector Level 5 */
85 vector1E: .long _FAULT /* Autovector Level 6 */
86 vector1F: .long _FAULT /* Autovector Level 7 */
90 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
91 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
95 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
96 .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 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
104 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
105 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
106 .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 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
116 .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 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
126 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
127 #endif /* !defined(CONFIG_MONITOR_IS_IN_RAM) */
135 move.w #0x2700,%sr /* Mask off Interrupt */
137 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
138 /* Set vector base register at the beginning of the Flash */
139 move.l #CONFIG_SYS_FLASH_BASE, %d0
143 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
146 /* invalidate and disable cache */
147 move.l #CF_CACR_CINVA, %d0 /* Invalidate cache cmd */
148 movec %d0, %CACR /* Invalidate cache */
153 #ifdef CONFIG_MCF5301x
154 move.l #(0xFC0a0010), %a0
161 /* initialize general use internal ram */
163 move.l #(ICACHE_STATUS), %a1 /* icache */
164 move.l #(DCACHE_STATUS), %a2 /* icache */
168 /* set stackpointer to end of internal ram to get some stackspace for the
170 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
173 move.l #__got_start, %a5 /* put relocation table address to a5 */
175 bsr cpu_init_f /* run low-level CPU init code (from flash) */
176 bsr board_init_f /* run low-level board init code (from flash) */
178 /* board_init_f() does not return */
180 /*------------------------------------------------------------------------------*/
183 * void relocate_code (addr_sp, gd, addr_moni)
185 * This "function" does not return, instead it continues in RAM
186 * after relocating the monitor code.
190 * r5 = length in bytes
196 move.l 8(%a6), %sp /* set new stack pointer */
198 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
199 move.l 16(%a6), %a0 /* Save copy of Destination Address */
201 move.l #CONFIG_SYS_MONITOR_BASE, %a1
202 move.l #__init_end, %a2
205 /* copy the code to RAM */
207 move.l (%a1)+, (%a3)+
212 * We are done. Do not return, instead branch to second part of board
213 * initialization, now running from RAM.
216 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
223 * Now clear BSS segment
226 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
228 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
235 * fix got table in RAM
238 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
239 move.l %a1,%a5 /* * fix got pointer register a5 */
242 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
252 /* calculate relative jump to board_init_r in ram */
254 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
256 /* set parameters for board_init_r */
257 move.l %a0,-(%sp) /* dest_addr */
258 move.l %d0,-(%sp) /* gd */
261 /*------------------------------------------------------------------------------*/
283 /*------------------------------------------------------------------------------*/
284 .globl version_string
286 .ascii U_BOOT_VERSION
287 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
288 .ascii CONFIG_IDENT_STRING, "\0"