Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
[linux-2.6] / arch / ppc / syslib / mpc85xx_devices.c
1 /*
2  * arch/ppc/platforms/85xx/mpc85xx_devices.c
3  *
4  * MPC85xx Device descriptions
5  *
6  * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7  *
8  * Copyright 2005 Freescale Semiconductor Inc.
9  *
10  * This program is free software; you can redistribute  it and/or modify it
11  * under  the terms of  the GNU General  Public License as published by the
12  * Free Software Foundation;  either version 2 of the  License, or (at your
13  * option) any later version.
14  */
15
16 #include <linux/init.h>
17 #include <linux/module.h>
18 #include <linux/device.h>
19 #include <linux/serial_8250.h>
20 #include <linux/fsl_devices.h>
21 #include <asm/mpc85xx.h>
22 #include <asm/irq.h>
23 #include <asm/ppc_sys.h>
24
25 /* We use offsets for IORESOURCE_MEM since we do not know at compile time
26  * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup
27  */
28
29 static struct gianfar_platform_data mpc85xx_tsec1_pdata = {
30         .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
31             FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
32             FSL_GIANFAR_DEV_HAS_MULTI_INTR,
33         .phy_reg_addr = MPC85xx_ENET1_OFFSET,
34 };
35
36 static struct gianfar_platform_data mpc85xx_tsec2_pdata = {
37         .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
38             FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
39             FSL_GIANFAR_DEV_HAS_MULTI_INTR,
40         .phy_reg_addr = MPC85xx_ENET1_OFFSET,
41 };
42
43 static struct gianfar_platform_data mpc85xx_fec_pdata = {
44         .phy_reg_addr = MPC85xx_ENET1_OFFSET,
45 };
46
47 static struct fsl_i2c_platform_data mpc85xx_fsl_i2c_pdata = {
48         .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
49 };
50
51 static struct plat_serial8250_port serial_platform_data[] = {
52         [0] = {
53                 .mapbase        = 0x4500,
54                 .irq            = MPC85xx_IRQ_DUART,
55                 .iotype         = UPIO_MEM,
56                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ,
57         },
58         [1] = {
59                 .mapbase        = 0x4600,
60                 .irq            = MPC85xx_IRQ_DUART,
61                 .iotype         = UPIO_MEM,
62                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ,
63         },
64         { },
65 };
66
67 struct platform_device ppc_sys_platform_devices[] = {
68         [MPC85xx_TSEC1] = {
69                 .name = "fsl-gianfar",
70                 .id     = 1,
71                 .dev.platform_data = &mpc85xx_tsec1_pdata,
72                 .num_resources   = 4,
73                 .resource = (struct resource[]) {
74                         {
75                                 .start  = MPC85xx_ENET1_OFFSET,
76                                 .end    = MPC85xx_ENET1_OFFSET +
77                                                 MPC85xx_ENET1_SIZE - 1,
78                                 .flags  = IORESOURCE_MEM,
79                         },
80                         {
81                                 .name   = "tx",
82                                 .start  = MPC85xx_IRQ_TSEC1_TX,
83                                 .end    = MPC85xx_IRQ_TSEC1_TX,
84                                 .flags  = IORESOURCE_IRQ,
85                         },
86                         {
87                                 .name   = "rx",
88                                 .start  = MPC85xx_IRQ_TSEC1_RX,
89                                 .end    = MPC85xx_IRQ_TSEC1_RX,
90                                 .flags  = IORESOURCE_IRQ,
91                         },
92                         {
93                                 .name   = "error",
94                                 .start  = MPC85xx_IRQ_TSEC1_ERROR,
95                                 .end    = MPC85xx_IRQ_TSEC1_ERROR,
96                                 .flags  = IORESOURCE_IRQ,
97                         },
98                 },
99         },
100         [MPC85xx_TSEC2] = {
101                 .name = "fsl-gianfar",
102                 .id     = 2,
103                 .dev.platform_data = &mpc85xx_tsec2_pdata,
104                 .num_resources   = 4,
105                 .resource = (struct resource[]) {
106                         {
107                                 .start  = MPC85xx_ENET2_OFFSET,
108                                 .end    = MPC85xx_ENET2_OFFSET +
109                                                 MPC85xx_ENET2_SIZE - 1,
110                                 .flags  = IORESOURCE_MEM,
111                         },
112                         {
113                                 .name   = "tx",
114                                 .start  = MPC85xx_IRQ_TSEC2_TX,
115                                 .end    = MPC85xx_IRQ_TSEC2_TX,
116                                 .flags  = IORESOURCE_IRQ,
117                         },
118                         {
119                                 .name   = "rx",
120                                 .start  = MPC85xx_IRQ_TSEC2_RX,
121                                 .end    = MPC85xx_IRQ_TSEC2_RX,
122                                 .flags  = IORESOURCE_IRQ,
123                         },
124                         {
125                                 .name   = "error",
126                                 .start  = MPC85xx_IRQ_TSEC2_ERROR,
127                                 .end    = MPC85xx_IRQ_TSEC2_ERROR,
128                                 .flags  = IORESOURCE_IRQ,
129                         },
130                 },
131         },
132         [MPC85xx_FEC] = {
133                 .name = "fsl-gianfar",
134                 .id     = 3,
135                 .dev.platform_data = &mpc85xx_fec_pdata,
136                 .num_resources   = 2,
137                 .resource = (struct resource[]) {
138                         {
139                                 .start  = MPC85xx_ENET3_OFFSET,
140                                 .end    = MPC85xx_ENET3_OFFSET +
141                                                 MPC85xx_ENET3_SIZE - 1,
142                                 .flags  = IORESOURCE_MEM,
143
144                         },
145                         {
146                                 .start  = MPC85xx_IRQ_FEC,
147                                 .end    = MPC85xx_IRQ_FEC,
148                                 .flags  = IORESOURCE_IRQ,
149                         },
150                 },
151         },
152         [MPC85xx_IIC1] = {
153                 .name = "fsl-i2c",
154                 .id     = 1,
155                 .dev.platform_data = &mpc85xx_fsl_i2c_pdata,
156                 .num_resources   = 2,
157                 .resource = (struct resource[]) {
158                         {
159                                 .start  = MPC85xx_IIC1_OFFSET,
160                                 .end    = MPC85xx_IIC1_OFFSET +
161                                                 MPC85xx_IIC1_SIZE - 1,
162                                 .flags  = IORESOURCE_MEM,
163                         },
164                         {
165                                 .start  = MPC85xx_IRQ_IIC1,
166                                 .end    = MPC85xx_IRQ_IIC1,
167                                 .flags  = IORESOURCE_IRQ,
168                         },
169                 },
170         },
171         [MPC85xx_DMA0] = {
172                 .name = "fsl-dma",
173                 .id     = 0,
174                 .num_resources   = 2,
175                 .resource = (struct resource[]) {
176                         {
177                                 .start  = MPC85xx_DMA0_OFFSET,
178                                 .end    = MPC85xx_DMA0_OFFSET +
179                                                 MPC85xx_DMA0_SIZE - 1,
180                                 .flags  = IORESOURCE_MEM,
181                         },
182                         {
183                                 .start  = MPC85xx_IRQ_DMA0,
184                                 .end    = MPC85xx_IRQ_DMA0,
185                                 .flags  = IORESOURCE_IRQ,
186                         },
187                 },
188         },
189         [MPC85xx_DMA1] = {
190                 .name = "fsl-dma",
191                 .id     = 1,
192                 .num_resources   = 2,
193                 .resource = (struct resource[]) {
194                         {
195                                 .start  = MPC85xx_DMA1_OFFSET,
196                                 .end    = MPC85xx_DMA1_OFFSET +
197                                                 MPC85xx_DMA1_SIZE - 1,
198                                 .flags  = IORESOURCE_MEM,
199                         },
200                         {
201                                 .start  = MPC85xx_IRQ_DMA1,
202                                 .end    = MPC85xx_IRQ_DMA1,
203                                 .flags  = IORESOURCE_IRQ,
204                         },
205                 },
206         },
207         [MPC85xx_DMA2] = {
208                 .name = "fsl-dma",
209                 .id     = 2,
210                 .num_resources   = 2,
211                 .resource = (struct resource[]) {
212                         {
213                                 .start  = MPC85xx_DMA2_OFFSET,
214                                 .end    = MPC85xx_DMA2_OFFSET +
215                                                 MPC85xx_DMA2_SIZE - 1,
216                                 .flags  = IORESOURCE_MEM,
217                         },
218                         {
219                                 .start  = MPC85xx_IRQ_DMA2,
220                                 .end    = MPC85xx_IRQ_DMA2,
221                                 .flags  = IORESOURCE_IRQ,
222                         },
223                 },
224         },
225         [MPC85xx_DMA3] = {
226                 .name = "fsl-dma",
227                 .id     = 3,
228                 .num_resources   = 2,
229                 .resource = (struct resource[]) {
230                         {
231                                 .start  = MPC85xx_DMA3_OFFSET,
232                                 .end    = MPC85xx_DMA3_OFFSET +
233                                                 MPC85xx_DMA3_SIZE - 1,
234                                 .flags  = IORESOURCE_MEM,
235                         },
236                         {
237                                 .start  = MPC85xx_IRQ_DMA3,
238                                 .end    = MPC85xx_IRQ_DMA3,
239                                 .flags  = IORESOURCE_IRQ,
240                         },
241                 },
242         },
243         [MPC85xx_DUART] = {
244                 .name = "serial8250",
245                 .id     = 0,
246                 .dev.platform_data = serial_platform_data,
247         },
248         [MPC85xx_PERFMON] = {
249                 .name = "fsl-perfmon",
250                 .id     = 1,
251                 .num_resources   = 2,
252                 .resource = (struct resource[]) {
253                         {
254                                 .start  = MPC85xx_PERFMON_OFFSET,
255                                 .end    = MPC85xx_PERFMON_OFFSET +
256                                                 MPC85xx_PERFMON_SIZE - 1,
257                                 .flags  = IORESOURCE_MEM,
258                         },
259                         {
260                                 .start  = MPC85xx_IRQ_PERFMON,
261                                 .end    = MPC85xx_IRQ_PERFMON,
262                                 .flags  = IORESOURCE_IRQ,
263                         },
264                 },
265         },
266         [MPC85xx_SEC2] = {
267                 .name = "fsl-sec2",
268                 .id     = 1,
269                 .num_resources   = 2,
270                 .resource = (struct resource[]) {
271                         {
272                                 .start  = MPC85xx_SEC2_OFFSET,
273                                 .end    = MPC85xx_SEC2_OFFSET +
274                                                 MPC85xx_SEC2_SIZE - 1,
275                                 .flags  = IORESOURCE_MEM,
276                         },
277                         {
278                                 .start  = MPC85xx_IRQ_SEC2,
279                                 .end    = MPC85xx_IRQ_SEC2,
280                                 .flags  = IORESOURCE_IRQ,
281                         },
282                 },
283         },
284 #ifdef CONFIG_CPM2
285         [MPC85xx_CPM_FCC1] = {
286                 .name = "fsl-cpm-fcc",
287                 .id     = 1,
288                 .num_resources   = 3,
289                 .resource = (struct resource[]) {
290                         {
291                                 .start  = 0x91300,
292                                 .end    = 0x9131F,
293                                 .flags  = IORESOURCE_MEM,
294                         },
295                         {
296                                 .start  = 0x91380,
297                                 .end    = 0x9139F,
298                                 .flags  = IORESOURCE_MEM,
299                         },
300                         {
301                                 .start  = SIU_INT_FCC1,
302                                 .end    = SIU_INT_FCC1,
303                                 .flags  = IORESOURCE_IRQ,
304                         },
305                 },
306         },
307         [MPC85xx_CPM_FCC2] = {
308                 .name = "fsl-cpm-fcc",
309                 .id     = 2,
310                 .num_resources   = 3,
311                 .resource = (struct resource[]) {
312                         {
313                                 .start  = 0x91320,
314                                 .end    = 0x9133F,
315                                 .flags  = IORESOURCE_MEM,
316                         },
317                         {
318                                 .start  = 0x913A0,
319                                 .end    = 0x913CF,
320                                 .flags  = IORESOURCE_MEM,
321                         },
322                         {
323                                 .start  = SIU_INT_FCC2,
324                                 .end    = SIU_INT_FCC2,
325                                 .flags  = IORESOURCE_IRQ,
326                         },
327                 },
328         },
329         [MPC85xx_CPM_FCC3] = {
330                 .name = "fsl-cpm-fcc",
331                 .id     = 3,
332                 .num_resources   = 3,
333                 .resource = (struct resource[]) {
334                         {
335                                 .start  = 0x91340,
336                                 .end    = 0x9135F,
337                                 .flags  = IORESOURCE_MEM,
338                         },
339                         {
340                                 .start  = 0x913D0,
341                                 .end    = 0x913FF,
342                                 .flags  = IORESOURCE_MEM,
343                         },
344                         {
345                                 .start  = SIU_INT_FCC3,
346                                 .end    = SIU_INT_FCC3,
347                                 .flags  = IORESOURCE_IRQ,
348                         },
349                 },
350         },
351         [MPC85xx_CPM_I2C] = {
352                 .name = "fsl-cpm-i2c",
353                 .id     = 1,
354                 .num_resources   = 2,
355                 .resource = (struct resource[]) {
356                         {
357                                 .start  = 0x91860,
358                                 .end    = 0x918BF,
359                                 .flags  = IORESOURCE_MEM,
360                         },
361                         {
362                                 .start  = SIU_INT_I2C,
363                                 .end    = SIU_INT_I2C,
364                                 .flags  = IORESOURCE_IRQ,
365                         },
366                 },
367         },
368         [MPC85xx_CPM_SCC1] = {
369                 .name = "fsl-cpm-scc",
370                 .id     = 1,
371                 .num_resources   = 2,
372                 .resource = (struct resource[]) {
373                         {
374                                 .start  = 0x91A00,
375                                 .end    = 0x91A1F,
376                                 .flags  = IORESOURCE_MEM,
377                         },
378                         {
379                                 .start  = SIU_INT_SCC1,
380                                 .end    = SIU_INT_SCC1,
381                                 .flags  = IORESOURCE_IRQ,
382                         },
383                 },
384         },
385         [MPC85xx_CPM_SCC2] = {
386                 .name = "fsl-cpm-scc",
387                 .id     = 2,
388                 .num_resources   = 2,
389                 .resource = (struct resource[]) {
390                         {
391                                 .start  = 0x91A20,
392                                 .end    = 0x91A3F,
393                                 .flags  = IORESOURCE_MEM,
394                         },
395                         {
396                                 .start  = SIU_INT_SCC2,
397                                 .end    = SIU_INT_SCC2,
398                                 .flags  = IORESOURCE_IRQ,
399                         },
400                 },
401         },
402         [MPC85xx_CPM_SCC3] = {
403                 .name = "fsl-cpm-scc",
404                 .id     = 3,
405                 .num_resources   = 2,
406                 .resource = (struct resource[]) {
407                         {
408                                 .start  = 0x91A40,
409                                 .end    = 0x91A5F,
410                                 .flags  = IORESOURCE_MEM,
411                         },
412                         {
413                                 .start  = SIU_INT_SCC3,
414                                 .end    = SIU_INT_SCC3,
415                                 .flags  = IORESOURCE_IRQ,
416                         },
417                 },
418         },
419         [MPC85xx_CPM_SCC4] = {
420                 .name = "fsl-cpm-scc",
421                 .id     = 4,
422                 .num_resources   = 2,
423                 .resource = (struct resource[]) {
424                         {
425                                 .start  = 0x91A60,
426                                 .end    = 0x91A7F,
427                                 .flags  = IORESOURCE_MEM,
428                         },
429                         {
430                                 .start  = SIU_INT_SCC4,
431                                 .end    = SIU_INT_SCC4,
432                                 .flags  = IORESOURCE_IRQ,
433                         },
434                 },
435         },
436         [MPC85xx_CPM_SPI] = {
437                 .name = "fsl-cpm-spi",
438                 .id     = 1,
439                 .num_resources   = 2,
440                 .resource = (struct resource[]) {
441                         {
442                                 .start  = 0x91AA0,
443                                 .end    = 0x91AFF,
444                                 .flags  = IORESOURCE_MEM,
445                         },
446                         {
447                                 .start  = SIU_INT_SPI,
448                                 .end    = SIU_INT_SPI,
449                                 .flags  = IORESOURCE_IRQ,
450                         },
451                 },
452         },
453         [MPC85xx_CPM_MCC1] = {
454                 .name = "fsl-cpm-mcc",
455                 .id     = 1,
456                 .num_resources   = 2,
457                 .resource = (struct resource[]) {
458                         {
459                                 .start  = 0x91B30,
460                                 .end    = 0x91B3F,
461                                 .flags  = IORESOURCE_MEM,
462                         },
463                         {
464                                 .start  = SIU_INT_MCC1,
465                                 .end    = SIU_INT_MCC1,
466                                 .flags  = IORESOURCE_IRQ,
467                         },
468                 },
469         },
470         [MPC85xx_CPM_MCC2] = {
471                 .name = "fsl-cpm-mcc",
472                 .id     = 2,
473                 .num_resources   = 2,
474                 .resource = (struct resource[]) {
475                         {
476                                 .start  = 0x91B50,
477                                 .end    = 0x91B5F,
478                                 .flags  = IORESOURCE_MEM,
479                         },
480                         {
481                                 .start  = SIU_INT_MCC2,
482                                 .end    = SIU_INT_MCC2,
483                                 .flags  = IORESOURCE_IRQ,
484                         },
485                 },
486         },
487         [MPC85xx_CPM_SMC1] = {
488                 .name = "fsl-cpm-smc",
489                 .id     = 1,
490                 .num_resources   = 2,
491                 .resource = (struct resource[]) {
492                         {
493                                 .start  = 0x91A80,
494                                 .end    = 0x91A8F,
495                                 .flags  = IORESOURCE_MEM,
496                         },
497                         {
498                                 .start  = SIU_INT_SMC1,
499                                 .end    = SIU_INT_SMC1,
500                                 .flags  = IORESOURCE_IRQ,
501                         },
502                 },
503         },
504         [MPC85xx_CPM_SMC2] = {
505                 .name = "fsl-cpm-smc",
506                 .id     = 2,
507                 .num_resources   = 2,
508                 .resource = (struct resource[]) {
509                         {
510                                 .start  = 0x91A90,
511                                 .end    = 0x91A9F,
512                                 .flags  = IORESOURCE_MEM,
513                         },
514                         {
515                                 .start  = SIU_INT_SMC2,
516                                 .end    = SIU_INT_SMC2,
517                                 .flags  = IORESOURCE_IRQ,
518                         },
519                 },
520         },
521         [MPC85xx_CPM_USB] = {
522                 .name = "fsl-cpm-usb",
523                 .id     = 2,
524                 .num_resources   = 2,
525                 .resource = (struct resource[]) {
526                         {
527                                 .start  = 0x91B60,
528                                 .end    = 0x91B7F,
529                                 .flags  = IORESOURCE_MEM,
530                         },
531                         {
532                                 .start  = SIU_INT_USB,
533                                 .end    = SIU_INT_USB,
534                                 .flags  = IORESOURCE_IRQ,
535                         },
536                 },
537         },
538 #endif /* CONFIG_CPM2 */
539 };
540
541 static int __init mach_mpc85xx_fixup(struct platform_device *pdev)
542 {
543         ppc_sys_fixup_mem_resource(pdev, CCSRBAR);
544         return 0;
545 }
546
547 static int __init mach_mpc85xx_init(void)
548 {
549         ppc_sys_device_fixup = mach_mpc85xx_fixup;
550         return 0;
551 }
552
553 postcore_initcall(mach_mpc85xx_init);