Commit | Line | Data |
---|---|---|
de41fddd SH |
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 | ||
8c25c36f | 19 | #include <linux/platform_device.h> |
b02019e6 | 20 | #include <linux/dma-mapping.h> |
8c25c36f SH |
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 | #define MX25_OTG_BASE_ADDR 0x53FF4000 | |
121 | ||
122 | static u64 otg_dmamask = DMA_BIT_MASK(32); | |
123 | ||
124 | static struct resource mxc_otg_resources[] = { | |
125 | { | |
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, | |
133 | }, | |
134 | }; | |
135 | ||
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, | |
142 | }, | |
143 | .resource = mxc_otg_resources, | |
144 | .num_resources = ARRAY_SIZE(mxc_otg_resources), | |
145 | }; | |
146 | ||
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, | |
154 | }, | |
155 | .resource = mxc_otg_resources, | |
156 | .num_resources = ARRAY_SIZE(mxc_otg_resources), | |
157 | }; | |
158 | ||
159 | static u64 usbh2_dmamask = DMA_BIT_MASK(32); | |
160 | ||
161 | static struct resource mxc_usbh2_resources[] = { | |
162 | { | |
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, | |
170 | }, | |
171 | }; | |
172 | ||
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, | |
179 | }, | |
180 | .resource = mxc_usbh2_resources, | |
181 | .num_resources = ARRAY_SIZE(mxc_usbh2_resources), | |
182 | }; | |
183 | ||
184 | static struct resource mxc_spi_resources0[] = { | |
185 | { | |
186 | .start = 0x43fa4000, | |
187 | .end = 0x43fa7fff, | |
188 | .flags = IORESOURCE_MEM, | |
189 | }, { | |
190 | .start = 14, | |
191 | .end = 14, | |
192 | .flags = IORESOURCE_IRQ, | |
193 | }, | |
194 | }; | |
195 | ||
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, | |
201 | }; | |
202 | ||
203 | static struct resource mxc_spi_resources1[] = { | |
204 | { | |
205 | .start = 0x50010000, | |
206 | .end = 0x50013fff, | |
207 | .flags = IORESOURCE_MEM, | |
208 | }, { | |
209 | .start = 13, | |
210 | .end = 13, | |
211 | .flags = IORESOURCE_IRQ, | |
212 | }, | |
213 | }; | |
214 | ||
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, | |
220 | }; | |
221 | ||
222 | static struct resource mxc_spi_resources2[] = { | |
223 | { | |
224 | .start = 0x50004000, | |
225 | .end = 0x50007fff, | |
226 | .flags = IORESOURCE_MEM, | |
227 | }, { | |
228 | .start = 0, | |
229 | .end = 0, | |
230 | .flags = IORESOURCE_IRQ, | |
231 | }, | |
232 | }; | |
233 | ||
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, | |
239 | }; | |
240 | ||
241 | static struct resource mxc_pwm_resources0[] = { | |
242 | { | |
243 | .start = 0x53fe0000, | |
244 | .end = 0x53fe3fff, | |
245 | .flags = IORESOURCE_MEM, | |
246 | }, { | |
247 | .start = 26, | |
248 | .end = 26, | |
249 | .flags = IORESOURCE_IRQ, | |
250 | } | |
251 | }; | |
252 | ||
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, | |
258 | }; | |
259 | ||
260 | static struct resource mxc_pwm_resources1[] = { | |
261 | { | |
262 | .start = 0x53fa0000, | |
263 | .end = 0x53fa3fff, | |
264 | .flags = IORESOURCE_MEM, | |
265 | }, { | |
266 | .start = 36, | |
267 | .end = 36, | |
268 | .flags = IORESOURCE_IRQ, | |
269 | } | |
270 | }; | |
271 | ||
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, | |
277 | }; | |
278 | ||
279 | static struct resource mxc_pwm_resources2[] = { | |
280 | { | |
281 | .start = 0x53fa8000, | |
282 | .end = 0x53fabfff, | |
283 | .flags = IORESOURCE_MEM, | |
284 | }, { | |
285 | .start = 41, | |
286 | .end = 41, | |
287 | .flags = IORESOURCE_IRQ, | |
288 | } | |
289 | }; | |
290 | ||
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, | |
296 | }; | |
297 | ||
298 | static struct resource mxc_keypad_resources[] = { | |
299 | { | |
300 | .start = 0x43fa8000, | |
301 | .end = 0x43fabfff, | |
302 | .flags = IORESOURCE_MEM, | |
303 | }, { | |
304 | .start = 24, | |
305 | .end = 24, | |
306 | .flags = IORESOURCE_IRQ, | |
307 | } | |
308 | }; | |
309 | ||
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, | |
315 | }; | |
316 | ||
317 | static struct resource mxc_pwm_resources3[] = { | |
318 | { | |
319 | .start = 0x53fc8000, | |
320 | .end = 0x53fcbfff, | |
321 | .flags = IORESOURCE_MEM, | |
322 | }, { | |
323 | .start = 42, | |
324 | .end = 42, | |
325 | .flags = IORESOURCE_IRQ, | |
326 | } | |
327 | }; | |
328 | ||
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, | |
334 | }; | |
335 | ||
336 | static struct resource mxc_i2c_1_resources[] = { | |
337 | { | |
338 | .start = 0x43f80000, | |
339 | .end = 0x43f83fff, | |
340 | .flags = IORESOURCE_MEM, | |
341 | }, { | |
342 | .start = 3, | |
343 | .end = 3, | |
344 | .flags = IORESOURCE_IRQ, | |
345 | } | |
346 | }; | |
347 | ||
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, | |
353 | }; | |
354 | ||
355 | static struct resource mxc_i2c_2_resources[] = { | |
356 | { | |
357 | .start = 0x43f98000, | |
358 | .end = 0x43f9bfff, | |
359 | .flags = IORESOURCE_MEM, | |
360 | }, { | |
361 | .start = 4, | |
362 | .end = 4, | |
363 | .flags = IORESOURCE_IRQ, | |
364 | } | |
365 | }; | |
366 | ||
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, | |
372 | }; | |
373 | ||
374 | static struct resource mxc_i2c_3_resources[] = { | |
375 | { | |
376 | .start = 0x43f84000, | |
377 | .end = 0x43f87fff, | |
378 | .flags = IORESOURCE_MEM, | |
379 | }, { | |
380 | .start = 10, | |
381 | .end = 10, | |
382 | .flags = IORESOURCE_IRQ, | |
383 | } | |
384 | }; | |
385 | ||
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, | |
391 | }; | |
392 | ||
393 | static struct mxc_gpio_port imx_gpio_ports[] = { | |
394 | { | |
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, | |
414 | } | |
415 | }; | |
416 | ||
417 | int __init mxc_register_gpios(void) | |
418 | { | |
419 | return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); | |
420 | } | |
421 | ||
a759544f BS |
422 | static struct resource mx25_fec_resources[] = { |
423 | { | |
424 | .start = MX25_FEC_BASE_ADDR, | |
425 | .end = MX25_FEC_BASE_ADDR + 0xfff, | |
426 | .flags = IORESOURCE_MEM, | |
427 | }, | |
428 | { | |
429 | .start = MX25_INT_FEC, | |
430 | .end = MX25_INT_FEC, | |
431 | .flags = IORESOURCE_IRQ, | |
432 | }, | |
433 | }; | |
434 | ||
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, | |
440 | }; |