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)
38 * Vector table. This is used for initial platform startup.
39 * These vectors are to catch any un-intended traps.
42 INITSP: .long 0x00000000 /* Initial SP */
43 INITPC: .long _START /* Initial PC */
46 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
47 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
51 .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
63 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
64 .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
70 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
71 .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
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
80 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
81 .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
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 .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
93 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
94 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
95 #endif /* !defined(CONFIG_MONITOR_IS_IN_RAM) */
103 move.w #0x2700,%sr /* Mask off Interrupt */
105 #if !defined(CONFIG_MONITOR_IS_IN_RAM)
106 /* Set vector base register at the beginning of the Flash */
107 move.l #CONFIG_SYS_FLASH_BASE, %d0
111 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
114 /* invalidate and disable cache */
115 move.l #CF_CACR_CINVA, %d0 /* Invalidate cache cmd */
116 movec %d0, %CACR /* Invalidate cache */
121 #ifdef CONFIG_MCF5301x
122 move.l #(0xFC0a0010), %a0
129 /* initialize general use internal ram */
131 move.l #(ICACHE_STATUS), %a1 /* icache */
132 move.l #(DCACHE_STATUS), %a2 /* icache */
136 /* put relocation table address to a5 */
137 move.l #__got_start, %a5
139 /* setup stack initially on top of internal static ram */
140 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp
143 * if configured, malloc_f arena will be reserved first,
144 * then (and always) gd struct space will be reserved
147 move.l #board_init_f_alloc_reserve, %a1
150 /* update stack and frame-pointers */
154 /* initialize reserved area */
156 move.l #board_init_f_init_reserve, %a1
159 /* run low-level CPU init code (from flash) */
160 move.l #cpu_init_f, %a1
163 /* run low-level board init code (from flash) */
165 move.l #board_init_f, %a1
168 /* board_init_f() does not return */
170 /******************************************************************************/
173 * void relocate_code (addr_sp, gd, addr_moni)
175 * This "function" does not return, instead it continues in RAM
176 * after relocating the monitor code.
180 * r5 = length in bytes
186 move.l 8(%a6), %sp /* set new stack pointer */
188 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
189 move.l 16(%a6), %a0 /* Save copy of Destination Address */
191 move.l #CONFIG_SYS_MONITOR_BASE, %a1
192 move.l #__init_end, %a2
195 /* copy the code to RAM */
197 move.l (%a1)+, (%a3)+
202 * We are done. Do not return, instead branch to second part of board
203 * initialization, now running from RAM.
206 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
213 * Now clear BSS segment
216 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
218 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
225 * fix got table in RAM
228 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
229 move.l %a1,%a5 /* fix got pointer register a5 */
232 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
242 /* calculate relative jump to board_init_r in ram */
244 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
246 /* set parameters for board_init_r */
247 move.l %a0,-(%sp) /* dest_addr */
248 move.l %d0,-(%sp) /* gd */
251 /******************************************************************************/
274 /******************************************************************************/
276 .globl version_string
278 .ascii U_BOOT_VERSION_STRING, "\0"