diff options
author | dmitry pervushin <dpervushin@embeddedalley.com> | 2009-06-04 08:51:05 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-06-04 09:16:45 -0400 |
commit | c11c22177ae2929598051a39e4655be4a42cb805 (patch) | |
tree | e003e7c2ef7c78b1cc6281e30a3031af59782a5f /arch/arm/plat-stmp3xxx/devices.c | |
parent | a50808b6c4e0e25a72314391d70479447e3ce092 (diff) |
[ARM] 5539/1: Freescale STMP: onboard devices declaration
Define onboard devices for Freescale STMP3xxx boards
Signed-off-by: dmitry pervushin <dpervushin@embeddedalley.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-stmp3xxx/devices.c')
-rw-r--r-- | arch/arm/plat-stmp3xxx/devices.c | 389 |
1 files changed, 389 insertions, 0 deletions
diff --git a/arch/arm/plat-stmp3xxx/devices.c b/arch/arm/plat-stmp3xxx/devices.c new file mode 100644 index 000000000000..68fed4b8746a --- /dev/null +++ b/arch/arm/plat-stmp3xxx/devices.c | |||
@@ -0,0 +1,389 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X platform devices | ||
3 | * | ||
4 | * Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/dma-mapping.h> | ||
23 | |||
24 | #include <mach/dma.h> | ||
25 | #include <mach/platform.h> | ||
26 | #include <mach/stmp3xxx.h> | ||
27 | #include <mach/regs-lcdif.h> | ||
28 | #include <mach/regs-uartapp.h> | ||
29 | #include <mach/regs-gpmi.h> | ||
30 | #include <mach/regs-usbctrl.h> | ||
31 | #include <mach/regs-ssp.h> | ||
32 | #include <mach/regs-rtc.h> | ||
33 | |||
34 | static u64 common_dmamask = DMA_BIT_MASK(32); | ||
35 | |||
36 | static struct resource appuart_resources[] = { | ||
37 | { | ||
38 | .start = IRQ_UARTAPP_INTERNAL, | ||
39 | .end = IRQ_UARTAPP_INTERNAL, | ||
40 | .flags = IORESOURCE_IRQ, | ||
41 | }, { | ||
42 | .start = IRQ_UARTAPP_RX_DMA, | ||
43 | .end = IRQ_UARTAPP_RX_DMA, | ||
44 | .flags = IORESOURCE_IRQ, | ||
45 | }, { | ||
46 | .start = IRQ_UARTAPP_TX_DMA, | ||
47 | .end = IRQ_UARTAPP_TX_DMA, | ||
48 | .flags = IORESOURCE_IRQ, | ||
49 | }, { | ||
50 | .start = REGS_UARTAPP1_PHYS, | ||
51 | .end = REGS_UARTAPP1_PHYS + REGS_UARTAPP_SIZE, | ||
52 | .flags = IORESOURCE_MEM, | ||
53 | }, { | ||
54 | /* Rx DMA channel */ | ||
55 | .start = STMP3XXX_DMA(6, STMP3XXX_BUS_APBX), | ||
56 | .end = STMP3XXX_DMA(6, STMP3XXX_BUS_APBX), | ||
57 | .flags = IORESOURCE_DMA, | ||
58 | }, { | ||
59 | /* Tx DMA channel */ | ||
60 | .start = STMP3XXX_DMA(7, STMP3XXX_BUS_APBX), | ||
61 | .end = STMP3XXX_DMA(7, STMP3XXX_BUS_APBX), | ||
62 | .flags = IORESOURCE_DMA, | ||
63 | }, | ||
64 | }; | ||
65 | |||
66 | struct platform_device stmp3xxx_appuart = { | ||
67 | .name = "stmp3xxx-appuart", | ||
68 | .id = 0, | ||
69 | .resource = appuart_resources, | ||
70 | .num_resources = ARRAY_SIZE(appuart_resources), | ||
71 | .dev = { | ||
72 | .dma_mask = &common_dmamask, | ||
73 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | struct platform_device stmp3xxx_watchdog = { | ||
78 | .name = "stmp3xxx_wdt", | ||
79 | .id = -1, | ||
80 | }; | ||
81 | |||
82 | static struct resource ts_resource[] = { | ||
83 | { | ||
84 | .flags = IORESOURCE_IRQ, | ||
85 | .start = IRQ_TOUCH_DETECT, | ||
86 | .end = IRQ_TOUCH_DETECT, | ||
87 | }, { | ||
88 | .flags = IORESOURCE_IRQ, | ||
89 | .start = IRQ_LRADC_CH5, | ||
90 | .end = IRQ_LRADC_CH5, | ||
91 | }, | ||
92 | }; | ||
93 | |||
94 | struct platform_device stmp3xxx_touchscreen = { | ||
95 | .name = "stmp3xxx_ts", | ||
96 | .id = -1, | ||
97 | .resource = ts_resource, | ||
98 | .num_resources = ARRAY_SIZE(ts_resource), | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * Keypad device | ||
103 | */ | ||
104 | struct platform_device stmp3xxx_keyboard = { | ||
105 | .name = "stmp3xxx-keyboard", | ||
106 | .id = -1, | ||
107 | }; | ||
108 | |||
109 | static struct resource gpmi_resources[] = { | ||
110 | { | ||
111 | .flags = IORESOURCE_MEM, | ||
112 | .start = REGS_GPMI_PHYS, | ||
113 | .end = REGS_GPMI_PHYS + REGS_GPMI_SIZE, | ||
114 | }, { | ||
115 | .flags = IORESOURCE_IRQ, | ||
116 | .start = IRQ_GPMI_DMA, | ||
117 | .end = IRQ_GPMI_DMA, | ||
118 | }, { | ||
119 | .flags = IORESOURCE_DMA, | ||
120 | .start = STMP3XXX_DMA(4, STMP3XXX_BUS_APBH), | ||
121 | .end = STMP3XXX_DMA(8, STMP3XXX_BUS_APBH), | ||
122 | }, | ||
123 | }; | ||
124 | |||
125 | struct platform_device stmp3xxx_gpmi = { | ||
126 | .name = "gpmi", | ||
127 | .id = -1, | ||
128 | .dev = { | ||
129 | .dma_mask = &common_dmamask, | ||
130 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
131 | }, | ||
132 | .resource = gpmi_resources, | ||
133 | .num_resources = ARRAY_SIZE(gpmi_resources), | ||
134 | }; | ||
135 | |||
136 | static struct resource mmc1_resource[] = { | ||
137 | { | ||
138 | .flags = IORESOURCE_MEM, | ||
139 | .start = REGS_SSP1_PHYS, | ||
140 | .end = REGS_SSP1_PHYS + REGS_SSP_SIZE, | ||
141 | }, { | ||
142 | .flags = IORESOURCE_DMA, | ||
143 | .start = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH), | ||
144 | .end = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH), | ||
145 | }, { | ||
146 | .flags = IORESOURCE_IRQ, | ||
147 | .start = IRQ_SSP1_DMA, | ||
148 | .end = IRQ_SSP1_DMA, | ||
149 | }, { | ||
150 | .flags = IORESOURCE_IRQ, | ||
151 | .start = IRQ_SSP_ERROR, | ||
152 | .end = IRQ_SSP_ERROR, | ||
153 | }, | ||
154 | }; | ||
155 | |||
156 | struct platform_device stmp3xxx_mmc = { | ||
157 | .name = "stmp3xxx-mmc", | ||
158 | .id = 1, | ||
159 | .dev = { | ||
160 | .dma_mask = &common_dmamask, | ||
161 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
162 | }, | ||
163 | .resource = mmc1_resource, | ||
164 | .num_resources = ARRAY_SIZE(mmc1_resource), | ||
165 | }; | ||
166 | |||
167 | static struct resource usb_resources[] = { | ||
168 | { | ||
169 | .start = REGS_USBCTRL_PHYS, | ||
170 | .end = REGS_USBCTRL_PHYS + SZ_4K, | ||
171 | .flags = IORESOURCE_MEM, | ||
172 | }, { | ||
173 | .start = IRQ_USB_CTRL, | ||
174 | .end = IRQ_USB_CTRL, | ||
175 | .flags = IORESOURCE_IRQ, | ||
176 | }, | ||
177 | }; | ||
178 | |||
179 | struct platform_device stmp3xxx_udc = { | ||
180 | .name = "fsl-usb2-udc", | ||
181 | .id = -1, | ||
182 | .dev = { | ||
183 | .dma_mask = &common_dmamask, | ||
184 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
185 | }, | ||
186 | .resource = usb_resources, | ||
187 | .num_resources = ARRAY_SIZE(usb_resources), | ||
188 | }; | ||
189 | |||
190 | struct platform_device stmp3xxx_ehci = { | ||
191 | .name = "fsl-ehci", | ||
192 | .id = -1, | ||
193 | .dev = { | ||
194 | .dma_mask = &common_dmamask, | ||
195 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
196 | }, | ||
197 | .resource = usb_resources, | ||
198 | .num_resources = ARRAY_SIZE(usb_resources), | ||
199 | }; | ||
200 | |||
201 | static struct resource rtc_resources[] = { | ||
202 | { | ||
203 | .start = REGS_RTC_PHYS, | ||
204 | .end = REGS_RTC_PHYS + REGS_RTC_SIZE, | ||
205 | .flags = IORESOURCE_MEM, | ||
206 | }, { | ||
207 | .start = IRQ_RTC_ALARM, | ||
208 | .end = IRQ_RTC_ALARM, | ||
209 | .flags = IORESOURCE_IRQ, | ||
210 | }, { | ||
211 | .start = IRQ_RTC_1MSEC, | ||
212 | .end = IRQ_RTC_1MSEC, | ||
213 | .flags = IORESOURCE_IRQ, | ||
214 | }, | ||
215 | }; | ||
216 | |||
217 | struct platform_device stmp3xxx_rtc = { | ||
218 | .name = "stmp3xxx-rtc", | ||
219 | .id = -1, | ||
220 | .resource = rtc_resources, | ||
221 | .num_resources = ARRAY_SIZE(rtc_resources), | ||
222 | }; | ||
223 | |||
224 | static struct resource ssp1_resources[] = { | ||
225 | { | ||
226 | .start = REGS_SSP1_PHYS, | ||
227 | .end = REGS_SSP1_PHYS + REGS_SSP_SIZE, | ||
228 | .flags = IORESOURCE_MEM, | ||
229 | }, { | ||
230 | .start = IRQ_SSP1_DMA, | ||
231 | .end = IRQ_SSP1_DMA, | ||
232 | .flags = IORESOURCE_IRQ, | ||
233 | }, { | ||
234 | .start = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH), | ||
235 | .end = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH), | ||
236 | .flags = IORESOURCE_DMA, | ||
237 | }, | ||
238 | }; | ||
239 | |||
240 | static struct resource ssp2_resources[] = { | ||
241 | { | ||
242 | .start = REGS_SSP2_PHYS, | ||
243 | .end = REGS_SSP2_PHYS + REGS_SSP_SIZE, | ||
244 | .flags = IORESOURCE_MEM, | ||
245 | }, { | ||
246 | .start = IRQ_SSP2_DMA, | ||
247 | .end = IRQ_SSP2_DMA, | ||
248 | .flags = IORESOURCE_IRQ, | ||
249 | }, { | ||
250 | .start = STMP3XXX_DMA(2, STMP3XXX_BUS_APBH), | ||
251 | .end = STMP3XXX_DMA(2, STMP3XXX_BUS_APBH), | ||
252 | .flags = IORESOURCE_DMA, | ||
253 | }, | ||
254 | }; | ||
255 | |||
256 | struct platform_device stmp3xxx_spi1 = { | ||
257 | .name = "stmp3xxx_ssp", | ||
258 | .id = 1, | ||
259 | .dev = { | ||
260 | .dma_mask = &common_dmamask, | ||
261 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
262 | }, | ||
263 | .resource = ssp1_resources, | ||
264 | .num_resources = ARRAY_SIZE(ssp1_resources), | ||
265 | }; | ||
266 | |||
267 | struct platform_device stmp3xxx_spi2 = { | ||
268 | .name = "stmp3xxx_ssp", | ||
269 | .id = 2, | ||
270 | .dev = { | ||
271 | .dma_mask = &common_dmamask, | ||
272 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
273 | }, | ||
274 | .resource = ssp2_resources, | ||
275 | .num_resources = ARRAY_SIZE(ssp2_resources), | ||
276 | }; | ||
277 | |||
278 | static struct resource fb_resource[] = { | ||
279 | { | ||
280 | .flags = IORESOURCE_IRQ, | ||
281 | .start = IRQ_LCDIF_DMA, | ||
282 | .end = IRQ_LCDIF_DMA, | ||
283 | }, { | ||
284 | .flags = IORESOURCE_IRQ, | ||
285 | .start = IRQ_LCDIF_ERROR, | ||
286 | .end = IRQ_LCDIF_ERROR, | ||
287 | }, { | ||
288 | .flags = IORESOURCE_MEM, | ||
289 | .start = REGS_LCDIF_PHYS, | ||
290 | .end = REGS_LCDIF_PHYS + REGS_LCDIF_SIZE, | ||
291 | }, | ||
292 | }; | ||
293 | |||
294 | struct platform_device stmp3xxx_framebuffer = { | ||
295 | .name = "stmp3xxx-fb", | ||
296 | .id = -1, | ||
297 | .dev = { | ||
298 | .dma_mask = &common_dmamask, | ||
299 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
300 | }, | ||
301 | .num_resources = ARRAY_SIZE(fb_resource), | ||
302 | .resource = fb_resource, | ||
303 | }; | ||
304 | |||
305 | #define CMDLINE_DEVICE_CHOOSE(name, dev1, dev2) \ | ||
306 | static char *cmdline_device_##name; \ | ||
307 | static int cmdline_device_##name##_setup(char *dev) \ | ||
308 | { \ | ||
309 | cmdline_device_##name = dev + 1; \ | ||
310 | return 0; \ | ||
311 | } \ | ||
312 | __setup(#name, cmdline_device_##name##_setup); \ | ||
313 | int stmp3xxx_##name##_device_register(void) \ | ||
314 | { \ | ||
315 | struct platform_device *d = NULL; \ | ||
316 | if (!cmdline_device_##name || \ | ||
317 | !strcmp(cmdline_device_##name, #dev1)) \ | ||
318 | d = &stmp3xxx_##dev1; \ | ||
319 | else if (!strcmp(cmdline_device_##name, #dev2)) \ | ||
320 | d = &stmp3xxx_##dev2; \ | ||
321 | else \ | ||
322 | printk(KERN_ERR"Unknown %s assignment '%s'.\n", \ | ||
323 | #name, cmdline_device_##name); \ | ||
324 | return d ? platform_device_register(d) : -ENOENT; \ | ||
325 | } | ||
326 | |||
327 | CMDLINE_DEVICE_CHOOSE(ssp1, mmc, spi1) | ||
328 | CMDLINE_DEVICE_CHOOSE(ssp2, gpmi, spi2) | ||
329 | |||
330 | struct platform_device stmp3xxx_backlight = { | ||
331 | .name = "stmp3xxx-bl", | ||
332 | .id = -1, | ||
333 | }; | ||
334 | |||
335 | struct platform_device stmp3xxx_rotdec = { | ||
336 | .name = "stmp3xxx-rotdec", | ||
337 | .id = -1, | ||
338 | }; | ||
339 | |||
340 | struct platform_device stmp3xxx_persistent = { | ||
341 | .name = "stmp3xxx-persistent", | ||
342 | .id = -1, | ||
343 | }; | ||
344 | |||
345 | struct platform_device stmp3xxx_dcp_bootstream = { | ||
346 | .name = "stmp3xxx-dcpboot", | ||
347 | .id = -1, | ||
348 | .dev = { | ||
349 | .dma_mask = &common_dmamask, | ||
350 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
351 | }, | ||
352 | }; | ||
353 | |||
354 | static struct resource dcp_resources[] = { | ||
355 | { | ||
356 | .start = IRQ_DCP_VMI, | ||
357 | .end = IRQ_DCP_VMI, | ||
358 | .flags = IORESOURCE_IRQ, | ||
359 | }, { | ||
360 | .start = IRQ_DCP, | ||
361 | .end = IRQ_DCP, | ||
362 | .flags = IORESOURCE_IRQ, | ||
363 | }, | ||
364 | }; | ||
365 | |||
366 | struct platform_device stmp3xxx_dcp = { | ||
367 | .name = "stmp3xxx-dcp", | ||
368 | .id = -1, | ||
369 | .resource = dcp_resources, | ||
370 | .num_resources = ARRAY_SIZE(dcp_resources), | ||
371 | .dev = { | ||
372 | .dma_mask = &common_dmamask, | ||
373 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
374 | }, | ||
375 | }; | ||
376 | |||
377 | static struct resource battery_resource[] = { | ||
378 | { | ||
379 | .flags = IORESOURCE_IRQ, | ||
380 | .start = IRQ_VDD5V, | ||
381 | .end = IRQ_VDD5V, | ||
382 | }, | ||
383 | }; | ||
384 | |||
385 | struct platform_device stmp3xxx_battery = { | ||
386 | .name = "stmp3xxx-battery", | ||
387 | .resource = battery_resource, | ||
388 | .num_resources = ARRAY_SIZE(battery_resource), | ||
389 | }; | ||