1 /*****************************************************************************/
4 * crt0_ram.S -- startup code for MCF5307 ColdFire based NETtel.
6 * (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com).
7 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
9 * 1999/02/24 Modified for the 5307 processor David W. Miller
12 /*****************************************************************************/
14 #include "linux/autoconf.h"
15 #include "asm/coldfire.h"
16 #include "asm/mcfsim.h"
17 #include "asm/nettel.h"
19 /*****************************************************************************/
22 * SnapGear/NETtel board memory setup.
24 #define MEM_BASE 0x00000000 /* Memory base at address 0 */
25 #define VBR_BASE MEM_BASE /* Vector address */
27 #if defined(CONFIG_RAM16MB)
28 #define MEM_SIZE 0x01000000 /* Memory size 16Mb */
29 #elif defined(CONFIG_RAM8MB)
30 #define MEM_SIZE 0x00800000 /* Memory size 8Mb */
32 #define MEM_SIZE 0x00400000 /* Memory size 4Mb */
35 /*****************************************************************************/
43 /*****************************************************************************/
48 * Set up the usable of RAM stuff. Size of RAM is determined then
49 * an initial stack set up at the end.
60 /*****************************************************************************/
63 * The NETtel platform has some funky LEDs!
73 /*****************************************************************************/
78 * This is the codes first entry point. This is where it all
84 move.w #0x2700, %sr /* No interrupts */
87 * Set LEDs to known startup state.
89 move.l #NETtel_LEDADDR, %a5 /* Addr of LED bank */
90 move.b #0xff, (%a5) /* Turn them all off */
94 * Disable watchdog timer.
96 move.l #MCF_MBAR, %a0 /* Get MBAR address */
97 clr.l %d0 /* Disable SWT */
98 move.b %d0, MCFSIM_SYPCR(%a0)
99 move.b #0x55, %d0 /* Clear SWT as well */
100 move.b %d0, MCFSIM_SWSR(%a0)
102 move.b %d0, MCFSIM_SWSR(%a0)
103 move.l #0xffffffff, %d0 /* Mask out all interrupts */
104 move.l %d0, MCFSIM_IMR(%a0)
107 * Setup VBR here, otherwise buserror remap will not work.
108 * if dBug was active before (on my SBC with dBug 1.1 of Dec 16 1996)
110 * bkr@cut.de 19990306
112 * Note: this is because dBUG points VBR to ROM, making vectors read
113 * only, so the bus trap can't be changed. (RS)
115 move.l #VBR_BASE, %a7 /* Note VBR can't be read */
117 move.l %a7, _ramvec /* Set up vector addr */
118 move.l %a7, _rambase /* Set up base RAM addr */
122 * Determine size of RAM, then set up initial stack.
124 move.l #MEM_SIZE, %a0
126 move.l %a0, %d0 /* Mem end addr is in a0 */
127 move.l %d0, %sp /* Set up initial stack ptr */
128 move.l %d0, _ramend /* Set end ram addr */
131 * Enable CPU internal cache.
133 move.l #0x01000000, %d0 /* invalidate whole cache */
136 #ifdef DEBUGGER_COMPATIBLE_CACHE
137 move.l #0x0000c000, %d0 /* Set SDRAM cached only */
139 move.l #0x0000c020, %d0 /* Set SDRAM cached only (copyback) */
142 move.l #0x00000000, %d0 /* No other regions cached */
146 move.l #0xa0000200, %d0
151 #ifdef CONFIG_ROMFS_FS
153 * Move ROM filesystem above bss :-)
155 lea.l _sbss, %a0 /* Get start of bss */
156 lea.l _ebss, %a1 /* Set up destination */
157 move.l %a0, %a2 /* Copy of bss start */
159 move.l 8(%a0), %d0 /* Get size of ROMFS */
160 addq.l #8, %d0 /* Allow for rounding */
161 and.l #0xfffffffc, %d0 /* Whole words */
163 add.l %d0, %a0 /* Copy from end */
164 add.l %d0, %a1 /* Copy from end */
165 move.l %a1, _ramstart /* Set start of ram */
168 move.l -(%a0), %d0 /* Copy dword */
170 cmp.l %a0, %a2 /* Check if at end */
173 #else /* CONFIG_ROMFS_FS */
175 move.l %a1, _ramstart
176 #endif /* CONFIG_ROMFS_FS */
180 * Zero out the bss region.
182 lea.l _sbss, %a0 /* Get start of bss */
183 lea.l _ebss, %a1 /* Get end of bss */
184 clr.l %d0 /* Set value */
186 move.l %d0, (%a0)+ /* Clear each word */
187 cmp.l %a0, %a1 /* Check if at end */
191 * load the current task pointer and stack
193 lea init_thread_union, %a0
197 * Assember start up done, start code proper.
199 jsr start_kernel /* Start Linux kernel */
202 jmp _exit /* Should never get here */
204 /*****************************************************************************/