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 #0xa4098400, %d0 /* Write buffer, dflt precise */
107 * Move ROM filesystem above bss :-)
109 lea.l _sbss, %a0 /* Get start of bss */
110 lea.l _ebss, %a1 /* Set up destination */
111 move.l %a0, %a2 /* Copy of bss start */
113 move.l 8(%a0), %d0 /* Get size of ROMFS */
114 addq.l #8, %d0 /* Allow for rounding */
115 and.l #0xfffffffc, %d0 /* Whole words */
117 add.l %d0, %a0 /* Copy from end */
118 add.l %d0, %a1 /* Copy from end */
119 move.l %a1, _ramstart /* Set start of ram */
122 move.l -(%a0), %d0 /* Copy dword */
124 cmp.l %a0, %a2 /* Check if at end */
128 * Zero out the bss region.
130 lea.l _sbss, %a0 /* Get start of bss */
131 lea.l _ebss, %a1 /* Get end of bss */
132 clr.l %d0 /* Set value */
134 move.l %d0, (%a0)+ /* Clear each word */
135 cmp.l %a0, %a1 /* Check if at end */
139 * Load the current task pointer and stack.
141 lea init_thread_union, %a0
145 * Assember start up done, start code proper.
147 jsr start_kernel /* Start Linux kernel */
150 jmp _exit /* Should never get here */
152 /*****************************************************************************/