]>
Commit | Line | Data |
---|---|---|
a21765a7 | 1 | /* linux/arch/arm/plat-s3c24xx/devs.c |
1da177e4 LT |
2 | * |
3 | * Copyright (c) 2004 Simtec Electronics | |
916a0021 | 4 | * Ben Dooks <ben@simtec.co.uk> |
1da177e4 | 5 | * |
916a0021 | 6 | * Base S3C24XX platform device definitions |
1da177e4 LT |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | * | |
1da177e4 LT |
12 | */ |
13 | ||
14 | #include <linux/kernel.h> | |
15 | #include <linux/types.h> | |
16 | #include <linux/interrupt.h> | |
17 | #include <linux/list.h> | |
18 | #include <linux/timer.h> | |
19 | #include <linux/init.h> | |
b6d1f542 | 20 | #include <linux/serial_core.h> |
d052d1be | 21 | #include <linux/platform_device.h> |
fced80c7 | 22 | #include <linux/io.h> |
5a0e3ad6 | 23 | #include <linux/slab.h> |
f44c67cd | 24 | #include <linux/string.h> |
1da177e4 LT |
25 | |
26 | #include <asm/mach/arch.h> | |
27 | #include <asm/mach/map.h> | |
28 | #include <asm/mach/irq.h> | |
a09e64fb RK |
29 | #include <mach/fb.h> |
30 | #include <mach/hardware.h> | |
d91e9a7a MB |
31 | #include <mach/dma.h> |
32 | #include <mach/irqs.h> | |
1da177e4 LT |
33 | #include <asm/irq.h> |
34 | ||
a2b7ba9c | 35 | #include <plat/regs-serial.h> |
57bd4b91 | 36 | #include <plat/udc.h> |
22c810ab | 37 | #include <plat/mci.h> |
1da177e4 | 38 | |
a2b7ba9c BD |
39 | #include <plat/devs.h> |
40 | #include <plat/cpu.h> | |
13622708 | 41 | #include <plat/regs-spi.h> |
73e59b1d | 42 | #include <plat/ts.h> |
ce8877b5 | 43 | |
1da177e4 LT |
44 | /* Serial port registrations */ |
45 | ||
66a9b49a BD |
46 | static struct resource s3c2410_uart0_resource[] = { |
47 | [0] = { | |
48 | .start = S3C2410_PA_UART0, | |
49 | .end = S3C2410_PA_UART0 + 0x3fff, | |
50 | .flags = IORESOURCE_MEM, | |
51 | }, | |
52 | [1] = { | |
53 | .start = IRQ_S3CUART_RX0, | |
54 | .end = IRQ_S3CUART_ERR0, | |
55 | .flags = IORESOURCE_IRQ, | |
56 | } | |
57 | }; | |
58 | ||
59 | static struct resource s3c2410_uart1_resource[] = { | |
60 | [0] = { | |
61 | .start = S3C2410_PA_UART1, | |
62 | .end = S3C2410_PA_UART1 + 0x3fff, | |
63 | .flags = IORESOURCE_MEM, | |
64 | }, | |
65 | [1] = { | |
66 | .start = IRQ_S3CUART_RX1, | |
67 | .end = IRQ_S3CUART_ERR1, | |
68 | .flags = IORESOURCE_IRQ, | |
69 | } | |
70 | }; | |
71 | ||
72 | static struct resource s3c2410_uart2_resource[] = { | |
73 | [0] = { | |
74 | .start = S3C2410_PA_UART2, | |
75 | .end = S3C2410_PA_UART2 + 0x3fff, | |
76 | .flags = IORESOURCE_MEM, | |
77 | }, | |
78 | [1] = { | |
79 | .start = IRQ_S3CUART_RX2, | |
80 | .end = IRQ_S3CUART_ERR2, | |
81 | .flags = IORESOURCE_IRQ, | |
82 | } | |
83 | }; | |
84 | ||
dbf35992 BD |
85 | static struct resource s3c2410_uart3_resource[] = { |
86 | [0] = { | |
87 | .start = S3C2443_PA_UART3, | |
88 | .end = S3C2443_PA_UART3 + 0x3fff, | |
89 | .flags = IORESOURCE_MEM, | |
90 | }, | |
91 | [1] = { | |
92 | .start = IRQ_S3CUART_RX3, | |
93 | .end = IRQ_S3CUART_ERR3, | |
94 | .flags = IORESOURCE_IRQ, | |
95 | }, | |
96 | }; | |
97 | ||
66a9b49a BD |
98 | struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = { |
99 | [0] = { | |
100 | .resources = s3c2410_uart0_resource, | |
101 | .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource), | |
102 | }, | |
103 | [1] = { | |
104 | .resources = s3c2410_uart1_resource, | |
105 | .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource), | |
106 | }, | |
107 | [2] = { | |
108 | .resources = s3c2410_uart2_resource, | |
109 | .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource), | |
110 | }, | |
dbf35992 BD |
111 | [3] = { |
112 | .resources = s3c2410_uart3_resource, | |
113 | .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource), | |
114 | }, | |
66a9b49a BD |
115 | }; |
116 | ||
1da177e4 LT |
117 | /* LCD Controller */ |
118 | ||
119 | static struct resource s3c_lcd_resource[] = { | |
120 | [0] = { | |
0367a8d3 LCVR |
121 | .start = S3C24XX_PA_LCD, |
122 | .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1, | |
1da177e4 LT |
123 | .flags = IORESOURCE_MEM, |
124 | }, | |
125 | [1] = { | |
126 | .start = IRQ_LCD, | |
127 | .end = IRQ_LCD, | |
128 | .flags = IORESOURCE_IRQ, | |
129 | } | |
130 | ||
131 | }; | |
132 | ||
133 | static u64 s3c_device_lcd_dmamask = 0xffffffffUL; | |
134 | ||
135 | struct platform_device s3c_device_lcd = { | |
136 | .name = "s3c2410-lcd", | |
137 | .id = -1, | |
138 | .num_resources = ARRAY_SIZE(s3c_lcd_resource), | |
139 | .resource = s3c_lcd_resource, | |
140 | .dev = { | |
6904b246 BD |
141 | .dma_mask = &s3c_device_lcd_dmamask, |
142 | .coherent_dma_mask = 0xffffffffUL | |
1da177e4 LT |
143 | } |
144 | }; | |
145 | ||
146 | EXPORT_SYMBOL(s3c_device_lcd); | |
147 | ||
893b0309 | 148 | void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd) |
f92273c1 | 149 | { |
893b0309 BD |
150 | struct s3c2410fb_mach_info *npd; |
151 | ||
f44c67cd | 152 | npd = kmemdup(pd, sizeof(*npd), GFP_KERNEL); |
893b0309 | 153 | if (npd) { |
893b0309 | 154 | s3c_device_lcd.dev.platform_data = npd; |
f44c67cd AP |
155 | npd->displays = kmemdup(pd->displays, |
156 | sizeof(struct s3c2410fb_display) * npd->num_displays, | |
157 | GFP_KERNEL); | |
158 | if (!npd->displays) | |
159 | printk(KERN_ERR "no memory for LCD display data\n"); | |
893b0309 BD |
160 | } else { |
161 | printk(KERN_ERR "no memory for LCD platform data\n"); | |
162 | } | |
f92273c1 | 163 | } |
f92273c1 | 164 | |
ce8877b5 | 165 | /* Touchscreen */ |
0fe1309b VK |
166 | |
167 | static struct resource s3c_ts_resource[] = { | |
168 | [0] = { | |
169 | .start = S3C24XX_PA_ADC, | |
170 | .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1, | |
171 | .flags = IORESOURCE_MEM, | |
172 | }, | |
173 | [1] = { | |
174 | .start = IRQ_TC, | |
175 | .end = IRQ_TC, | |
176 | .flags = IORESOURCE_IRQ, | |
177 | }, | |
178 | ||
179 | }; | |
180 | ||
ce8877b5 AP |
181 | struct platform_device s3c_device_ts = { |
182 | .name = "s3c2410-ts", | |
183 | .id = -1, | |
0fe1309b VK |
184 | .dev.parent = &s3c_device_adc.dev, |
185 | .num_resources = ARRAY_SIZE(s3c_ts_resource), | |
186 | .resource = s3c_ts_resource, | |
ce8877b5 AP |
187 | }; |
188 | EXPORT_SYMBOL(s3c_device_ts); | |
189 | ||
190 | static struct s3c2410_ts_mach_info s3c2410ts_info; | |
191 | ||
192 | void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info) | |
193 | { | |
194 | memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info)); | |
195 | s3c_device_ts.dev.platform_data = &s3c2410ts_info; | |
196 | } | |
197 | EXPORT_SYMBOL(s3c24xx_ts_set_platdata); | |
198 | ||
1da177e4 LT |
199 | /* USB Device (Gadget)*/ |
200 | ||
201 | static struct resource s3c_usbgadget_resource[] = { | |
202 | [0] = { | |
0367a8d3 LCVR |
203 | .start = S3C24XX_PA_USBDEV, |
204 | .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1, | |
1da177e4 LT |
205 | .flags = IORESOURCE_MEM, |
206 | }, | |
207 | [1] = { | |
208 | .start = IRQ_USBD, | |
209 | .end = IRQ_USBD, | |
210 | .flags = IORESOURCE_IRQ, | |
211 | } | |
212 | ||
213 | }; | |
214 | ||
215 | struct platform_device s3c_device_usbgadget = { | |
216 | .name = "s3c2410-usbgadget", | |
217 | .id = -1, | |
218 | .num_resources = ARRAY_SIZE(s3c_usbgadget_resource), | |
219 | .resource = s3c_usbgadget_resource, | |
220 | }; | |
221 | ||
222 | EXPORT_SYMBOL(s3c_device_usbgadget); | |
223 | ||
0dcfc328 AP |
224 | void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd) |
225 | { | |
226 | struct s3c2410_udc_mach_info *npd; | |
227 | ||
228 | npd = kmalloc(sizeof(*npd), GFP_KERNEL); | |
229 | if (npd) { | |
230 | memcpy(npd, pd, sizeof(*npd)); | |
231 | s3c_device_usbgadget.dev.platform_data = npd; | |
232 | } else { | |
233 | printk(KERN_ERR "no memory for udc platform data\n"); | |
234 | } | |
235 | } | |
236 | ||
1da177e4 LT |
237 | /* IIS */ |
238 | ||
239 | static struct resource s3c_iis_resource[] = { | |
240 | [0] = { | |
0367a8d3 LCVR |
241 | .start = S3C24XX_PA_IIS, |
242 | .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1, | |
1da177e4 LT |
243 | .flags = IORESOURCE_MEM, |
244 | } | |
245 | }; | |
246 | ||
247 | static u64 s3c_device_iis_dmamask = 0xffffffffUL; | |
248 | ||
249 | struct platform_device s3c_device_iis = { | |
250 | .name = "s3c2410-iis", | |
251 | .id = -1, | |
252 | .num_resources = ARRAY_SIZE(s3c_iis_resource), | |
253 | .resource = s3c_iis_resource, | |
254 | .dev = { | |
255 | .dma_mask = &s3c_device_iis_dmamask, | |
256 | .coherent_dma_mask = 0xffffffffUL | |
257 | } | |
258 | }; | |
259 | ||
260 | EXPORT_SYMBOL(s3c_device_iis); | |
261 | ||
262 | /* RTC */ | |
263 | ||
264 | static struct resource s3c_rtc_resource[] = { | |
265 | [0] = { | |
0367a8d3 LCVR |
266 | .start = S3C24XX_PA_RTC, |
267 | .end = S3C24XX_PA_RTC + 0xff, | |
1da177e4 LT |
268 | .flags = IORESOURCE_MEM, |
269 | }, | |
270 | [1] = { | |
271 | .start = IRQ_RTC, | |
272 | .end = IRQ_RTC, | |
273 | .flags = IORESOURCE_IRQ, | |
274 | }, | |
275 | [2] = { | |
276 | .start = IRQ_TICK, | |
277 | .end = IRQ_TICK, | |
278 | .flags = IORESOURCE_IRQ | |
279 | } | |
280 | }; | |
281 | ||
282 | struct platform_device s3c_device_rtc = { | |
283 | .name = "s3c2410-rtc", | |
284 | .id = -1, | |
285 | .num_resources = ARRAY_SIZE(s3c_rtc_resource), | |
286 | .resource = s3c_rtc_resource, | |
287 | }; | |
288 | ||
289 | EXPORT_SYMBOL(s3c_device_rtc); | |
290 | ||
291 | /* ADC */ | |
292 | ||
293 | static struct resource s3c_adc_resource[] = { | |
294 | [0] = { | |
0367a8d3 LCVR |
295 | .start = S3C24XX_PA_ADC, |
296 | .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1, | |
1da177e4 LT |
297 | .flags = IORESOURCE_MEM, |
298 | }, | |
299 | [1] = { | |
300 | .start = IRQ_TC, | |
083d06ed BD |
301 | .end = IRQ_TC, |
302 | .flags = IORESOURCE_IRQ, | |
303 | }, | |
304 | [2] = { | |
305 | .start = IRQ_ADC, | |
1da177e4 LT |
306 | .end = IRQ_ADC, |
307 | .flags = IORESOURCE_IRQ, | |
308 | } | |
309 | ||
310 | }; | |
311 | ||
312 | struct platform_device s3c_device_adc = { | |
28ab44c5 | 313 | .name = "s3c24xx-adc", |
1da177e4 LT |
314 | .id = -1, |
315 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | |
316 | .resource = s3c_adc_resource, | |
317 | }; | |
318 | ||
319 | /* SDI */ | |
320 | ||
321 | static struct resource s3c_sdi_resource[] = { | |
322 | [0] = { | |
ce46a9c4 BD |
323 | .start = S3C24XX_PA_SDI, |
324 | .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1, | |
1da177e4 LT |
325 | .flags = IORESOURCE_MEM, |
326 | }, | |
327 | [1] = { | |
328 | .start = IRQ_SDI, | |
329 | .end = IRQ_SDI, | |
330 | .flags = IORESOURCE_IRQ, | |
331 | } | |
332 | ||
333 | }; | |
334 | ||
335 | struct platform_device s3c_device_sdi = { | |
336 | .name = "s3c2410-sdi", | |
337 | .id = -1, | |
338 | .num_resources = ARRAY_SIZE(s3c_sdi_resource), | |
339 | .resource = s3c_sdi_resource, | |
340 | }; | |
341 | ||
342 | EXPORT_SYMBOL(s3c_device_sdi); | |
343 | ||
1f138f13 | 344 | void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata) |
22c810ab BD |
345 | { |
346 | struct s3c24xx_mci_pdata *npd; | |
347 | ||
348 | npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL); | |
349 | if (!npd) | |
350 | printk(KERN_ERR "%s: no memory to copy pdata", __func__); | |
351 | ||
352 | s3c_device_sdi.dev.platform_data = npd; | |
353 | } | |
354 | ||
355 | ||
1da177e4 LT |
356 | /* SPI (0) */ |
357 | ||
358 | static struct resource s3c_spi0_resource[] = { | |
359 | [0] = { | |
0367a8d3 LCVR |
360 | .start = S3C24XX_PA_SPI, |
361 | .end = S3C24XX_PA_SPI + 0x1f, | |
1da177e4 LT |
362 | .flags = IORESOURCE_MEM, |
363 | }, | |
364 | [1] = { | |
365 | .start = IRQ_SPI0, | |
366 | .end = IRQ_SPI0, | |
367 | .flags = IORESOURCE_IRQ, | |
368 | } | |
369 | ||
370 | }; | |
371 | ||