Merge branch 'sh/dwarf-unwinder'
[pandora-kernel.git] / arch / arm / mach-mx25 / devices.c
1 #include <linux/platform_device.h>
2 #include <linux/gpio.h>
3 #include <mach/mx25.h>
4 #include <mach/irqs.h>
5
6 static struct resource uart0[] = {
7         {
8                 .start = 0x43f90000,
9                 .end = 0x43f93fff,
10                 .flags = IORESOURCE_MEM,
11         }, {
12                 .start = 45,
13                 .end = 45,
14                 .flags = IORESOURCE_IRQ,
15         },
16 };
17
18 struct platform_device mxc_uart_device0 = {
19         .name = "imx-uart",
20         .id = 0,
21         .resource = uart0,
22         .num_resources = ARRAY_SIZE(uart0),
23 };
24
25 static struct resource uart1[] = {
26         {
27                 .start = 0x43f94000,
28                 .end = 0x43f97fff,
29                 .flags = IORESOURCE_MEM,
30         }, {
31                 .start = 32,
32                 .end = 32,
33                 .flags = IORESOURCE_IRQ,
34         },
35 };
36
37 struct platform_device mxc_uart_device1 = {
38         .name = "imx-uart",
39         .id = 1,
40         .resource = uart1,
41         .num_resources = ARRAY_SIZE(uart1),
42 };
43
44 static struct resource uart2[] = {
45         {
46                 .start = 0x5000c000,
47                 .end = 0x5000ffff,
48                 .flags = IORESOURCE_MEM,
49         }, {
50                 .start = 18,
51                 .end = 18,
52                 .flags = IORESOURCE_IRQ,
53         },
54 };
55
56 struct platform_device mxc_uart_device2 = {
57         .name = "imx-uart",
58         .id = 2,
59         .resource = uart2,
60         .num_resources = ARRAY_SIZE(uart2),
61 };
62
63 static struct resource uart3[] = {
64         {
65                 .start = 0x50008000,
66                 .end = 0x5000bfff,
67                 .flags = IORESOURCE_MEM,
68         }, {
69                 .start = 5,
70                 .end = 5,
71                 .flags = IORESOURCE_IRQ,
72         },
73 };
74
75 struct platform_device mxc_uart_device3 = {
76         .name = "imx-uart",
77         .id = 3,
78         .resource = uart3,
79         .num_resources = ARRAY_SIZE(uart3),
80 };
81
82 static struct resource uart4[] = {
83         {
84                 .start = 0x5002c000,
85                 .end = 0x5002ffff,
86                 .flags = IORESOURCE_MEM,
87         }, {
88                 .start = 40,
89                 .end = 40,
90                 .flags = IORESOURCE_IRQ,
91         },
92 };
93
94 struct platform_device mxc_uart_device4 = {
95         .name = "imx-uart",
96         .id = 4,
97         .resource = uart4,
98         .num_resources = ARRAY_SIZE(uart4),
99 };
100
101 #define MX25_OTG_BASE_ADDR 0x53FF4000
102
103 static u64 otg_dmamask = DMA_BIT_MASK(32);
104
105 static struct resource mxc_otg_resources[] = {
106         {
107                 .start = MX25_OTG_BASE_ADDR,
108                 .end = MX25_OTG_BASE_ADDR + 0x1ff,
109                 .flags = IORESOURCE_MEM,
110         }, {
111                 .start = 37,
112                 .end = 37,
113                 .flags = IORESOURCE_IRQ,
114         },
115 };
116
117 struct platform_device mxc_otg = {
118         .name = "mxc-ehci",
119         .id = 0,
120         .dev = {
121                 .coherent_dma_mask = 0xffffffff,
122                 .dma_mask = &otg_dmamask,
123         },
124         .resource = mxc_otg_resources,
125         .num_resources = ARRAY_SIZE(mxc_otg_resources),
126 };
127
128 /* OTG gadget device */
129 struct platform_device otg_udc_device = {
130         .name = "fsl-usb2-udc",
131         .id   = -1,
132         .dev  = {
133                 .dma_mask          = &otg_dmamask,
134                 .coherent_dma_mask = 0xffffffff,
135         },
136         .resource = mxc_otg_resources,
137         .num_resources = ARRAY_SIZE(mxc_otg_resources),
138 };
139
140 static u64 usbh2_dmamask = DMA_BIT_MASK(32);
141
142 static struct resource mxc_usbh2_resources[] = {
143         {
144                 .start = MX25_OTG_BASE_ADDR + 0x400,
145                 .end = MX25_OTG_BASE_ADDR + 0x5ff,
146                 .flags = IORESOURCE_MEM,
147         }, {
148                 .start = 35,
149                 .end = 35,
150                 .flags = IORESOURCE_IRQ,
151         },
152 };
153
154 struct platform_device mxc_usbh2 = {
155         .name = "mxc-ehci",
156         .id = 1,
157         .dev = {
158                 .coherent_dma_mask = 0xffffffff,
159                 .dma_mask = &usbh2_dmamask,
160         },
161         .resource = mxc_usbh2_resources,
162         .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
163 };
164
165 static struct resource mxc_spi_resources0[] = {
166         {
167                .start = 0x43fa4000,
168                .end = 0x43fa7fff,
169                .flags = IORESOURCE_MEM,
170         }, {
171                .start = 14,
172                .end = 14,
173                .flags = IORESOURCE_IRQ,
174         },
175 };
176
177 struct platform_device mxc_spi_device0 = {
178         .name = "spi_imx",
179         .id = 0,
180         .num_resources = ARRAY_SIZE(mxc_spi_resources0),
181         .resource = mxc_spi_resources0,
182 };
183
184 static struct resource mxc_spi_resources1[] = {
185         {
186                .start = 0x50010000,
187                .end = 0x50013fff,
188                .flags = IORESOURCE_MEM,
189         }, {
190                .start = 13,
191                .end = 13,
192                .flags = IORESOURCE_IRQ,
193         },
194 };
195
196 struct platform_device mxc_spi_device1 = {
197         .name = "spi_imx",
198         .id = 1,
199         .num_resources = ARRAY_SIZE(mxc_spi_resources1),
200         .resource = mxc_spi_resources1,
201 };
202
203 static struct resource mxc_spi_resources2[] = {
204         {
205                .start = 0x50004000,
206                .end = 0x50007fff,
207                .flags = IORESOURCE_MEM,
208         }, {
209                .start = 0,
210                .end = 0,
211                .flags = IORESOURCE_IRQ,
212         },
213 };
214
215 struct platform_device mxc_spi_device2 = {
216         .name = "spi_imx",
217         .id = 2,
218         .num_resources = ARRAY_SIZE(mxc_spi_resources2),
219         .resource = mxc_spi_resources2,
220 };
221
222 static struct resource mxc_pwm_resources0[] = {
223         {
224                 .start  = 0x53fe0000,
225                 .end    = 0x53fe3fff,
226                 .flags  = IORESOURCE_MEM,
227         }, {
228                 .start   = 26,
229                 .end     = 26,
230                 .flags   = IORESOURCE_IRQ,
231         }
232 };
233
234 struct platform_device mxc_pwm_device0 = {
235         .name = "mxc_pwm",
236         .id = 0,
237         .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
238         .resource = mxc_pwm_resources0,
239 };
240
241 static struct resource mxc_pwm_resources1[] = {
242         {
243                 .start  = 0x53fa0000,
244                 .end    = 0x53fa3fff,
245                 .flags  = IORESOURCE_MEM,
246         }, {
247                 .start   = 36,
248                 .end     = 36,
249                 .flags   = IORESOURCE_IRQ,
250         }
251 };
252
253 struct platform_device mxc_pwm_device1 = {
254         .name = "mxc_pwm",
255         .id = 1,
256         .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
257         .resource = mxc_pwm_resources1,
258 };
259
260 static struct resource mxc_pwm_resources2[] = {
261         {
262                 .start  = 0x53fa8000,
263                 .end    = 0x53fabfff,
264                 .flags  = IORESOURCE_MEM,
265         }, {
266                 .start   = 41,
267                 .end     = 41,
268                 .flags   = IORESOURCE_IRQ,
269         }
270 };
271
272 struct platform_device mxc_pwm_device2 = {
273         .name = "mxc_pwm",
274         .id = 2,
275         .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
276         .resource = mxc_pwm_resources2,
277 };
278
279 static struct resource mxc_keypad_resources[] = {
280         {
281                 .start  = 0x43fa8000,
282                 .end    = 0x43fabfff,
283                 .flags  = IORESOURCE_MEM,
284         }, {
285                 .start   = 24,
286                 .end     = 24,
287                 .flags   = IORESOURCE_IRQ,
288         }
289 };
290
291 struct platform_device mxc_keypad_device = {
292         .name = "mxc-keypad",
293         .id = -1,
294         .num_resources = ARRAY_SIZE(mxc_keypad_resources),
295         .resource = mxc_keypad_resources,
296 };
297
298 static struct resource mxc_pwm_resources3[] = {
299         {
300                 .start  = 0x53fc8000,
301                 .end    = 0x53fcbfff,
302                 .flags  = IORESOURCE_MEM,
303         }, {
304                 .start   = 42,
305                 .end     = 42,
306                 .flags   = IORESOURCE_IRQ,
307         }
308 };
309
310 struct platform_device mxc_pwm_device3 = {
311         .name = "mxc_pwm",
312         .id = 3,
313         .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
314         .resource = mxc_pwm_resources3,
315 };
316
317 static struct resource mxc_i2c_1_resources[] = {
318         {
319                 .start  = 0x43f80000,
320                 .end    = 0x43f83fff,
321                 .flags  = IORESOURCE_MEM,
322         }, {
323                 .start  = 3,
324                 .end    = 3,
325                 .flags  = IORESOURCE_IRQ,
326         }
327 };
328
329 struct platform_device mxc_i2c_device0 = {
330         .name = "imx-i2c",
331         .id = 0,
332         .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
333         .resource = mxc_i2c_1_resources,
334 };
335
336 static struct resource mxc_i2c_2_resources[] = {
337         {
338                 .start  = 0x43f98000,
339                 .end    = 0x43f9bfff,
340                 .flags  = IORESOURCE_MEM,
341         }, {
342                 .start  = 4,
343                 .end    = 4,
344                 .flags  = IORESOURCE_IRQ,
345         }
346 };
347
348 struct platform_device mxc_i2c_device1 = {
349         .name = "imx-i2c",
350         .id = 1,
351         .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
352         .resource = mxc_i2c_2_resources,
353 };
354
355 static struct resource mxc_i2c_3_resources[] = {
356         {
357                 .start  = 0x43f84000,
358                 .end    = 0x43f87fff,
359                 .flags  = IORESOURCE_MEM,
360         }, {
361                 .start  = 10,
362                 .end    = 10,
363                 .flags  = IORESOURCE_IRQ,
364         }
365 };
366
367 struct platform_device mxc_i2c_device2 = {
368         .name = "imx-i2c",
369         .id = 2,
370         .num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
371         .resource = mxc_i2c_3_resources,
372 };
373
374 static struct mxc_gpio_port imx_gpio_ports[] = {
375         {
376                 .chip.label = "gpio-0",
377                 .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
378                 .irq = 52,
379                 .virtual_irq_start = MXC_GPIO_IRQ_START,
380         }, {
381                 .chip.label = "gpio-1",
382                 .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
383                 .irq = 51,
384                 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
385         }, {
386                 .chip.label = "gpio-2",
387                 .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
388                 .irq = 16,
389                 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
390         }, {
391                 .chip.label = "gpio-3",
392                 .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
393                 .irq = 23,
394                 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
395         }
396 };
397
398 int __init mxc_register_gpios(void)
399 {
400         return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
401 }
402