Merge branch 'master' of /home/sam/kernel/linux-2.6/
[pandora-kernel.git] / arch / m68knommu / platform / 68328 / head-ram.S
1
2         .global __main
3         .global __rom_start
4
5         .global _rambase
6         .global _ramstart
7         
8         .global splash_bits
9         .global _start
10         .global _stext
11         .global _edata
12
13 #define DEBUG
14 #define ROM_OFFSET 0x10C00000
15 #define STACK_GAURD 0x10
16
17         .text
18         
19 _start:
20 _stext:
21         movew   #0x2700, %sr            /* Exceptions off! */
22
23 #if 0
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 #endif
56
57         movew   #16384, %d0  /* PLL settle wait loop */
58 L0:
59         subw    #1, %d0
60         bne     L0
61 #ifdef DEBUG
62         moveq   #70, %d7                /* 'F' */
63         moveb   %d7,0xfffff907          /* No absolute addresses */
64 pclp1:
65         movew   0xfffff906, %d7
66         andw    #0x2000, %d7
67         beq     pclp1
68 #endif /* DEBUG */
69
70 #ifdef CONFIG_RELOCATE
71         /* Copy me to RAM */
72         moveal  #__rom_start, %a0
73         moveal  #_stext, %a1
74         moveal  #_edata, %a2
75
76         /* Copy %a0 to %a1 until %a1 == %a2 */
77 LD1:
78         movel   %a0@+, %d0
79         movel   %d0, %a1@+
80         cmpal   %a1, %a2
81         bhi     LD1
82         
83 #ifdef DEBUG
84         moveq   #74, %d7                /* 'J' */
85         moveb   %d7,0xfffff907          /* No absolute addresses */
86 pclp2:
87         movew   0xfffff906, %d7
88         andw    #0x2000, %d7
89         beq     pclp2
90 #endif /* DEBUG */
91         /* jump into the RAM copy */
92         jmp     ram_jump
93 ram_jump:
94
95 #endif /* CONFIG_RELOCATE */
96
97 #ifdef DEBUG
98         moveq   #82, %d7                /* 'R' */
99         moveb   %d7,0xfffff907          /* No absolute addresses */
100 pclp3:
101         movew   0xfffff906, %d7
102         andw    #0x2000, %d7
103         beq     pclp3
104 #endif /* DEBUG */
105         moveal  #0x007ffff0, %ssp
106         moveal  #_sbss, %a0
107         moveal  #_ebss, %a1
108
109         /* Copy 0 to %a0 until %a0 >= %a1 */
110 L1:
111         movel   #0, %a0@+
112         cmpal   %a0, %a1
113         bhi     L1
114
115 #ifdef DEBUG
116         moveq   #67, %d7                /* 'C' */
117         jsr     putc
118 #endif /* DEBUG */
119
120         pea     0
121         pea     env
122         pea     %sp@(4)
123         pea     0
124
125 #ifdef DEBUG
126         moveq   #70, %d7                /* 'F' */
127         jsr     putc
128 #endif /* DEBUG */
129
130 lp:
131         jsr     start_kernel
132         jmp lp
133 _exit:
134
135         jmp     _exit
136
137 __main:
138         /* nothing */
139         rts
140
141 #ifdef DEBUG
142 putc:
143         moveb   %d7,0xfffff907
144 pclp:
145         movew   0xfffff906, %d7
146         andw    #0x2000, %d7
147         beq     pclp
148         rts
149 #endif /* DEBUG */
150
151         .data
152
153 /*
154  *      Set up the usable of RAM stuff. Size of RAM is determined then
155  *      an initial stack set up at the end.
156  */
157 .align 4
158 _ramvec:
159 .long   0
160 _rambase:
161 .long   0
162 _ramstart:
163 .long   0
164 _ramend:
165 .long   0
166
167 env:
168         .long   0