ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / m68knommu / platform / 68EZ328 / ucsimm / crt0_ram.S
1         .global __main
2         .global __ram_start
3         .global __ram_end
4         .global __rom_start
5         .global __rom_end
6
7         .global _rambase
8         .global _ramstart
9         
10         .global splash_bits
11         .global _start
12         .global _stext
13
14 #define DEBUG
15 #define ROM_OFFSET 0x10C00000
16 #define STACK_GAURD 0x10
17
18         .text
19         
20 _start:
21 _stext:
22         movew   #0x2700, %sr            /* Exceptions off! */
23
24         /* Init chip registers.  uCsimm specific */
25         moveb   #0x00,   0xfffffb0b     /* Watchdog off */
26         moveb   #0x10,   0xfffff000     /* SCR */
27
28         movew   #0x2400, 0xfffff200     /* PLLCR */
29         movew   #0x0123, 0xfffff202     /* PLLFSR */
30
31         moveb   #0x00,   0xfffff40b     /* enable chip select */
32         moveb   #0x00,   0xfffff423     /* enable /DWE */
33         moveb   #0x08,   0xfffffd0d     /* disable hardmap */
34         moveb   #0x07,   0xfffffd0e     /* level 7 interrupt clear */
35
36         movew   #0x8600, 0xfffff100     /* FLASH at 0x10c00000 */
37         movew   #0x018b, 0xfffff110     /* 2Meg, enable, 0ws */
38
39         movew   #0x8f00, 0xfffffc00     /* DRAM configuration */
40         movew   #0x9667, 0xfffffc02     /* DRAM control */
41         movew   #0x0000, 0xfffff106     /* DRAM at 0x00000000 */
42         movew   #0x068f, 0xfffff116     /* 8Meg, enable, 0ws */
43
44         moveb   #0x40,   0xfffff300     /* IVR */
45         movel   #0x007FFFFF, %d0        /* IMR */
46         movel   %d0,     0xfffff304
47
48         moveb   0xfffff42b, %d0
49         andb    #0xe0,   %d0
50         moveb   %d0,     0xfffff42b
51
52         moveb   #0x08,   0xfffff907     /* Ignore CTS */
53         movew   #0x010b, 0xfffff902     /* BAUD to 9600 */
54         movew   #0xe100, 0xfffff900     /* enable */
55
56         movew   #16384, %d0  /* PLL settle wait loop */
57 L0:
58         subw    #1, %d0
59         bne     L0
60 #ifdef DEBUG
61         moveq   #70, %d7                /* 'F' */
62         moveb   %d7,0xfffff907          /* No absolute addresses */
63 pclp1:
64         movew   0xfffff906, %d7
65         andw    #0x2000, %d7
66         beq     pclp1
67 #endif /* DEBUG */
68
69 #ifdef CONFIG_RELOCATE
70         /* Copy me to RAM */
71         moveal  #__rom_start, %a0
72         moveal  #__ram_start, %a1
73         moveal  #_edata, %a2
74
75         /* Copy %a0 to %a1 until %a1 == %a2 */
76 LD1:
77         movel   %a0@+, %d0
78         movel   %d0, %a1@+
79         cmpal   %a1, %a2
80         bhi     LD1
81         
82 #ifdef DEBUG
83         moveq   #74, %d7                /* 'J' */
84         moveb   %d7,0xfffff907          /* No absolute addresses */
85 pclp2:
86         movew   0xfffff906, %d7
87         andw    #0x2000, %d7
88         beq     pclp2
89 #endif /* DEBUG */
90         /* jump into the RAM copy */
91         jmp     ram_jump
92 ram_jump:
93
94 #endif /* CONFIG_RELOCATE */
95
96 #ifdef DEBUG
97         moveq   #82, %d7                /* 'R' */
98         moveb   %d7,0xfffff907          /* No absolute addresses */
99 pclp3:
100         movew   0xfffff906, %d7
101         andw    #0x2000, %d7
102         beq     pclp3
103 #endif /* DEBUG */
104         moveal  #0x007ffff0, %ssp
105         moveal  #_sbss, %a0
106         moveal  #_ebss, %a1
107
108         /* Copy 0 to %a0 until %a0 >= %a1 */
109 L1:
110         movel   #0, %a0@+
111         cmpal   %a0, %a1
112         bhi     L1
113
114 #ifdef DEBUG
115         moveq   #67, %d7                /* 'C' */
116         jsr     putc
117 #endif /* DEBUG */
118
119         pea     0
120         pea     env
121         pea     %sp@(4)
122         pea     0
123
124 #ifdef DEBUG
125         moveq   #70, %d7                /* 'F' */
126         jsr     putc
127 #endif /* DEBUG */
128
129 lp:
130         jsr     start_kernel
131         jmp lp
132 _exit:
133
134         jmp     _exit
135
136 __main:
137         /* nothing */
138         rts
139
140 #ifdef DEBUG
141 putc:
142         moveb   %d7,0xfffff907
143 pclp:
144         movew   0xfffff906, %d7
145         andw    #0x2000, %d7
146         beq     pclp
147         rts
148 #endif /* DEBUG */
149
150         .data
151
152 /*
153  *      Set up the usable of RAM stuff. Size of RAM is determined then
154  *      an initial stack set up at the end.
155  */
156 .align 4
157 _ramvec:
158 .long   0
159 _rambase:
160 .long   0
161 _ramstart:
162 .long   0
163 _ramend:
164 .long   0
165
166 env:
167         .long   0