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