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 * Lineo 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 * Setup VBR here, otherwise buserror remap will not work.
88 * if dBug was active before (on my SBC with dBug 1.1 of Dec 16 1996)
92 * Note: this is because dBUG points VBR to ROM, making vectors read
93 * only, so the bus trap can't be changed. (RS)
95 move.l #VBR_BASE, %a7 /* Note VBR can't be read */
97 move.l %a7, _ramvec /* Set up vector addr */
98 move.l %a7, _rambase /* Set up base RAM addr */
102 * Determine size of RAM, then set up initial stack.
104 move.l #MEM_SIZE, %a0
106 move.l %a0, %d0 /* Mem end addr is in a0 */
107 move.l %d0, %sp /* Set up initial stack ptr */
108 move.l %d0, _ramend /* Set end ram addr */
111 * Enable CPU internal cache.
113 move.l #0x01000000, %d0 /* Invalidate cache cmd */
114 movec %d0, %CACR /* Invalidate cache */
115 move.l #0x80000100, %d0 /* Setup cache mask */
116 movec %d0, %CACR /* Enable cache */
120 #ifdef CONFIG_ROMFS_FS
121 #ifdef CONFIG_ROMFS_FROM_ROM
123 * check for an in RAM romfs
125 lea.l _sbss, %a0 /* Get start of bss */
127 cmp.l #0x2d726f6d, %d0 /* check for "-rom" */
131 cmp.l #0x3166732d, %d0 /* check for "1fs-" */
136 * Move ROM filesystem above bss :-)
138 lea.l _sbss, %a0 /* Get start of bss */
139 lea.l _ebss, %a1 /* Set up destination */
140 move.l %a0, %a2 /* Copy of bss start */
142 move.l 8(%a0), %d0 /* Get size of ROMFS */
143 addq.l #8, %d0 /* Allow for rounding */
144 and.l #0xfffffffc, %d0 /* Whole words */
146 add.l %d0, %a0 /* Copy from end */
147 add.l %d0, %a1 /* Copy from end */
148 move.l %a1, _ramstart /* Set start of ram */
151 move.l -(%a0), %d0 /* Copy dword */
153 cmp.l %a0, %a2 /* Check if at end */
156 #ifdef CONFIG_ROMFS_FROM_ROM
159 lea.l _ebss, %a1 /* Set up destination */
160 mov.l #0, (%a1) /* make sure we don't use an old RAM version */
161 move.l %a1, _ramstart /* Set start of ram */
165 #else /* CONFIG_ROMFS_FS */
167 move.l %a1, _ramstart
168 #endif /* CONFIG_ROMFS_FS */
172 * Zero out the bss region.
174 lea.l _sbss, %a0 /* Get start of bss */
175 lea.l _ebss, %a1 /* Get end of bss */
176 clr.l %d0 /* Set value */
178 move.l %d0, (%a0)+ /* Clear each word */
179 cmp.l %a0, %a1 /* Check if at end */
183 * load the current task pointer and stack
185 lea init_thread_union, %a0
189 * Assember start up done, start code proper.
191 jsr start_kernel /* Start Linux kernel */
194 jmp _exit /* Should never get here */
196 /*****************************************************************************/