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