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