2 * Copyright (C) 2005-2006 Atmel Corporation
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <asm/sysreg.h>
25 #ifndef PART_SPECIFIC_BOOTSTRAP
26 # define PART_SPECIFIC_BOOTSTRAP
29 #define SYSREG_MMUCR_I_OFFSET 2
30 #define SYSREG_MMUCR_S_OFFSET 4
32 #define SR_INIT (SYSREG_BIT(GM) | SYSREG_BIT(EM) | SYSREG_BIT(M0))
33 #define CPUCR_INIT (SYSREG_BIT(BI) | SYSREG_BIT(BE) \
34 | SYSREG_BIT(FE) | SYSREG_BIT(RE) \
35 | SYSREG_BIT(IBE) | SYSREG_BIT(IEE))
40 PART_SPECIFIC_BOOTSTRAP
42 /* Reset the Status Register */
47 /* Reset CPUCR and invalidate the BTB */
51 /* Flush the caches */
57 /* Reset the MMU to default settings */
58 mov r0, SYSREG_BIT(MMUCR_S) | SYSREG_BIT(MMUCR_I)
61 /* Internal RAM should not need any initialization. We might
62 have to initialize external RAM here if the part doesn't
63 have internal RAM (or we may use the data cache) */
65 /* Jump to cacheable segment */
73 /* Initialize the GOT pointer */
83 .long CFG_INIT_SP_ADDR
85 .long 3b - _GLOBAL_OFFSET_TABLE_
88 * void relocate_code(new_sp, new_gd, monitor_addr)
90 * Relocate the u-boot image into RAM and continue from there.
94 .type relocate_code,@function
96 mov sp, r12 /* use new stack */
97 mov r12, r11 /* save new_gd */
98 mov r11, r10 /* save destination address */
100 /* copy .text section and flush the cache along the way */
103 sub lr, r10, r8 /* relocation offset */
112 cache r10[-4], 0x0d /* dcache clean/invalidate */
113 cache r10[-4], 0x01 /* icache invalidate */
116 /* flush write buffer */
119 /* copy data sections */
136 sub r0, pc, . - in_ram
141 /* find the new GOT and relocate it */
142 lddpc r6, got_init_reloc
154 /* Move the exception handlers */
159 /* Do the rest of the initialization sequence */
164 .long 3b - _GLOBAL_OFFSET_TABLE_