1
2
3
4
5
6
7
8
9
10
11#ifndef m525xsim_h
12#define m525xsim_h
13
14
15
16
17
18
19
20#define CPU_NAME "COLDFIRE(m525x)"
21#define CPU_INSTR_PER_JIFFY 3
22#define MCF_BUSCLK (MCF_CLK / 2)
23
24#include <asm/m52xxacr.h>
25
26
27
28
29#define MCF_MBAR2 0x80000000
30
31
32
33
34#define MCFSIM_RSR (MCF_MBAR + 0x00)
35#define MCFSIM_SYPCR (MCF_MBAR + 0x01)
36#define MCFSIM_SWIVR (MCF_MBAR + 0x02)
37#define MCFSIM_SWSR (MCF_MBAR + 0x03)
38#define MCFSIM_MPARK (MCF_MBAR + 0x0C)
39#define MCFSIM_IPR (MCF_MBAR + 0x40)
40#define MCFSIM_IMR (MCF_MBAR + 0x44)
41#define MCFSIM_ICR0 (MCF_MBAR + 0x4c)
42#define MCFSIM_ICR1 (MCF_MBAR + 0x4d)
43#define MCFSIM_ICR2 (MCF_MBAR + 0x4e)
44#define MCFSIM_ICR3 (MCF_MBAR + 0x4f)
45#define MCFSIM_ICR4 (MCF_MBAR + 0x50)
46#define MCFSIM_ICR5 (MCF_MBAR + 0x51)
47#define MCFSIM_ICR6 (MCF_MBAR + 0x52)
48#define MCFSIM_ICR7 (MCF_MBAR + 0x53)
49#define MCFSIM_ICR8 (MCF_MBAR + 0x54)
50#define MCFSIM_ICR9 (MCF_MBAR + 0x55)
51#define MCFSIM_ICR10 (MCF_MBAR + 0x56)
52#define MCFSIM_ICR11 (MCF_MBAR + 0x57)
53
54#define MCFSIM_CSAR0 (MCF_MBAR + 0x80)
55#define MCFSIM_CSMR0 (MCF_MBAR + 0x84)
56#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a)
57#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c)
58#define MCFSIM_CSMR1 (MCF_MBAR + 0x90)
59#define MCFSIM_CSCR1 (MCF_MBAR + 0x96)
60#define MCFSIM_CSAR2 (MCF_MBAR + 0x98)
61#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c)
62#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2)
63#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4)
64#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8)
65#define MCFSIM_CSCR3 (MCF_MBAR + 0xae)
66#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0)
67#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4)
68#define MCFSIM_CSCR4 (MCF_MBAR + 0xba)
69
70#define MCFSIM_DCR (MCF_MBAR + 0x100)
71#define MCFSIM_DACR0 (MCF_MBAR + 0x108)
72#define MCFSIM_DMR0 (MCF_MBAR + 0x10c)
73#define MCFSIM_DACR1 (MCF_MBAR + 0x110)
74#define MCFSIM_DMR1 (MCF_MBAR + 0x114)
75
76
77
78
79#define MCFINTC2_INTBASE (MCF_MBAR2 + 0x168)
80#define MCFINTC2_INTPRI1 (MCF_MBAR2 + 0x140)
81#define MCFINTC2_INTPRI2 (MCF_MBAR2 + 0x144)
82#define MCFINTC2_INTPRI3 (MCF_MBAR2 + 0x148)
83#define MCFINTC2_INTPRI4 (MCF_MBAR2 + 0x14c)
84#define MCFINTC2_INTPRI5 (MCF_MBAR2 + 0x150)
85#define MCFINTC2_INTPRI6 (MCF_MBAR2 + 0x154)
86#define MCFINTC2_INTPRI7 (MCF_MBAR2 + 0x158)
87#define MCFINTC2_INTPRI8 (MCF_MBAR2 + 0x15c)
88
89#define MCFINTC2_INTPRI_REG(i) (MCFINTC2_INTPRI1 + \
90 ((((i) - MCFINTC2_VECBASE) / 8) * 4))
91#define MCFINTC2_INTPRI_BITS(b, i) ((b) << (((i) % 8) * 4))
92
93
94
95
96#define MCFTIMER_BASE1 (MCF_MBAR + 0x140)
97#define MCFTIMER_BASE2 (MCF_MBAR + 0x180)
98
99
100
101
102#define MCFUART_BASE0 (MCF_MBAR + 0x1c0)
103#define MCFUART_BASE1 (MCF_MBAR + 0x200)
104
105
106
107
108#define MCFQSPI_BASE (MCF_MBAR + 0x300)
109#define MCFQSPI_SIZE 0x40
110
111#ifdef CONFIG_M5249
112#define MCFQSPI_CS0 29
113#define MCFQSPI_CS1 24
114#define MCFQSPI_CS2 21
115#define MCFQSPI_CS3 22
116#else
117#define MCFQSPI_CS0 15
118#define MCFQSPI_CS1 16
119#define MCFQSPI_CS2 24
120#define MCFQSPI_CS3 28
121#endif
122
123
124
125
126#define MCFI2C_BASE0 (MCF_MBAR + 0x280)
127#define MCFI2C_SIZE0 0x20
128
129#define MCFI2C_BASE1 (MCF_MBAR2 + 0x440)
130#define MCFI2C_SIZE1 0x20
131
132
133
134
135#define MCFDMA_BASE0 (MCF_MBAR + 0x300)
136#define MCFDMA_BASE1 (MCF_MBAR + 0x340)
137#define MCFDMA_BASE2 (MCF_MBAR + 0x380)
138#define MCFDMA_BASE3 (MCF_MBAR + 0x3C0)
139
140
141
142
143#define MCFSIM_SWDICR MCFSIM_ICR0
144#define MCFSIM_TIMER1ICR MCFSIM_ICR1
145#define MCFSIM_TIMER2ICR MCFSIM_ICR2
146#define MCFSIM_I2CICR MCFSIM_ICR3
147#define MCFSIM_UART1ICR MCFSIM_ICR4
148#define MCFSIM_UART2ICR MCFSIM_ICR5
149#define MCFSIM_DMA0ICR MCFSIM_ICR6
150#define MCFSIM_DMA1ICR MCFSIM_ICR7
151#define MCFSIM_DMA2ICR MCFSIM_ICR8
152#define MCFSIM_DMA3ICR MCFSIM_ICR9
153#define MCFSIM_QSPIICR MCFSIM_ICR10
154
155
156
157
158#define MCF_IRQ_QSPI 28
159#define MCF_IRQ_I2C0 29
160#define MCF_IRQ_TIMER 30
161#define MCF_IRQ_PROFILER 31
162
163#define MCF_IRQ_UART0 73
164#define MCF_IRQ_UART1 74
165
166
167
168
169
170
171#define MCFINTC2_VECBASE 128
172
173#define MCF_IRQ_GPIO0 (MCFINTC2_VECBASE + 32)
174#define MCF_IRQ_GPIO1 (MCFINTC2_VECBASE + 33)
175#define MCF_IRQ_GPIO2 (MCFINTC2_VECBASE + 34)
176#define MCF_IRQ_GPIO3 (MCFINTC2_VECBASE + 35)
177#define MCF_IRQ_GPIO4 (MCFINTC2_VECBASE + 36)
178#define MCF_IRQ_GPIO5 (MCFINTC2_VECBASE + 37)
179#define MCF_IRQ_GPIO6 (MCFINTC2_VECBASE + 38)
180#define MCF_IRQ_GPIO7 (MCFINTC2_VECBASE + 39)
181
182#define MCF_IRQ_USBWUP (MCFINTC2_VECBASE + 40)
183#define MCF_IRQ_I2C1 (MCFINTC2_VECBASE + 62)
184
185
186
187
188#define MCFSIM2_GPIOREAD (MCF_MBAR2 + 0x000)
189#define MCFSIM2_GPIOWRITE (MCF_MBAR2 + 0x004)
190#define MCFSIM2_GPIOENABLE (MCF_MBAR2 + 0x008)
191#define MCFSIM2_GPIOFUNC (MCF_MBAR2 + 0x00C)
192#define MCFSIM2_GPIO1READ (MCF_MBAR2 + 0x0B0)
193#define MCFSIM2_GPIO1WRITE (MCF_MBAR2 + 0x0B4)
194#define MCFSIM2_GPIO1ENABLE (MCF_MBAR2 + 0x0B8)
195#define MCFSIM2_GPIO1FUNC (MCF_MBAR2 + 0x0BC)
196
197#define MCFSIM2_GPIOINTSTAT (MCF_MBAR2 + 0xc0)
198#define MCFSIM2_GPIOINTCLEAR (MCF_MBAR2 + 0xc0)
199#define MCFSIM2_GPIOINTENABLE (MCF_MBAR2 + 0xc4)
200
201#define MCFSIM2_DMAROUTE (MCF_MBAR2 + 0x188)
202#define MCFSIM2_IDECONFIG1 (MCF_MBAR2 + 0x18c)
203#define MCFSIM2_IDECONFIG2 (MCF_MBAR2 + 0x190)
204
205
206
207
208#define MCFGPIO_PIN_MAX 64
209#ifdef CONFIG_M5249
210#define MCFGPIO_IRQ_MAX -1
211#define MCFGPIO_IRQ_VECBASE -1
212#else
213#define MCFGPIO_IRQ_MAX 7
214#define MCFGPIO_IRQ_VECBASE MCF_IRQ_GPIO0
215#endif
216
217
218
219#ifdef __ASSEMBLER__
220#ifdef CONFIG_M5249C3
221
222
223
224
225
226.macro m5249c3_setup
227
228
229
230 movel #0x10000001,%a0
231 movec %a0,%MBAR
232 subql #1,%a0
233
234 movel #0x80000001,%a1
235 movec %a1,#3086
236 subql #1,%a1
237
238
239
240
241 moveb #MCFINTC2_VECBASE,%d0
242 moveb %d0,0x16b(%a1)
243
244
245
246
247 movel #0x001F0021,%d0
248 movel %d0,0x84(%a0)
249
250
251
252
253
254 movel 0x180(%a1),%d0
255 andl #0xfffffffe,%d0
256 movel %d0,0x180(%a1)
257 nop
258
259#if CONFIG_CLOCK_FREQ == 140000000
260
261
262
263
264
265 movel #0x125a40f0,%d0
266 movel %d0,0x180(%a1)
267 orl #0x1,%d0
268 movel %d0,0x180(%a1)
269#endif
270
271
272
273
274
275 movel #0xe0000000,%d0
276 movel %d0,0x8c(%a0)
277 movel #0x001f0021,%d0
278 movel %d0,0x90(%a0)
279 movew #0x0080,%d0
280 movew %d0,0x96(%a0)
281
282
283
284
285 movel #0x50000000,%d0
286 movel %d0,0x98(%a0)
287 movel #0x001f0001,%d0
288 movel %d0,0x9c(%a0)
289 movew #0x0080,%d0
290 movew %d0,0xa2(%a0)
291
292 movel #0x00107000,%d0
293 movel %d0,0x18c(%a1)
294 movel #0x000c0400,%d0
295 movel %d0,0x190(%a1)
296
297 movel #0x00080000,%d0
298 orl %d0,0xc(%a1)
299 orl %d0,0x8(%a1)
300 orl %d0,0x4(%a1)
301.endm
302
303#define PLATFORM_SETUP m5249c3_setup
304
305#endif
306#endif
307
308#endif
309