linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / ppc / syslib / mpc83xx_devices.c
1 /*
2  * arch/ppc/platforms/83xx/mpc83xx_devices.c
3  *
4  * MPC83xx Device descriptions
5  *
6  * Maintainer: Kumar Gala <galak@kernel.crashing.org>
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/mpc83xx.h>
22 #include <asm/irq.h>
23 #include <asm/ppc_sys.h>
24 #include <asm/machdep.h>
25
26 /* We use offsets for IORESOURCE_MEM since we do not know at compile time
27  * what IMMRBAR is, will get fixed up by mach_mpc83xx_fixup
28  */
29
30 struct gianfar_mdio_data mpc83xx_mdio_pdata = {
31 };
32
33 static struct gianfar_platform_data mpc83xx_tsec1_pdata = {
34         .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
35             FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
36             FSL_GIANFAR_DEV_HAS_MULTI_INTR,
37 };
38
39 static struct gianfar_platform_data mpc83xx_tsec2_pdata = {
40         .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
41             FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
42             FSL_GIANFAR_DEV_HAS_MULTI_INTR,
43 };
44
45 static struct fsl_i2c_platform_data mpc83xx_fsl_i2c1_pdata = {
46         .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
47 };
48
49 static struct fsl_i2c_platform_data mpc83xx_fsl_i2c2_pdata = {
50         .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
51 };
52
53 static struct plat_serial8250_port serial_platform_data[] = {
54         [0] = {
55                 .mapbase        = 0x4500,
56                 .irq            = MPC83xx_IRQ_UART1,
57                 .iotype         = UPIO_MEM,
58                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
59         },
60         [1] = {
61                 .mapbase        = 0x4600,
62                 .irq            = MPC83xx_IRQ_UART2,
63                 .iotype         = UPIO_MEM,
64                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
65         },
66         { },
67 };
68
69 struct platform_device ppc_sys_platform_devices[] = {
70         [MPC83xx_TSEC1] = {
71                 .name = "fsl-gianfar",
72                 .id     = 1,
73                 .dev.platform_data = &mpc83xx_tsec1_pdata,
74                 .num_resources   = 4,
75                 .resource = (struct resource[]) {
76                         {
77                                 .start  = 0x24000,
78                                 .end    = 0x24fff,
79                                 .flags  = IORESOURCE_MEM,
80                         },
81                         {
82                                 .name   = "tx",
83                                 .start  = MPC83xx_IRQ_TSEC1_TX,
84                                 .end    = MPC83xx_IRQ_TSEC1_TX,
85                                 .flags  = IORESOURCE_IRQ,
86                         },
87                         {
88                                 .name   = "rx",
89                                 .start  = MPC83xx_IRQ_TSEC1_RX,
90                                 .end    = MPC83xx_IRQ_TSEC1_RX,
91                                 .flags  = IORESOURCE_IRQ,
92                         },
93                         {
94                                 .name   = "error",
95                                 .start  = MPC83xx_IRQ_TSEC1_ERROR,
96                                 .end    = MPC83xx_IRQ_TSEC1_ERROR,
97                                 .flags  = IORESOURCE_IRQ,
98                         },
99                 },
100         },
101         [MPC83xx_TSEC2] = {
102                 .name = "fsl-gianfar",
103                 .id     = 2,
104                 .dev.platform_data = &mpc83xx_tsec2_pdata,
105                 .num_resources   = 4,
106                 .resource = (struct resource[]) {
107                         {
108                                 .start  = 0x25000,
109                                 .end    = 0x25fff,
110                                 .flags  = IORESOURCE_MEM,
111                         },
112                         {
113                                 .name   = "tx",
114                                 .start  = MPC83xx_IRQ_TSEC2_TX,
115                                 .end    = MPC83xx_IRQ_TSEC2_TX,
116                                 .flags  = IORESOURCE_IRQ,
117                         },
118                         {
119                                 .name   = "rx",
120                                 .start  = MPC83xx_IRQ_TSEC2_RX,
121                                 .end    = MPC83xx_IRQ_TSEC2_RX,
122                                 .flags  = IORESOURCE_IRQ,
123                         },
124                         {
125                                 .name   = "error",
126                                 .start  = MPC83xx_IRQ_TSEC2_ERROR,
127                                 .end    = MPC83xx_IRQ_TSEC2_ERROR,
128                                 .flags  = IORESOURCE_IRQ,
129                         },
130                 },
131         },
132         [MPC83xx_IIC1] = {
133                 .name = "fsl-i2c",
134                 .id     = 1,
135                 .dev.platform_data = &mpc83xx_fsl_i2c1_pdata,
136                 .num_resources   = 2,
137                 .resource = (struct resource[]) {
138                         {
139                                 .start  = 0x3000,
140                                 .end    = 0x30ff,
141                                 .flags  = IORESOURCE_MEM,
142                         },
143                         {
144                                 .start  = MPC83xx_IRQ_IIC1,
145                                 .end    = MPC83xx_IRQ_IIC1,
146                                 .flags  = IORESOURCE_IRQ,
147                         },
148                 },
149         },
150         [MPC83xx_IIC2] = {
151                 .name = "fsl-i2c",
152                 .id     = 2,
153                 .dev.platform_data = &mpc83xx_fsl_i2c2_pdata,
154                 .num_resources   = 2,
155                 .resource = (struct resource[]) {
156                         {
157                                 .start  = 0x3100,
158                                 .end    = 0x31ff,
159                                 .flags  = IORESOURCE_MEM,
160                         },
161                         {
162                                 .start  = MPC83xx_IRQ_IIC2,
163                                 .end    = MPC83xx_IRQ_IIC2,
164                                 .flags  = IORESOURCE_IRQ,
165                         },
166                 },
167         },
168         [MPC83xx_DUART] = {
169                 .name = "serial8250",
170                 .id     = PLAT8250_DEV_PLATFORM,
171                 .dev.platform_data = serial_platform_data,
172         },
173         [MPC83xx_SEC2] = {
174                 .name = "fsl-sec2",
175                 .id     = 1,
176                 .num_resources   = 2,
177                 .resource = (struct resource[]) {
178                         {
179                                 .start  = 0x30000,
180                                 .end    = 0x3ffff,
181                                 .flags  = IORESOURCE_MEM,
182                         },
183                         {
184                                 .start  = MPC83xx_IRQ_SEC2,
185                                 .end    = MPC83xx_IRQ_SEC2,
186                                 .flags  = IORESOURCE_IRQ,
187                         },
188                 },
189         },
190         [MPC83xx_USB2_DR] = {
191                 .name = "fsl-usb2-dr",
192                 .id     = 1,
193                 .num_resources   = 2,
194                 .resource = (struct resource[]) {
195                         {
196                                 .start  = 0x23000,
197                                 .end    = 0x23fff,
198                                 .flags  = IORESOURCE_MEM,
199                         },
200                         {
201                                 .start  = MPC83xx_IRQ_USB2_DR,
202                                 .end    = MPC83xx_IRQ_USB2_DR,
203                                 .flags  = IORESOURCE_IRQ,
204                         },
205                 },
206         },
207         [MPC83xx_USB2_MPH] = {
208                 .name = "fsl-usb2-mph",
209                 .id     = 1,
210                 .num_resources   = 2,
211                 .resource = (struct resource[]) {
212                         {
213                                 .start  = 0x22000,
214                                 .end    = 0x22fff,
215                                 .flags  = IORESOURCE_MEM,
216                         },
217                         {
218                                 .start  = MPC83xx_IRQ_USB2_MPH,
219                                 .end    = MPC83xx_IRQ_USB2_MPH,
220                                 .flags  = IORESOURCE_IRQ,
221                         },
222                 },
223         },
224         [MPC83xx_MDIO] = {
225                 .name = "fsl-gianfar_mdio",
226                 .id = 0,
227                 .dev.platform_data = &mpc83xx_mdio_pdata,
228                 .num_resources = 1,
229                 .resource = (struct resource[]) {
230                         {
231                                 .start  = 0x24520,
232                                 .end    = 0x2453f,
233                                 .flags  = IORESOURCE_MEM,
234                         },
235                 },
236         },
237 };
238
239 static int __init mach_mpc83xx_fixup(struct platform_device *pdev)
240 {
241         ppc_sys_fixup_mem_resource(pdev, immrbar);
242         return 0;
243 }
244
245 static int __init mach_mpc83xx_init(void)
246 {
247         if (ppc_md.progress)
248                 ppc_md.progress("mach_mpc83xx_init:enter", 0);
249         ppc_sys_device_fixup = mach_mpc83xx_fixup;
250         return 0;
251 }
252
253 postcore_initcall(mach_mpc83xx_init);