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 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm-offsets.h>
14 #include <asm/cache.h>
16 #ifndef CONFIG_IDENT_STRING
17 #define CONFIG_IDENT_STRING ""
24 move.w #0x2700,%sr; /* disable intrs */ \
25 subl #60,%sp; /* space for 15 regs */ \
26 moveml %d0-%d7/%a0-%a6,%sp@;
29 moveml %sp@,%d0-%d7/%a0-%a6; \
30 addl #60,%sp; /* space for 15 regs */ \
33 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
36 * Vector table. This is used for initial platform startup.
37 * These vectors are to catch any un-intended traps.
41 INITSP: .long 0x00000000 /* Initial SP */
42 INITPC: .long _START /* Initial PC */
43 vector02: .long _FAULT /* Access Error */
44 vector03: .long _FAULT /* Address Error */
45 vector04: .long _FAULT /* Illegal Instruction */
46 vector05: .long _FAULT /* Reserved */
47 vector06: .long _FAULT /* Reserved */
48 vector07: .long _FAULT /* Reserved */
49 vector08: .long _FAULT /* Privilege Violation */
50 vector09: .long _FAULT /* Trace */
51 vector0A: .long _FAULT /* Unimplemented A-Line */
52 vector0B: .long _FAULT /* Unimplemented F-Line */
53 vector0C: .long _FAULT /* Debug Interrupt */
54 vector0D: .long _FAULT /* Reserved */
55 vector0E: .long _FAULT /* Format Error */
56 vector0F: .long _FAULT /* Unitialized Int. */
60 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
62 vector18: .long _FAULT /* Spurious Interrupt */
63 vector19: .long _FAULT /* Autovector Level 1 */
64 vector1A: .long _FAULT /* Autovector Level 2 */
65 vector1B: .long _FAULT /* Autovector Level 3 */
66 vector1C: .long _FAULT /* Autovector Level 4 */
67 vector1D: .long _FAULT /* Autovector Level 5 */
68 vector1E: .long _FAULT /* Autovector Level 6 */
69 vector1F: .long _FAULT /* Autovector Level 7 */
73 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
74 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
78 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
79 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
82 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
83 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
84 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
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
92 .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
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
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 #endif /* !defined(CONFIG_MONITOR_IS_IN_RAM) */
118 move.w #0x2700,%sr /* Mask off Interrupt */
120 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
121 /* Set vector base register at the beginning of the Flash */
122 move.l #CONFIG_SYS_FLASH_BASE, %d0
126 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
129 /* invalidate and disable cache */
130 move.l #CF_CACR_CINVA, %d0 /* Invalidate cache cmd */
131 movec %d0, %CACR /* Invalidate cache */
136 #ifdef CONFIG_MCF5301x
137 move.l #(0xFC0a0010), %a0
144 /* initialize general use internal ram */
146 move.l #(ICACHE_STATUS), %a1 /* icache */
147 move.l #(DCACHE_STATUS), %a2 /* icache */
151 /* put relocation table address to a5 */
152 move.l #__got_start, %a5
154 /* setup stack initially on top of internal static ram */
155 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp
158 * if configured, malloc_f arena will be reserved first,
159 * then (and always) gd struct space will be reserved
162 move.l #board_init_f_alloc_reserve, %a1
165 /* update stack and frame-pointers */
169 /* initialize reserved area */
171 move.l #board_init_f_init_reserve, %a1
174 /* run low-level CPU init code (from flash) */
175 move.l #cpu_init_f, %a1
177 /* run low-level board init code (from flash) */
179 move.l #board_init_f, %a1
182 /* board_init_f() does not return */
184 /*------------------------------------------------------------------------------*/
187 * void relocate_code (addr_sp, gd, addr_moni)
189 * This "function" does not return, instead it continues in RAM
190 * after relocating the monitor code.
194 * r5 = length in bytes
200 move.l 8(%a6), %sp /* set new stack pointer */
202 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
203 move.l 16(%a6), %a0 /* Save copy of Destination Address */
205 move.l #CONFIG_SYS_MONITOR_BASE, %a1
206 move.l #__init_end, %a2
209 /* copy the code to RAM */
211 move.l (%a1)+, (%a3)+
216 * We are done. Do not return, instead branch to second part of board
217 * initialization, now running from RAM.
220 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
227 * Now clear BSS segment
230 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
232 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
239 * fix got table in RAM
242 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
243 move.l %a1,%a5 /* * fix got pointer register a5 */
246 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
256 /* calculate relative jump to board_init_r in ram */
258 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
260 /* set parameters for board_init_r */
261 move.l %a0,-(%sp) /* dest_addr */
262 move.l %d0,-(%sp) /* gd */
265 /*------------------------------------------------------------------------------*/
287 /*------------------------------------------------------------------------------*/
288 .globl version_string
290 .ascii U_BOOT_VERSION_STRING, "\0"