1 /*****************************************************************************/
4 * crt0_ram.S -- startup code for Motorola 5407 eval board.
6 * (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com).
7 * (C) Copyright 2000, Lineo (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"
18 /*****************************************************************************/
23 #define MEM_BASE 0x00000000 /* Memory base at address 0 */
24 #define VBR_BASE MEM_BASE /* Vector address */
26 #define MEM_SIZE 0x02000000 /* Memory size 32 */
28 /*****************************************************************************/
36 /*****************************************************************************/
41 * Set up the usable of RAM stuff. Size of RAM is determined then
42 * an initial stack set up at the end.
53 /*****************************************************************************/
58 * This is the codes first entry point. This is where it all
64 move.w #0x2700, %sr /* No interrupts */
67 * Setup VBR as per eval board (really dBUG does this).
68 * These settings must match it.
70 move.l #VBR_BASE, %a0 /* Note VBR can't be read */
72 move.l %a0, _ramvec /* Set up vector addr */
73 move.l %a0, _rambase /* Set up base RAM addr */
77 * Determine size of RAM, then set up initial stack.
81 move.l %a0, %d0 /* Mem end addr is in a0 */
82 move.l %d0, %sp /* Set up initial stack ptr */
83 move.l %d0, _ramend /* Set end ram addr */
87 * Enable CPU internal cache.
89 move.l #0x01040100, %d0 /* Invalidate whole cache */
92 move.l #0x000fc000, %d0 /* Set SDRAM cached only */
94 move.l #0x00000000, %d0 /* No other regions cached */
96 move.l #0x000fc000, %d0 /* Set SDRAM cached only */
98 move.l #0x00000000, %d0 /* No other regions cached */
102 move.l #0xb6088400, %d0 /* Enable caches */
107 #ifdef CONFIG_ROMFS_FS
109 * Move ROM filesystem above bss :-)
111 lea.l _sbss, %a0 /* Get start of bss */
112 lea.l _ebss, %a1 /* Set up destination */
113 move.l %a0, %a2 /* Copy of bss start */
115 move.l 8(%a0), %d0 /* Get size of ROMFS */
116 addq.l #8, %d0 /* Allow for rounding */
117 and.l #0xfffffffc, %d0 /* Whole words */
119 add.l %d0, %a0 /* Copy from end */
120 add.l %d0, %a1 /* Copy from end */
121 move.l %a1, _ramstart /* Set start of ram */
124 move.l -(%a0), %d0 /* Copy dword */
126 cmp.l %a0, %a2 /* Check if at end */
129 #else /* CONFIG_ROMFS_FS */
131 move.l %a1, _ramstart
132 #endif /* CONFIG_ROMFS_FS */
136 * Zero out the bss region.
138 lea.l _sbss, %a0 /* Get start of bss */
139 lea.l _ebss, %a1 /* Get end of bss */
140 clr.l %d0 /* Set value */
142 move.l %d0, (%a0)+ /* Clear each word */
143 cmp.l %a0, %a1 /* Check if at end */
147 * Load the current task pointer and stack.
149 lea init_thread_union, %a0
153 * Assember start up done, start code proper.
155 jsr start_kernel /* Start Linux kernel */
158 jmp _exit /* Should never get here */
160 /*****************************************************************************/