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