http://www.hht-eu.com/pls/hht/docs/F3140/bcm963xx_Speedport500V.0.09.04L.300L01.V27_c...
[bcm963xx.git] / kernel / linux / arch / m68knommu / platform / 5407 / MOTOROLA / crt0_ram.S
1 /*****************************************************************************/
2
3 /*
4  *      crt0_ram.S -- startup code for Motorola 5407 eval board.
5  *
6  *      (C) Copyright 1999-2002, Greg Ungerer (gerg@snapgear.com).
7  *      (C) Copyright 2000, Lineo (www.lineo.com).
8  *
9  *      1999/02/24 Modified for the 5307 processor David W. Miller
10  */
11
12 /*****************************************************************************/
13
14 #include "linux/autoconf.h"
15 #include "asm/coldfire.h"
16 #include "asm/mcfsim.h"
17
18 /*****************************************************************************/
19
20 /*
21  *      Board setup info.
22  */
23 #define MEM_BASE        0x00000000      /* Memory base at address 0 */
24 #define VBR_BASE        MEM_BASE        /* Vector address */
25
26 #define MEM_SIZE        0x02000000      /* Memory size 32 */
27
28 /*****************************************************************************/
29
30 .global _start
31 .global _rambase
32 .global _ramvec
33 .global _ramstart
34 .global _ramend
35
36 /*****************************************************************************/
37
38 .data
39
40 /*
41  *      Set up the usable of RAM stuff. Size of RAM is determined then
42  *      an initial stack set up at the end.
43  */
44 _rambase:
45 .long   0
46 _ramvec:
47 .long   0
48 _ramstart:
49 .long   0
50 _ramend:
51 .long   0
52
53 /*****************************************************************************/
54
55 .text
56
57 /*
58  *      This is the codes first entry point. This is where it all
59  *      begins...
60  */
61
62 _start:
63         nop                                     /* Filler */
64         move.w  #0x2700, %sr                    /* No interrupts */
65
66         /*
67          *      Setup VBR as per eval board (really dBUG does this).
68          *      These settings must match it.
69          */
70         move.l  #VBR_BASE, %a0                  /* Note VBR can't be read */
71         movec   %a0, %VBR
72         move.l  %a0, _ramvec                    /* Set up vector addr */
73         move.l  %a0, _rambase                   /* Set up base RAM addr */
74
75
76         /*
77          *      Determine size of RAM, then set up initial stack.
78          */
79         move.l  #MEM_SIZE, %a0
80
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 */
84
85
86         /*
87          *      Enable CPU internal cache.
88          */
89         move.l  #0x01040100, %d0                /* Invalidate whole cache */
90         movec   %d0,%CACR
91         nop
92         move.l  #0x000fc000, %d0                /* Set SDRAM cached only */
93         movec   %d0, %ACR0
94         move.l  #0x00000000, %d0                /* No other regions cached */
95         movec   %d0, %ACR1
96         move.l  #0x000fc000, %d0                /* Set SDRAM cached only */
97         movec   %d0, %ACR2
98         move.l  #0x00000000, %d0                /* No other regions cached */
99         movec   %d0, %ACR3
100
101         /* Enable cache */
102         move.l  #0xb6088400, %d0                /* Enable caches */
103         movec   %d0,%CACR
104         nop
105
106
107 #ifdef CONFIG_ROMFS_FS
108         /*
109          *      Move ROM filesystem above bss :-)
110          */
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 */
114
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 */
118
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 */
122
123 _copy_romfs:
124         move.l  -(%a0), %d0                     /* Copy dword */
125         move.l  %d0, -(%a1)
126         cmp.l   %a0, %a2                        /* Check if at end */
127         bne     _copy_romfs
128
129 #else /* CONFIG_ROMFS_FS */
130         lea.l   _ebss, %a1
131         move.l  %a1, _ramstart
132 #endif /* CONFIG_ROMFS_FS */
133
134
135         /*
136          *      Zero out the bss region.
137          */
138         lea.l   _sbss, %a0                      /* Get start of bss */
139         lea.l   _ebss, %a1                      /* Get end of bss */
140         clr.l   %d0                             /* Set value */
141 _clear_bss:
142         move.l  %d0, (%a0)+                     /* Clear each word */
143         cmp.l   %a0, %a1                        /* Check if at end */
144         bne     _clear_bss
145
146         /*
147          *      Load the current task pointer and stack.
148          */
149         lea     init_thread_union, %a0
150         lea     0x2000(%a0), %sp
151
152         /*
153          *      Assember start up done, start code proper.
154          */
155         jsr     start_kernel                    /* Start Linux kernel */
156
157 _exit:
158         jmp     _exit                           /* Should never get here */
159
160 /*****************************************************************************/