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>
7 #include <asm-offsets.h>
10 #include <asm/cache.h>
16 move.w #0x2700,%sr; /* disable intrs */ \
17 subl #60,%sp; /* space for 15 regs */ \
18 moveml %d0-%d7/%a0-%a6,%sp@;
21 moveml %sp@,%d0-%d7/%a0-%a6; \
22 addl #60,%sp; /* space for 15 regs */ \
28 * Vector table. This is used for initial platform startup.
29 * These vectors are to catch any un-intended traps.
32 INITSP: .long 0x00000000 /* Initial SP */
33 INITPC: .long _START /* Initial PC */
36 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
37 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
41 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
44 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
48 .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
57 .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
60 .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
61 .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
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
92 move.w #0x2700,%sr /* Mask off Interrupt */
94 /* Set vector base register at the beginning of the Flash */
95 move.l #CONFIG_SYS_FLASH_BASE, %d0
98 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
101 move.l #(CONFIG_SYS_INIT_RAM1_ADDR + CONFIG_SYS_INIT_RAM1_CTRL), %d0
104 move.l #CONFIG_SYS_MBAR, %d0 /* set MBAR address */
107 /* invalidate and disable cache */
108 move.l #0x01040100, %d0 /* Invalidate cache cmd */
109 movec %d0, %CACR /* Invalidate cache */
116 /* initialize general use internal ram */
118 move.l #(ICACHE_STATUS), %a1 /* icache */
119 move.l #(DCACHE_STATUS), %a2 /* icache */
123 /* put relocation table address to a5 */
124 move.l #__got_start, %a5
126 /* setup stack initially on top of internal static ram */
127 move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp
130 * if configured, malloc_f arena will be reserved first,
131 * then (and always) gd struct space will be reserved
134 move.l #board_init_f_alloc_reserve, %a1
137 /* update stack and frame-pointers */
141 /* initialize reserved area */
143 move.l #board_init_f_init_reserve, %a1
146 /* run low-level CPU init code (from flash) */
149 /* run low-level board init code (from flash) */
153 /* board_init_f() does not return */
155 /******************************************************************************/
158 * void relocate_code (addr_sp, gd, addr_moni)
160 * This "function" does not return, instead it continues in RAM
161 * after relocating the monitor code.
165 * r5 = length in bytes
171 move.l 8(%a6), %sp /* set new stack pointer */
173 move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
174 move.l 16(%a6), %a0 /* Save copy of Destination Address */
176 move.l #CONFIG_SYS_MONITOR_BASE, %a1
177 move.l #__init_end, %a2
180 /* copy the code to RAM */
182 move.l (%a1)+, (%a3)+
187 * We are done. Do not return, instead branch to second part of board
188 * initialization, now running from RAM.
191 add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
198 * Now clear BSS segment
201 add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
203 add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
210 * fix got table in RAM
213 add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
214 move.l %a1,%a5 /* fix got pointer register a5 */
217 add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
227 /* calculate relative jump to board_init_r in ram */
229 add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
231 /* set parameters for board_init_r */
232 move.l %a0,-(%sp) /* dest_addr */
233 move.l %d0,-(%sp) /* gd */
236 /******************************************************************************/
259 /******************************************************************************/
261 .globl version_string
263 .ascii U_BOOT_VERSION_STRING, "\0"