]> git.karo-electronics.de Git - mv-sheeva.git/blob - arch/arm/mach-mx25/devices.c
i.MX25: add AUDMUX and SSI support
[mv-sheeva.git] / arch / arm / mach-mx25 / devices.c
1 /*
2  * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA  02110-1301, USA.
17  */
18
19 #include <linux/platform_device.h>
20 #include <linux/dma-mapping.h>
21 #include <linux/gpio.h>
22 #include <mach/mx25.h>
23 #include <mach/irqs.h>
24
25 static struct resource uart0[] = {
26         {
27                 .start = 0x43f90000,
28                 .end = 0x43f93fff,
29                 .flags = IORESOURCE_MEM,
30         }, {
31                 .start = 45,
32                 .end = 45,
33                 .flags = IORESOURCE_IRQ,
34         },
35 };
36
37 struct platform_device mxc_uart_device0 = {
38         .name = "imx-uart",
39         .id = 0,
40         .resource = uart0,
41         .num_resources = ARRAY_SIZE(uart0),
42 };
43
44 static struct resource uart1[] = {
45         {
46                 .start = 0x43f94000,
47                 .end = 0x43f97fff,
48                 .flags = IORESOURCE_MEM,
49         }, {
50                 .start = 32,
51                 .end = 32,
52                 .flags = IORESOURCE_IRQ,
53         },
54 };
55
56 struct platform_device mxc_uart_device1 = {
57         .name = "imx-uart",
58         .id = 1,
59         .resource = uart1,
60         .num_resources = ARRAY_SIZE(uart1),
61 };
62
63 static struct resource uart2[] = {
64         {
65                 .start = 0x5000c000,
66                 .end = 0x5000ffff,
67                 .flags = IORESOURCE_MEM,
68         }, {
69                 .start = 18,
70                 .end = 18,
71                 .flags = IORESOURCE_IRQ,
72         },
73 };
74
75 struct platform_device mxc_uart_device2 = {
76         .name = "imx-uart",
77         .id = 2,
78         .resource = uart2,
79         .num_resources = ARRAY_SIZE(uart2),
80 };
81
82 static struct resource uart3[] = {
83         {
84                 .start = 0x50008000,
85                 .end = 0x5000bfff,
86                 .flags = IORESOURCE_MEM,
87         }, {
88                 .start = 5,
89                 .end = 5,
90                 .flags = IORESOURCE_IRQ,
91         },
92 };
93
94 struct platform_device mxc_uart_device3 = {
95         .name = "imx-uart",
96         .id = 3,
97         .resource = uart3,
98         .num_resources = ARRAY_SIZE(uart3),
99 };
100
101 static struct resource uart4[] = {
102         {
103                 .start = 0x5002c000,
104                 .end = 0x5002ffff,
105                 .flags = IORESOURCE_MEM,
106         }, {
107                 .start = 40,
108                 .end = 40,
109                 .flags = IORESOURCE_IRQ,
110         },
111 };
112
113 struct platform_device mxc_uart_device4 = {
114         .name = "imx-uart",
115         .id = 4,
116         .resource = uart4,
117         .num_resources = ARRAY_SIZE(uart4),
118 };
119
120 static u64 otg_dmamask = DMA_BIT_MASK(32);
121
122 static struct resource mxc_otg_resources[] = {
123         {
124                 .start = MX25_OTG_BASE_ADDR,
125                 .end = MX25_OTG_BASE_ADDR + 0x1ff,
126                 .flags = IORESOURCE_MEM,
127         }, {
128                 .start = 37,
129                 .end = 37,
130                 .flags = IORESOURCE_IRQ,
131         },
132 };
133
134 struct platform_device mxc_otg = {
135         .name = "mxc-ehci",
136         .id = 0,
137         .dev = {
138                 .coherent_dma_mask = 0xffffffff,
139                 .dma_mask = &otg_dmamask,
140         },
141         .resource = mxc_otg_resources,
142         .num_resources = ARRAY_SIZE(mxc_otg_resources),
143 };
144
145 /* OTG gadget device */
146 struct platform_device otg_udc_device = {
147         .name = "fsl-usb2-udc",
148         .id   = -1,
149         .dev  = {
150                 .dma_mask          = &otg_dmamask,
151                 .coherent_dma_mask = 0xffffffff,
152         },
153         .resource = mxc_otg_resources,
154         .num_resources = ARRAY_SIZE(mxc_otg_resources),
155 };
156
157 static u64 usbh2_dmamask = DMA_BIT_MASK(32);
158
159 static struct resource mxc_usbh2_resources[] = {
160         {
161                 .start = MX25_OTG_BASE_ADDR + 0x400,
162                 .end = MX25_OTG_BASE_ADDR + 0x5ff,
163                 .flags = IORESOURCE_MEM,
164         }, {
165                 .start = 35,
166                 .end = 35,
167                 .flags = IORESOURCE_IRQ,
168         },
169 };
170
171 struct platform_device mxc_usbh2 = {
172         .name = "mxc-ehci",
173         .id = 1,
174         .dev = {
175                 .coherent_dma_mask = 0xffffffff,
176                 .dma_mask = &usbh2_dmamask,
177         },
178         .resource = mxc_usbh2_resources,
179         .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
180 };
181
182 static struct resource mxc_spi_resources0[] = {
183         {
184                .start = 0x43fa4000,
185                .end = 0x43fa7fff,
186                .flags = IORESOURCE_MEM,
187         }, {
188                .start = 14,
189                .end = 14,
190                .flags = IORESOURCE_IRQ,
191         },
192 };
193
194 struct platform_device mxc_spi_device0 = {
195         .name = "spi_imx",
196         .id = 0,
197         .num_resources = ARRAY_SIZE(mxc_spi_resources0),
198         .resource = mxc_spi_resources0,
199 };
200
201 static struct resource mxc_spi_resources1[] = {
202         {
203                .start = 0x50010000,
204                .end = 0x50013fff,
205                .flags = IORESOURCE_MEM,
206         }, {
207                .start = 13,
208                .end = 13,
209                .flags = IORESOURCE_IRQ,
210         },
211 };
212
213 struct platform_device mxc_spi_device1 = {
214         .name = "spi_imx",
215         .id = 1,
216         .num_resources = ARRAY_SIZE(mxc_spi_resources1),
217         .resource = mxc_spi_resources1,
218 };
219
220 static struct resource mxc_spi_resources2[] = {
221         {
222                .start = 0x50004000,
223                .end = 0x50007fff,
224                .flags = IORESOURCE_MEM,
225         }, {
226                .start = 0,
227                .end = 0,
228                .flags = IORESOURCE_IRQ,
229         },
230 };
231
232 struct platform_device mxc_spi_device2 = {
233         .name = "spi_imx",
234         .id = 2,
235         .num_resources = ARRAY_SIZE(mxc_spi_resources2),
236         .resource = mxc_spi_resources2,
237 };
238
239 static struct resource mxc_pwm_resources0[] = {
240         {
241                 .start  = 0x53fe0000,
242                 .end    = 0x53fe3fff,
243                 .flags  = IORESOURCE_MEM,
244         }, {
245                 .start   = 26,
246                 .end     = 26,
247                 .flags   = IORESOURCE_IRQ,
248         }
249 };
250
251 struct platform_device mxc_pwm_device0 = {
252         .name = "mxc_pwm",
253         .id = 0,
254         .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
255         .resource = mxc_pwm_resources0,
256 };
257
258 static struct resource mxc_pwm_resources1[] = {
259         {
260                 .start  = 0x53fa0000,
261                 .end    = 0x53fa3fff,
262                 .flags  = IORESOURCE_MEM,
263         }, {
264                 .start   = 36,
265                 .end     = 36,
266                 .flags   = IORESOURCE_IRQ,
267         }
268 };
269
270 struct platform_device mxc_pwm_device1 = {
271         .name = "mxc_pwm",
272         .id = 1,
273         .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
274         .resource = mxc_pwm_resources1,
275 };
276
277 static struct resource mxc_pwm_resources2[] = {
278         {
279                 .start  = 0x53fa8000,
280                 .end    = 0x53fabfff,
281                 .flags  = IORESOURCE_MEM,
282         }, {
283                 .start   = 41,
284                 .end     = 41,
285                 .flags   = IORESOURCE_IRQ,
286         }
287 };
288
289 struct platform_device mxc_pwm_device2 = {
290         .name = "mxc_pwm",
291         .id = 2,
292         .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
293         .resource = mxc_pwm_resources2,
294 };
295
296 static struct resource mxc_keypad_resources[] = {
297         {
298                 .start  = 0x43fa8000,
299                 .end    = 0x43fabfff,
300                 .flags  = IORESOURCE_MEM,
301         }, {
302                 .start   = 24,
303                 .end     = 24,
304                 .flags   = IORESOURCE_IRQ,
305         }
306 };
307
308 struct platform_device mxc_keypad_device = {
309         .name = "mxc-keypad",
310         .id = -1,
311         .num_resources = ARRAY_SIZE(mxc_keypad_resources),
312         .resource = mxc_keypad_resources,
313 };
314
315 static struct resource mxc_pwm_resources3[] = {
316         {
317                 .start  = 0x53fc8000,
318                 .end    = 0x53fcbfff,
319                 .flags  = IORESOURCE_MEM,
320         }, {
321                 .start   = 42,
322                 .end     = 42,
323                 .flags   = IORESOURCE_IRQ,
324         }
325 };
326
327 struct platform_device mxc_pwm_device3 = {
328         .name = "mxc_pwm",
329         .id = 3,
330         .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
331         .resource = mxc_pwm_resources3,
332 };
333
334 static struct resource mxc_i2c_1_resources[] = {
335         {
336                 .start  = 0x43f80000,
337                 .end    = 0x43f83fff,
338                 .flags  = IORESOURCE_MEM,
339         }, {
340                 .start  = 3,
341                 .end    = 3,
342                 .flags  = IORESOURCE_IRQ,
343         }
344 };
345
346 struct platform_device mxc_i2c_device0 = {
347         .name = "imx-i2c",
348         .id = 0,
349         .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
350         .resource = mxc_i2c_1_resources,
351 };
352
353 static struct resource mxc_i2c_2_resources[] = {
354         {
355                 .start  = 0x43f98000,
356                 .end    = 0x43f9bfff,
357                 .flags  = IORESOURCE_MEM,
358         }, {
359                 .start  = 4,
360                 .end    = 4,
361                 .flags  = IORESOURCE_IRQ,
362         }
363 };
364
365 struct platform_device mxc_i2c_device1 = {
366         .name = "imx-i2c",
367         .id = 1,
368         .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
369         .resource = mxc_i2c_2_resources,
370 };
371
372 static struct resource mxc_i2c_3_resources[] = {
373         {
374                 .start  = 0x43f84000,
375                 .end    = 0x43f87fff,
376                 .flags  = IORESOURCE_MEM,
377         }, {
378                 .start  = 10,
379                 .end    = 10,
380                 .flags  = IORESOURCE_IRQ,
381         }
382 };
383
384 struct platform_device mxc_i2c_device2 = {
385         .name = "imx-i2c",
386         .id = 2,
387         .num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
388         .resource = mxc_i2c_3_resources,
389 };
390
391 static struct mxc_gpio_port imx_gpio_ports[] = {
392         {
393                 .chip.label = "gpio-0",
394                 .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
395                 .irq = 52,
396                 .virtual_irq_start = MXC_GPIO_IRQ_START,
397         }, {
398                 .chip.label = "gpio-1",
399                 .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
400                 .irq = 51,
401                 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
402         }, {
403                 .chip.label = "gpio-2",
404                 .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
405                 .irq = 16,
406                 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
407         }, {
408                 .chip.label = "gpio-3",
409                 .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
410                 .irq = 23,
411                 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
412         }
413 };
414
415 int __init mxc_register_gpios(void)
416 {
417         return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
418 }
419
420 static struct resource mx25_fec_resources[] = {
421         {
422                 .start  = MX25_FEC_BASE_ADDR,
423                 .end    = MX25_FEC_BASE_ADDR + 0xfff,
424                 .flags  = IORESOURCE_MEM,
425         },
426         {
427                 .start  = MX25_INT_FEC,
428                 .end    = MX25_INT_FEC,
429                 .flags  = IORESOURCE_IRQ,
430         },
431 };
432
433 struct platform_device mx25_fec_device = {
434         .name   = "fec",
435         .id     = 0,
436         .num_resources  = ARRAY_SIZE(mx25_fec_resources),
437         .resource       = mx25_fec_resources,
438 };
439
440 static struct resource mxc_nand_resources[] = {
441         {
442                 .start  = MX25_NFC_BASE_ADDR,
443                 .end    = MX25_NFC_BASE_ADDR + 0x1fff,
444                 .flags  = IORESOURCE_MEM,
445         },
446         {
447                 .start  = MX25_INT_NANDFC,
448                 .end    = MX25_INT_NANDFC,
449                 .flags  = IORESOURCE_IRQ,
450         },
451 };
452
453 struct platform_device mxc_nand_device = {
454         .name           = "mxc_nand",
455         .id             = 0,
456         .num_resources  = ARRAY_SIZE(mxc_nand_resources),
457         .resource       = mxc_nand_resources,
458 };
459
460 static struct resource mx25_rtc_resources[] = {
461         {
462                 .start  = MX25_DRYICE_BASE_ADDR,
463                 .end    = MX25_DRYICE_BASE_ADDR + 0x40,
464                 .flags  = IORESOURCE_MEM,
465         },
466         {
467                 .start  = MX25_INT_DRYICE,
468                 .flags  = IORESOURCE_IRQ
469         },
470 };
471
472 struct platform_device mx25_rtc_device = {
473         .name   = "imxdi_rtc",
474         .id     = 0,
475         .num_resources  = ARRAY_SIZE(mx25_rtc_resources),
476         .resource       = mx25_rtc_resources,
477 };
478
479 static struct resource mx25_fb_resources[] = {
480         {
481                 .start  = MX25_LCDC_BASE_ADDR,
482                 .end    = MX25_LCDC_BASE_ADDR + 0xfff,
483                 .flags  = IORESOURCE_MEM,
484         },
485         {
486                 .start  = MX25_INT_LCDC,
487                 .end    = MX25_INT_LCDC,
488                 .flags  = IORESOURCE_IRQ,
489         },
490 };
491
492 struct platform_device mx25_fb_device = {
493         .name           = "imx-fb",
494         .id             = 0,
495         .resource       = mx25_fb_resources,
496         .num_resources  = ARRAY_SIZE(mx25_fb_resources),
497         .dev            = {
498                 .coherent_dma_mask = 0xFFFFFFFF,
499         },
500 };
501
502 static struct resource mxc_wdt_resources[] = {
503         {
504                 .start = MX25_WDOG_BASE_ADDR,
505                 .end = MX25_WDOG_BASE_ADDR + SZ_16K - 1,
506                 .flags = IORESOURCE_MEM,
507         },
508 };
509
510 struct platform_device mxc_wdt = {
511         .name = "imx2-wdt",
512         .id = 0,
513         .num_resources = ARRAY_SIZE(mxc_wdt_resources),
514         .resource = mxc_wdt_resources,
515 };
516
517 static struct resource mx25_kpp_resources[] = {
518         {
519                 .start  = MX25_KPP_BASE_ADDR,
520                 .end    = MX25_KPP_BASE_ADDR + 0xf,
521                 .flags  = IORESOURCE_MEM,
522         },
523         {
524                 .start  = MX25_INT_KPP,
525                 .end    = MX25_INT_KPP,
526                 .flags  = IORESOURCE_IRQ,
527         },
528 };
529
530 struct platform_device mx25_kpp_device = {
531         .name   = "imx-keypad",
532         .id     = -1,
533         .num_resources  = ARRAY_SIZE(mx25_kpp_resources),
534         .resource       = mx25_kpp_resources,
535 };
536
537 static struct resource imx_ssi_resources0[] = {
538         {
539                 .start  = MX25_SSI1_BASE_ADDR,
540                 .end    = MX25_SSI1_BASE_ADDR + 0x3fff,
541                 .flags  = IORESOURCE_MEM,
542         }, {
543                 .start  = MX25_INT_SSI1,
544                 .end    = MX25_INT_SSI1,
545                 .flags  = IORESOURCE_IRQ,
546         },
547 };
548
549 static struct resource imx_ssi_resources1[] = {
550         {
551                 .start  = MX25_SSI2_BASE_ADDR,
552                 .end    = MX25_SSI2_BASE_ADDR + 0x3fff,
553                 .flags  = IORESOURCE_MEM
554         }, {
555                 .start  = MX25_INT_SSI2,
556                 .end    = MX25_INT_SSI2,
557                 .flags  = IORESOURCE_IRQ,
558         },
559 };
560
561 struct platform_device imx_ssi_device0 = {
562         .name = "imx-ssi",
563         .id = 0,
564         .num_resources = ARRAY_SIZE(imx_ssi_resources0),
565         .resource = imx_ssi_resources0,
566 };
567
568 struct platform_device imx_ssi_device1 = {
569         .name = "imx-ssi",
570         .id = 1,
571         .num_resources = ARRAY_SIZE(imx_ssi_resources1),
572         .resource = imx_ssi_resources1,
573 };