sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-mx25 / devices.c
blob3f4b8a0b5facf9d1c7200ce7f21d1b85890f37b6
1 /*
2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
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.
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.
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>
25 static struct resource uart0[] = {
27 .start = 0x43f90000,
28 .end = 0x43f93fff,
29 .flags = IORESOURCE_MEM,
30 }, {
31 .start = 45,
32 .end = 45,
33 .flags = IORESOURCE_IRQ,
37 struct platform_device mxc_uart_device0 = {
38 .name = "imx-uart",
39 .id = 0,
40 .resource = uart0,
41 .num_resources = ARRAY_SIZE(uart0),
44 static struct resource uart1[] = {
46 .start = 0x43f94000,
47 .end = 0x43f97fff,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = 32,
51 .end = 32,
52 .flags = IORESOURCE_IRQ,
56 struct platform_device mxc_uart_device1 = {
57 .name = "imx-uart",
58 .id = 1,
59 .resource = uart1,
60 .num_resources = ARRAY_SIZE(uart1),
63 static struct resource uart2[] = {
65 .start = 0x5000c000,
66 .end = 0x5000ffff,
67 .flags = IORESOURCE_MEM,
68 }, {
69 .start = 18,
70 .end = 18,
71 .flags = IORESOURCE_IRQ,
75 struct platform_device mxc_uart_device2 = {
76 .name = "imx-uart",
77 .id = 2,
78 .resource = uart2,
79 .num_resources = ARRAY_SIZE(uart2),
82 static struct resource uart3[] = {
84 .start = 0x50008000,
85 .end = 0x5000bfff,
86 .flags = IORESOURCE_MEM,
87 }, {
88 .start = 5,
89 .end = 5,
90 .flags = IORESOURCE_IRQ,
94 struct platform_device mxc_uart_device3 = {
95 .name = "imx-uart",
96 .id = 3,
97 .resource = uart3,
98 .num_resources = ARRAY_SIZE(uart3),
101 static struct resource uart4[] = {
103 .start = 0x5002c000,
104 .end = 0x5002ffff,
105 .flags = IORESOURCE_MEM,
106 }, {
107 .start = 40,
108 .end = 40,
109 .flags = IORESOURCE_IRQ,
113 struct platform_device mxc_uart_device4 = {
114 .name = "imx-uart",
115 .id = 4,
116 .resource = uart4,
117 .num_resources = ARRAY_SIZE(uart4),
120 #define MX25_OTG_BASE_ADDR 0x53FF4000
122 static u64 otg_dmamask = DMA_BIT_MASK(32);
124 static struct resource mxc_otg_resources[] = {
126 .start = MX25_OTG_BASE_ADDR,
127 .end = MX25_OTG_BASE_ADDR + 0x1ff,
128 .flags = IORESOURCE_MEM,
129 }, {
130 .start = 37,
131 .end = 37,
132 .flags = IORESOURCE_IRQ,
136 struct platform_device mxc_otg = {
137 .name = "mxc-ehci",
138 .id = 0,
139 .dev = {
140 .coherent_dma_mask = 0xffffffff,
141 .dma_mask = &otg_dmamask,
143 .resource = mxc_otg_resources,
144 .num_resources = ARRAY_SIZE(mxc_otg_resources),
147 /* OTG gadget device */
148 struct platform_device otg_udc_device = {
149 .name = "fsl-usb2-udc",
150 .id = -1,
151 .dev = {
152 .dma_mask = &otg_dmamask,
153 .coherent_dma_mask = 0xffffffff,
155 .resource = mxc_otg_resources,
156 .num_resources = ARRAY_SIZE(mxc_otg_resources),
159 static u64 usbh2_dmamask = DMA_BIT_MASK(32);
161 static struct resource mxc_usbh2_resources[] = {
163 .start = MX25_OTG_BASE_ADDR + 0x400,
164 .end = MX25_OTG_BASE_ADDR + 0x5ff,
165 .flags = IORESOURCE_MEM,
166 }, {
167 .start = 35,
168 .end = 35,
169 .flags = IORESOURCE_IRQ,
173 struct platform_device mxc_usbh2 = {
174 .name = "mxc-ehci",
175 .id = 1,
176 .dev = {
177 .coherent_dma_mask = 0xffffffff,
178 .dma_mask = &usbh2_dmamask,
180 .resource = mxc_usbh2_resources,
181 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
184 static struct resource mxc_spi_resources0[] = {
186 .start = 0x43fa4000,
187 .end = 0x43fa7fff,
188 .flags = IORESOURCE_MEM,
189 }, {
190 .start = 14,
191 .end = 14,
192 .flags = IORESOURCE_IRQ,
196 struct platform_device mxc_spi_device0 = {
197 .name = "spi_imx",
198 .id = 0,
199 .num_resources = ARRAY_SIZE(mxc_spi_resources0),
200 .resource = mxc_spi_resources0,
203 static struct resource mxc_spi_resources1[] = {
205 .start = 0x50010000,
206 .end = 0x50013fff,
207 .flags = IORESOURCE_MEM,
208 }, {
209 .start = 13,
210 .end = 13,
211 .flags = IORESOURCE_IRQ,
215 struct platform_device mxc_spi_device1 = {
216 .name = "spi_imx",
217 .id = 1,
218 .num_resources = ARRAY_SIZE(mxc_spi_resources1),
219 .resource = mxc_spi_resources1,
222 static struct resource mxc_spi_resources2[] = {
224 .start = 0x50004000,
225 .end = 0x50007fff,
226 .flags = IORESOURCE_MEM,
227 }, {
228 .start = 0,
229 .end = 0,
230 .flags = IORESOURCE_IRQ,
234 struct platform_device mxc_spi_device2 = {
235 .name = "spi_imx",
236 .id = 2,
237 .num_resources = ARRAY_SIZE(mxc_spi_resources2),
238 .resource = mxc_spi_resources2,
241 static struct resource mxc_pwm_resources0[] = {
243 .start = 0x53fe0000,
244 .end = 0x53fe3fff,
245 .flags = IORESOURCE_MEM,
246 }, {
247 .start = 26,
248 .end = 26,
249 .flags = IORESOURCE_IRQ,
253 struct platform_device mxc_pwm_device0 = {
254 .name = "mxc_pwm",
255 .id = 0,
256 .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
257 .resource = mxc_pwm_resources0,
260 static struct resource mxc_pwm_resources1[] = {
262 .start = 0x53fa0000,
263 .end = 0x53fa3fff,
264 .flags = IORESOURCE_MEM,
265 }, {
266 .start = 36,
267 .end = 36,
268 .flags = IORESOURCE_IRQ,
272 struct platform_device mxc_pwm_device1 = {
273 .name = "mxc_pwm",
274 .id = 1,
275 .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
276 .resource = mxc_pwm_resources1,
279 static struct resource mxc_pwm_resources2[] = {
281 .start = 0x53fa8000,
282 .end = 0x53fabfff,
283 .flags = IORESOURCE_MEM,
284 }, {
285 .start = 41,
286 .end = 41,
287 .flags = IORESOURCE_IRQ,
291 struct platform_device mxc_pwm_device2 = {
292 .name = "mxc_pwm",
293 .id = 2,
294 .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
295 .resource = mxc_pwm_resources2,
298 static struct resource mxc_keypad_resources[] = {
300 .start = 0x43fa8000,
301 .end = 0x43fabfff,
302 .flags = IORESOURCE_MEM,
303 }, {
304 .start = 24,
305 .end = 24,
306 .flags = IORESOURCE_IRQ,
310 struct platform_device mxc_keypad_device = {
311 .name = "mxc-keypad",
312 .id = -1,
313 .num_resources = ARRAY_SIZE(mxc_keypad_resources),
314 .resource = mxc_keypad_resources,
317 static struct resource mxc_pwm_resources3[] = {
319 .start = 0x53fc8000,
320 .end = 0x53fcbfff,
321 .flags = IORESOURCE_MEM,
322 }, {
323 .start = 42,
324 .end = 42,
325 .flags = IORESOURCE_IRQ,
329 struct platform_device mxc_pwm_device3 = {
330 .name = "mxc_pwm",
331 .id = 3,
332 .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
333 .resource = mxc_pwm_resources3,
336 static struct resource mxc_i2c_1_resources[] = {
338 .start = 0x43f80000,
339 .end = 0x43f83fff,
340 .flags = IORESOURCE_MEM,
341 }, {
342 .start = 3,
343 .end = 3,
344 .flags = IORESOURCE_IRQ,
348 struct platform_device mxc_i2c_device0 = {
349 .name = "imx-i2c",
350 .id = 0,
351 .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
352 .resource = mxc_i2c_1_resources,
355 static struct resource mxc_i2c_2_resources[] = {
357 .start = 0x43f98000,
358 .end = 0x43f9bfff,
359 .flags = IORESOURCE_MEM,
360 }, {
361 .start = 4,
362 .end = 4,
363 .flags = IORESOURCE_IRQ,
367 struct platform_device mxc_i2c_device1 = {
368 .name = "imx-i2c",
369 .id = 1,
370 .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
371 .resource = mxc_i2c_2_resources,
374 static struct resource mxc_i2c_3_resources[] = {
376 .start = 0x43f84000,
377 .end = 0x43f87fff,
378 .flags = IORESOURCE_MEM,
379 }, {
380 .start = 10,
381 .end = 10,
382 .flags = IORESOURCE_IRQ,
386 struct platform_device mxc_i2c_device2 = {
387 .name = "imx-i2c",
388 .id = 2,
389 .num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
390 .resource = mxc_i2c_3_resources,
393 static struct mxc_gpio_port imx_gpio_ports[] = {
395 .chip.label = "gpio-0",
396 .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
397 .irq = 52,
398 .virtual_irq_start = MXC_GPIO_IRQ_START,
399 }, {
400 .chip.label = "gpio-1",
401 .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
402 .irq = 51,
403 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
404 }, {
405 .chip.label = "gpio-2",
406 .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
407 .irq = 16,
408 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
409 }, {
410 .chip.label = "gpio-3",
411 .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
412 .irq = 23,
413 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
417 int __init mxc_register_gpios(void)
419 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
422 static struct resource mx25_fec_resources[] = {
424 .start = MX25_FEC_BASE_ADDR,
425 .end = MX25_FEC_BASE_ADDR + 0xfff,
426 .flags = IORESOURCE_MEM,
429 .start = MX25_INT_FEC,
430 .end = MX25_INT_FEC,
431 .flags = IORESOURCE_IRQ,
435 struct platform_device mx25_fec_device = {
436 .name = "fec",
437 .id = 0,
438 .num_resources = ARRAY_SIZE(mx25_fec_resources),
439 .resource = mx25_fec_resources,
442 static struct resource mxc_nand_resources[] = {
444 .start = MX25_NFC_BASE_ADDR,
445 .end = MX25_NFC_BASE_ADDR + 0x1fff,
446 .flags = IORESOURCE_MEM,
449 .start = MX25_INT_NANDFC,
450 .end = MX25_INT_NANDFC,
451 .flags = IORESOURCE_IRQ,
455 struct platform_device mxc_nand_device = {
456 .name = "mxc_nand",
457 .id = 0,
458 .num_resources = ARRAY_SIZE(mxc_nand_resources),
459 .resource = mxc_nand_resources,
462 static struct resource mx25_rtc_resources[] = {
464 .start = MX25_DRYICE_BASE_ADDR,
465 .end = MX25_DRYICE_BASE_ADDR + 0x40,
466 .flags = IORESOURCE_MEM,
469 .start = MX25_INT_DRYICE,
470 .flags = IORESOURCE_IRQ
474 struct platform_device mx25_rtc_device = {
475 .name = "imxdi_rtc",
476 .id = 0,
477 .num_resources = ARRAY_SIZE(mx25_rtc_resources),
478 .resource = mx25_rtc_resources,
481 static struct resource mx25_fb_resources[] = {
483 .start = MX25_LCDC_BASE_ADDR,
484 .end = MX25_LCDC_BASE_ADDR + 0xfff,
485 .flags = IORESOURCE_MEM,
488 .start = MX25_INT_LCDC,
489 .end = MX25_INT_LCDC,
490 .flags = IORESOURCE_IRQ,
494 struct platform_device mx25_fb_device = {
495 .name = "imx-fb",
496 .id = 0,
497 .resource = mx25_fb_resources,
498 .num_resources = ARRAY_SIZE(mx25_fb_resources),
499 .dev = {
500 .coherent_dma_mask = 0xFFFFFFFF,