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,
30 #ifndef CONFIG_IDENT_STRING
31 #define CONFIG_IDENT_STRING ""
38 move.w #0x2700,%sr; /* disable intrs */ \
39 subl #60,%sp; /* space for 15 regs */ \
40 moveml %d0-%d7/%a0-%a6,%sp@;
43 moveml %sp@,%d0-%d7/%a0-%a6; \
44 addl #60,%sp; /* space for 15 regs */ \
49 * Vector table. This is used for initial platform startup.
50 * These vectors are to catch any un-intended traps.
54 INITSP: .long 0x00000000 /* Initial SP */
55 INITPC: .long _START /* Initial PC */
56 vector02: .long _FAULT /* Access Error */
57 vector03: .long _FAULT /* Address Error */
58 vector04: .long _FAULT /* Illegal Instruction */
59 vector05: .long _FAULT /* Reserved */
60 vector06: .long _FAULT /* Reserved */
61 vector07: .long _FAULT /* Reserved */
62 vector08: .long _FAULT /* Privilege Violation */
63 vector09: .long _FAULT /* Trace */
64 vector0A: .long _FAULT /* Unimplemented A-Line */
65 vector0B: .long _FAULT /* Unimplemented F-Line */
66 vector0C: .long _FAULT /* Debug Interrupt */
67 vector0D: .long _FAULT /* Reserved */
68 vector0E: .long _FAULT /* Format Error */
69 vector0F: .long _FAULT /* Unitialized Int. */
73 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
75 vector18: .long _FAULT /* Spurious Interrupt */
76 vector19: .long _FAULT /* Autovector Level 1 */
77 vector1A: .long _FAULT /* Autovector Level 2 */
78 vector1B: .long _FAULT /* Autovector Level 3 */
79 vector1C: .long _FAULT /* Autovector Level 4 */
80 vector1D: .long _FAULT /* Autovector Level 5 */
81 vector1E: .long _FAULT /* Autovector Level 6 */
82 vector1F: .long _FAULT /* Autovector Level 7 */
86 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
87 .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
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
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
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
130 move.w #0x2700,%sr /* Mask off Interrupt */
132 /* Set vector base register at the beginning of the Flash */
133 move.l #CONFIG_SYS_FLASH_BASE, %d0
136 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
139 /* invalidate and disable cache */
140 move.l #0x01000000, %d0 /* Invalidate cache cmd */
141 movec %d0, %CACR /* Invalidate cache */
146 #ifdef CONFIG_MCF5301x
147 move.l #(0xFC0a0010), %a0
154 /* initialize general use internal ram */
156 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
157 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a2
161 /* set stackpointer to end of internal ram to get some stackspace for the
163 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
166 move.l #__got_start, %a5 /* put relocation table address to a5 */
168 bsr cpu_init_f /* run low-level CPU init code (from flash) */
169 bsr board_init_f /* run low-level board init code (from flash) */
171 /* board_init_f() does not return */
173 /*------------------------------------------------------------------------------*/
176 * void relocate_code (addr_sp, gd, addr_moni)
178 * This "function" does not return, instead it continues in RAM
179 * after relocating the monitor code.
183 * r5 = length in bytes
189 move.l 8(%a6), %sp /* set new stack pointer */
191 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
192 move.l 16(%a6), %a0 /* Save copy of Destination Address */
194 move.l #CONFIG_SYS_MONITOR_BASE, %a1
195 move.l #__init_end, %a2
198 /* copy the code to RAM */
200 move.l (%a1)+, (%a3)+
205 * We are done. Do not return, instead branch to second part of board
206 * initialization, now running from RAM.
209 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
216 * Now clear BSS segment
219 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
221 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
228 * fix got table in RAM
231 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
232 move.l %a1,%a5 /* * fix got pointer register a5 */
235 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
245 /* calculate relative jump to board_init_r in ram */
247 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
249 /* set parameters for board_init_r */
250 move.l %a0,-(%sp) /* dest_addr */
251 move.l %d0,-(%sp) /* gd */
254 /*------------------------------------------------------------------------------*/
276 /*------------------------------------------------------------------------------*/
277 /* cache functions */
280 move.l #0x01000000, %d0 /* Invalidate cache cmd */
281 movec %d0, %CACR /* Invalidate cache */
282 move.l #(CONFIG_SYS_SDRAM_BASE + 0x1c000), %d0
283 movec %d0, %ACR0 /* Enable cache */
285 move.l #0x80000200, %d0 /* Setup cache mask */
286 movec %d0, %CACR /* Enable cache */
289 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
294 .globl icache_disable
296 move.l #0x01000000, %d0 /* Setup cache mask */
297 movec %d0, %CACR /* Disable cache */
298 clr.l %d0 /* Setup cache mask */
302 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
309 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
313 .globl icache_invalid
315 move.l #0x81000200, %d0 /* Setup cache mask */
316 movec %d0, %CACR /* Enable cache */
321 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a1
326 /* No dcache, just a dummy function */
327 .globl dcache_disable
329 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a1
336 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a1
340 /*------------------------------------------------------------------------------*/
342 .globl version_string
344 .ascii U_BOOT_VERSION
345 .ascii " (", __DATE__, " - ", __TIME__, ")"
346 .ascii CONFIG_IDENT_STRING, "\0"