1 /*****************************************************************************/
4 * crt0_ram.S -- startup code for senTec COBRA5282 ColdFire based boards.
6 * (C) Copyright 2003, Greg Ungerer (gerg@snapgear.com).
9 /*****************************************************************************/
11 #include <linux/config.h>
12 #include <linux/threads.h>
13 #include <linux/linkage.h>
14 #include <asm/segment.h>
15 #include <asm/coldfire.h>
16 #include <asm/mcfsim.h>
18 /*****************************************************************************/
21 * senTec COBRA5282 board, chip select and 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 #define IPSBAR 0x40000000
37 /*****************************************************************************/
45 /*****************************************************************************/
50 * Set up the usable of RAM stuff. Size of RAM is determined then
51 * an initial stack set up at the end.
62 /*****************************************************************************/
67 * This is the codes first entry point. This is where it all
73 move.w #0x2700, %sr /* No interrupts */
76 * Setup VBR here, otherwise buserror remap will not work.
77 * if dBug was active before (on my SBC with dBug 1.1 of Dec 16 1996)
81 * Note: this is because dBUG points VBR to ROM, making vectors read
82 * only, so the bus trap can't be changed. (RS)
84 move.l #VBR_BASE, %a7 /* Note VBR can't be read */
86 move.l %a7, _ramvec /* Set up vector addr */
87 move.l %a7, _rambase /* Set up base RAM addr */
95 move.l %a0, %d0 /* Mem end addr is in a0 */
96 move.l %d0, %sp /* Set up initial stack ptr */
97 move.l %d0, _ramend /* Set end ram addr */
100 * Enable CPU internal cache.
102 * Cache is totally broken in first 5282 silicon.
103 * No point enabling it for now.
106 move.l #0x01000000, %d0
107 movec %d0, %CACR /* Invalidate cache */
110 move.l #0x0000c000, %d0 /* Set SDRAM cached only */
112 move.l #0x00000000, %d0 /* No other regions cached */
115 move.l #0x00000000, %d0 /* Setup cache mask */
116 movec %d0, %CACR /* Enable cache */
121 #ifdef CONFIG_ROMFS_FS
123 * Move ROM filesystem above bss :-)
125 lea.l _sbss, %a0 /* Get start of bss */
126 lea.l _ebss, %a1 /* Set up destination */
127 move.l %a0, %a2 /* Copy of bss start */
129 move.l 8(%a0), %d0 /* Get size of ROMFS */
130 addq.l #8, %d0 /* Allow for rounding */
131 and.l #0xfffffffc, %d0 /* Whole words */
133 add.l %d0, %a0 /* Copy from end */
134 add.l %d0, %a1 /* Copy from end */
135 move.l %a1, _ramstart /* Set start of ram */
138 move.l -(%a0), %d0 /* Copy dword */
140 cmp.l %a0, %a2 /* Check if at end */
142 #else /* CONFIG_ROMFS_FS */
144 move.l %a1, _ramstart
145 #endif /* CONFIG_ROMFS_FS */
149 * Zero out the bss region.
151 lea.l _sbss, %a0 /* Get start of bss */
152 lea.l _ebss, %a1 /* Get end of bss */
153 clr.l %d0 /* Set value */
155 move.l %d0, (%a0)+ /* Clear each word */
156 cmp.l %a0, %a1 /* Check if at end */
160 * Load the current thread pointer and stack.
162 lea init_thread_union, %a0
166 * User mode port access
168 move.l #0x0000000c, %d0
169 move.b %d0, (IPSBAR+GPACR0)
173 * Assember start up done, start code proper.
175 jsr start_kernel /* Start Linux kernel */
178 jmp _exit /* Should never get here */
180 /*****************************************************************************/