1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de>
4 * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
6 * (C) Copyright 2004-2008 Freescale Semiconductor, Inc.
7 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
10 #include <asm-offsets.h>
13 #include <asm/cache.h>
19 move.w #0x2700,%sr; /* disable intrs */ \
20 subl #60,%sp; /* space for 15 regs */ \
21 moveml %d0-%d7/%a0-%a6,%sp@;
24 moveml %sp@,%d0-%d7/%a0-%a6; \
25 addl #60,%sp; /* space for 15 regs */ \
28 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
33 * Vector table. This is used for initial platform startup.
34 * These vectors are to catch any un-intended traps.
37 INITSP: .long 0x00000000 /* Initial SP */
38 INITPC: .long _START /* Initial PC */
41 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
42 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
46 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
49 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
53 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
54 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
58 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
59 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
62 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
63 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
64 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
65 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
66 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
67 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
68 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
69 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
72 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
73 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
74 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
75 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
76 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
77 .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
90 #endif /* !defined(CONFIG_MONITOR_IS_IN_RAM) */
98 move.w #0x2700,%sr /* Mask off Interrupt */
100 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
101 /* Set vector base register at the beginning of the Flash */
102 move.l #CONFIG_SYS_FLASH_BASE, %d0
106 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
109 /* invalidate and disable cache */
110 move.l #CF_CACR_CINVA, %d0 /* Invalidate cache cmd */
111 movec %d0, %CACR /* Invalidate cache */
116 #ifdef CONFIG_MCF5301x
117 move.l #(0xFC0a0010), %a0
124 /* initialize general use internal ram */
126 move.l #(ICACHE_STATUS), %a1 /* icache */
127 move.l #(DCACHE_STATUS), %a2 /* icache */
131 /* put relocation table address to a5 */
132 move.l #__got_start, %a5
134 /* setup stack initially on top of internal static ram */
135 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp
138 * if configured, malloc_f arena will be reserved first,
139 * then (and always) gd struct space will be reserved
142 move.l #board_init_f_alloc_reserve, %a1
145 /* update stack and frame-pointers */
149 /* initialize reserved area */
151 move.l #board_init_f_init_reserve, %a1
154 /* run low-level CPU init code (from flash) */
155 move.l #cpu_init_f, %a1
158 /* run low-level board init code (from flash) */
160 move.l #board_init_f, %a1
163 /* board_init_f() does not return */
165 /******************************************************************************/
168 * void relocate_code (addr_sp, gd, addr_moni)
170 * This "function" does not return, instead it continues in RAM
171 * after relocating the monitor code.
175 * r5 = length in bytes
181 move.l 8(%a6), %sp /* set new stack pointer */
183 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
184 move.l 16(%a6), %a0 /* Save copy of Destination Address */
186 move.l #CONFIG_SYS_MONITOR_BASE, %a1
187 move.l #__init_end, %a2
190 /* copy the code to RAM */
192 move.l (%a1)+, (%a3)+
197 * We are done. Do not return, instead branch to second part of board
198 * initialization, now running from RAM.
201 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
208 * Now clear BSS segment
211 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
213 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
220 * fix got table in RAM
223 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
224 move.l %a1,%a5 /* fix got pointer register a5 */
227 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
237 /* calculate relative jump to board_init_r in ram */
239 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
241 /* set parameters for board_init_r */
242 move.l %a0,-(%sp) /* dest_addr */
243 move.l %d0,-(%sp) /* gd */
246 /******************************************************************************/
269 /******************************************************************************/
271 .globl version_string
273 .ascii U_BOOT_VERSION_STRING, "\0"