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