2 * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de>
3 * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <timestamp.h>
28 #ifndef CONFIG_IDENT_STRING
29 #define CONFIG_IDENT_STRING ""
36 move.w #0x2700,%sr; /* disable intrs */ \
37 subl #60,%sp; /* space for 15 regs */ \
38 moveml %d0-%d7/%a0-%a6,%sp@;
41 moveml %sp@,%d0-%d7/%a0-%a6; \
42 addl #60,%sp; /* space for 15 regs */ \
47 * Vector table. This is used for initial platform startup.
48 * These vectors are to catch any un-intended traps.
52 INITSP: .long 0x00000000 /* Initial SP */
53 INITPC: .long _START /* Initial PC */
54 vector02: .long _FAULT /* Access Error */
55 vector03: .long _FAULT /* Address Error */
56 vector04: .long _FAULT /* Illegal Instruction */
57 vector05: .long _FAULT /* Reserved */
58 vector06: .long _FAULT /* Reserved */
59 vector07: .long _FAULT /* Reserved */
60 vector08: .long _FAULT /* Privilege Violation */
61 vector09: .long _FAULT /* Trace */
62 vector0A: .long _FAULT /* Unimplemented A-Line */
63 vector0B: .long _FAULT /* Unimplemented F-Line */
64 vector0C: .long _FAULT /* Debug Interrupt */
65 vector0D: .long _FAULT /* Reserved */
66 vector0E: .long _FAULT /* Format Error */
67 vector0F: .long _FAULT /* Unitialized Int. */
71 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
73 vector18: .long _FAULT /* Spurious Interrupt */
74 vector19: .long _FAULT /* Autovector Level 1 */
75 vector1A: .long _FAULT /* Autovector Level 2 */
76 vector1B: .long _FAULT /* Autovector Level 3 */
77 vector1C: .long _FAULT /* Autovector Level 4 */
78 vector1D: .long _FAULT /* Autovector Level 5 */
79 vector1E: .long _FAULT /* Autovector Level 6 */
80 vector1F: .long _FAULT /* Autovector Level 7 */
84 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
85 .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
93 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
94 .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
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
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
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
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
128 move.w #0x2700,%sr /* Mask off Interrupt */
130 /* Set vector base register at the beginning of the Flash */
131 move.l #CONFIG_SYS_FLASH_BASE, %d0
134 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
137 /* invalidate and disable cache */
138 move.l #0x01000000, %d0 /* Invalidate cache cmd */
139 movec %d0, %CACR /* Invalidate cache */
145 /* initialize general use internal ram */
147 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
148 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a2
152 /* set stackpointer to end of internal ram to get some stackspace for the
154 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
157 move.l #__got_start, %a5 /* put relocation table address to a5 */
159 bsr cpu_init_f /* run low-level CPU init code (from flash) */
160 bsr board_init_f /* run low-level board init code (from flash) */
162 /* board_init_f() does not return */
164 /*------------------------------------------------------------------------------*/
167 * void relocate_code (addr_sp, gd, addr_moni)
169 * This "function" does not return, instead it continues in RAM
170 * after relocating the monitor code.
174 * r5 = length in bytes
180 move.l 8(%a6), %sp /* set new stack pointer */
182 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
183 move.l 16(%a6), %a0 /* Save copy of Destination Address */
185 move.l #CONFIG_SYS_MONITOR_BASE, %a1
186 move.l #__init_end, %a2
189 /* copy the code to RAM */
191 move.l (%a1)+, (%a3)+
196 * We are done. Do not return, instead branch to second part of board
197 * initialization, now running from RAM.
200 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
207 * Now clear BSS segment
210 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
212 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
219 * fix got table in RAM
222 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
223 move.l %a1,%a5 /* * fix got pointer register a5 */
226 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
236 /* calculate relative jump to board_init_r in ram */
238 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
240 /* set parameters for board_init_r */
241 move.l %a0,-(%sp) /* dest_addr */
242 move.l %d0,-(%sp) /* gd */
245 /*------------------------------------------------------------------------------*/
267 /*------------------------------------------------------------------------------*/
268 /* cache functions */
271 move.l #0x01000000, %d0 /* Invalidate cache cmd */
272 movec %d0, %CACR /* Invalidate cache */
274 move.l #(CONFIG_SYS_SDRAM_BASE + 0xc000), %d0 /* Setup cache mask */
275 movec %d0, %ACR0 /* Enable cache */
276 move.l #(CONFIG_SYS_FLASH_BASE + 0xc000), %d0 /* Setup cache mask */
277 movec %d0, %ACR1 /* Enable cache */
279 move.l #0x80400100, %d0 /* Setup cache mask */
280 movec %d0, %CACR /* Enable cache */
283 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
288 .globl icache_disable
290 move.l #0x00000100, %d0 /* Setup cache mask */
291 movec %d0, %CACR /* Disable cache */
292 clr.l %d0 /* Setup cache mask */
296 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
303 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
307 .globl icache_invalid
309 move.l #0x80600100, %d0 /* Setup cache mask */
310 movec %d0, %CACR /* Enable cache */
316 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a1
321 /* No dcache, just a dummy function */
322 .globl dcache_disable
324 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a1
331 move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-4), %a1
335 /*------------------------------------------------------------------------------*/
337 .globl version_string
339 .ascii U_BOOT_VERSION
340 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
341 .ascii CONFIG_IDENT_STRING, "\0"