blob: 145580a4a62cf7a07b5a6a145ed22902136b3ff3 [file] [log] [blame]
Kukjin Kim61c542b2011-10-03 09:46:13 +09001/* linux/arch/arm/plat-samsung/devs.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Base SAMSUNG platform device definitions
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*/
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
19#include <linux/serial_core.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/slab.h>
23#include <linux/string.h>
24#include <linux/dma-mapping.h>
Kukjin Kim57167142011-10-03 09:46:56 +090025#include <linux/fb.h>
26#include <linux/gfp.h>
Kukjin Kim0523ec32011-10-03 09:46:56 +090027#include <linux/mtd/mtd.h>
28#include <linux/mtd/onenand.h>
Kukjin Kimbad1e6a2011-10-03 09:47:58 +090029#include <linux/mtd/partitions.h>
30#include <linux/mmc/host.h>
Kukjin Kim57167142011-10-03 09:46:56 +090031#include <linux/ioport.h>
Heiko Stübner715a3e42011-12-19 19:39:15 +010032#include <linux/platform_data/s3c-hsudc.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090033
34#include <asm/irq.h>
Kukjin Kim57167142011-10-03 09:46:56 +090035#include <asm/pmu.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090036#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <mach/hardware.h>
41#include <mach/dma.h>
42#include <mach/irqs.h>
43#include <mach/map.h>
44
45#include <plat/cpu.h>
46#include <plat/devs.h>
Kukjin Kimbad1e6a2011-10-03 09:47:58 +090047#include <plat/adc.h>
48#include <plat/ata.h>
Kukjin Kim57167142011-10-03 09:46:56 +090049#include <plat/ehci.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090050#include <plat/fb.h>
51#include <plat/fb-s3c2410.h>
Kukjin Kimbad1e6a2011-10-03 09:47:58 +090052#include <plat/hwmon.h>
Kukjin Kim57167142011-10-03 09:46:56 +090053#include <plat/iic.h>
Kukjin Kimbad1e6a2011-10-03 09:47:58 +090054#include <plat/keypad.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090055#include <plat/mci.h>
Kukjin Kimbad1e6a2011-10-03 09:47:58 +090056#include <plat/nand.h>
57#include <plat/sdhci.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090058#include <plat/ts.h>
59#include <plat/udc.h>
Kukjin Kimbad1e6a2011-10-03 09:47:58 +090060#include <plat/usb-control.h>
Kukjin Kim57167142011-10-03 09:46:56 +090061#include <plat/usb-phy.h>
62#include <plat/regs-iic.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090063#include <plat/regs-serial.h>
64#include <plat/regs-spi.h>
Padmavathi Venna875a5932011-12-23 10:14:31 +090065#include <plat/s3c64xx-spi.h>
Kukjin Kim61c542b2011-10-03 09:46:13 +090066
67static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
68
69/* AC97 */
70#ifdef CONFIG_CPU_S3C2440
71static struct resource s3c_ac97_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +090072 [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
73 [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
74 [2] = DEFINE_RES_DMA_NAMED(DMACH_PCM_OUT, "PCM out"),
75 [3] = DEFINE_RES_DMA_NAMED(DMACH_PCM_IN, "PCM in"),
76 [4] = DEFINE_RES_DMA_NAMED(DMACH_MIC_IN, "Mic in"),
Kukjin Kim61c542b2011-10-03 09:46:13 +090077};
78
79struct platform_device s3c_device_ac97 = {
80 .name = "samsung-ac97",
81 .id = -1,
82 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
83 .resource = s3c_ac97_resource,
84 .dev = {
85 .dma_mask = &samsung_device_dma_mask,
86 .coherent_dma_mask = DMA_BIT_MASK(32),
87 }
88};
89#endif /* CONFIG_CPU_S3C2440 */
90
91/* ADC */
92
93#ifdef CONFIG_PLAT_S3C24XX
94static struct resource s3c_adc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +090095 [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
96 [1] = DEFINE_RES_IRQ(IRQ_TC),
97 [2] = DEFINE_RES_IRQ(IRQ_ADC),
Kukjin Kim61c542b2011-10-03 09:46:13 +090098};
99
100struct platform_device s3c_device_adc = {
101 .name = "s3c24xx-adc",
102 .id = -1,
103 .num_resources = ARRAY_SIZE(s3c_adc_resource),
104 .resource = s3c_adc_resource,
105};
106#endif /* CONFIG_PLAT_S3C24XX */
107
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900108#if defined(CONFIG_SAMSUNG_DEV_ADC)
109static struct resource s3c_adc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900110 [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
111 [1] = DEFINE_RES_IRQ(IRQ_TC),
112 [2] = DEFINE_RES_IRQ(IRQ_ADC),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900113};
114
115struct platform_device s3c_device_adc = {
116 .name = "samsung-adc",
117 .id = -1,
118 .num_resources = ARRAY_SIZE(s3c_adc_resource),
119 .resource = s3c_adc_resource,
120};
121#endif /* CONFIG_SAMSUNG_DEV_ADC */
122
Kukjin Kim61c542b2011-10-03 09:46:13 +0900123/* Camif Controller */
124
125#ifdef CONFIG_CPU_S3C2440
126static struct resource s3c_camif_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900127 [0] = DEFINE_RES_MEM(S3C2440_PA_CAMIF, S3C2440_SZ_CAMIF),
128 [1] = DEFINE_RES_IRQ(IRQ_CAM),
Kukjin Kim61c542b2011-10-03 09:46:13 +0900129};
130
131struct platform_device s3c_device_camif = {
132 .name = "s3c2440-camif",
133 .id = -1,
134 .num_resources = ARRAY_SIZE(s3c_camif_resource),
135 .resource = s3c_camif_resource,
136 .dev = {
137 .dma_mask = &samsung_device_dma_mask,
138 .coherent_dma_mask = DMA_BIT_MASK(32),
139 }
140};
141#endif /* CONFIG_CPU_S3C2440 */
142
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900143/* ASOC DMA */
144
145struct platform_device samsung_asoc_dma = {
146 .name = "samsung-audio",
147 .id = -1,
148 .dev = {
149 .dma_mask = &samsung_device_dma_mask,
150 .coherent_dma_mask = DMA_BIT_MASK(32),
151 }
152};
153
154struct platform_device samsung_asoc_idma = {
155 .name = "samsung-idma",
156 .id = -1,
157 .dev = {
158 .dma_mask = &samsung_device_dma_mask,
159 .coherent_dma_mask = DMA_BIT_MASK(32),
160 }
161};
162
163/* FB */
164
165#ifdef CONFIG_S3C_DEV_FB
166static struct resource s3c_fb_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900167 [0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K),
168 [1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC),
169 [2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO),
170 [3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900171};
172
173struct platform_device s3c_device_fb = {
174 .name = "s3c-fb",
175 .id = -1,
176 .num_resources = ARRAY_SIZE(s3c_fb_resource),
177 .resource = s3c_fb_resource,
178 .dev = {
179 .dma_mask = &samsung_device_dma_mask,
180 .coherent_dma_mask = DMA_BIT_MASK(32),
181 },
182};
183
184void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
185{
186 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
187 &s3c_device_fb);
188}
189#endif /* CONFIG_S3C_DEV_FB */
190
Kukjin Kim57167142011-10-03 09:46:56 +0900191/* FIMC */
192
193#ifdef CONFIG_S5P_DEV_FIMC0
194static struct resource s5p_fimc0_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900195 [0] = DEFINE_RES_MEM(S5P_PA_FIMC0, SZ_4K),
196 [1] = DEFINE_RES_IRQ(IRQ_FIMC0),
Kukjin Kim57167142011-10-03 09:46:56 +0900197};
198
199struct platform_device s5p_device_fimc0 = {
200 .name = "s5p-fimc",
201 .id = 0,
202 .num_resources = ARRAY_SIZE(s5p_fimc0_resource),
203 .resource = s5p_fimc0_resource,
204 .dev = {
205 .dma_mask = &samsung_device_dma_mask,
206 .coherent_dma_mask = DMA_BIT_MASK(32),
207 },
208};
Sylwester Nawrocki07e87e12011-10-13 15:41:51 +0900209
210struct platform_device s5p_device_fimc_md = {
211 .name = "s5p-fimc-md",
212 .id = -1,
213};
Kukjin Kim57167142011-10-03 09:46:56 +0900214#endif /* CONFIG_S5P_DEV_FIMC0 */
215
216#ifdef CONFIG_S5P_DEV_FIMC1
217static struct resource s5p_fimc1_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900218 [0] = DEFINE_RES_MEM(S5P_PA_FIMC1, SZ_4K),
219 [1] = DEFINE_RES_IRQ(IRQ_FIMC1),
Kukjin Kim57167142011-10-03 09:46:56 +0900220};
221
222struct platform_device s5p_device_fimc1 = {
223 .name = "s5p-fimc",
224 .id = 1,
225 .num_resources = ARRAY_SIZE(s5p_fimc1_resource),
226 .resource = s5p_fimc1_resource,
227 .dev = {
228 .dma_mask = &samsung_device_dma_mask,
229 .coherent_dma_mask = DMA_BIT_MASK(32),
230 },
231};
232#endif /* CONFIG_S5P_DEV_FIMC1 */
233
234#ifdef CONFIG_S5P_DEV_FIMC2
235static struct resource s5p_fimc2_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900236 [0] = DEFINE_RES_MEM(S5P_PA_FIMC2, SZ_4K),
237 [1] = DEFINE_RES_IRQ(IRQ_FIMC2),
Kukjin Kim57167142011-10-03 09:46:56 +0900238};
239
240struct platform_device s5p_device_fimc2 = {
241 .name = "s5p-fimc",
242 .id = 2,
243 .num_resources = ARRAY_SIZE(s5p_fimc2_resource),
244 .resource = s5p_fimc2_resource,
245 .dev = {
246 .dma_mask = &samsung_device_dma_mask,
247 .coherent_dma_mask = DMA_BIT_MASK(32),
248 },
249};
250#endif /* CONFIG_S5P_DEV_FIMC2 */
251
252#ifdef CONFIG_S5P_DEV_FIMC3
253static struct resource s5p_fimc3_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900254 [0] = DEFINE_RES_MEM(S5P_PA_FIMC3, SZ_4K),
255 [1] = DEFINE_RES_IRQ(IRQ_FIMC3),
Kukjin Kim57167142011-10-03 09:46:56 +0900256};
257
258struct platform_device s5p_device_fimc3 = {
259 .name = "s5p-fimc",
260 .id = 3,
261 .num_resources = ARRAY_SIZE(s5p_fimc3_resource),
262 .resource = s5p_fimc3_resource,
263 .dev = {
264 .dma_mask = &samsung_device_dma_mask,
265 .coherent_dma_mask = DMA_BIT_MASK(32),
266 },
267};
268#endif /* CONFIG_S5P_DEV_FIMC3 */
269
Kamil Debski561ab532011-12-27 17:16:44 +0900270/* G2D */
271
272#ifdef CONFIG_S5P_DEV_G2D
273static struct resource s5p_g2d_resource[] = {
274 [0] = {
275 .start = S5P_PA_G2D,
276 .end = S5P_PA_G2D + SZ_4K - 1,
277 .flags = IORESOURCE_MEM,
278 },
279 [1] = {
280 .start = IRQ_2D,
281 .end = IRQ_2D,
282 .flags = IORESOURCE_IRQ,
283 },
284};
285
286struct platform_device s5p_device_g2d = {
287 .name = "s5p-g2d",
288 .id = 0,
289 .num_resources = ARRAY_SIZE(s5p_g2d_resource),
290 .resource = s5p_g2d_resource,
291 .dev = {
292 .dma_mask = &samsung_device_dma_mask,
293 .coherent_dma_mask = DMA_BIT_MASK(32),
294 },
295};
296#endif /* CONFIG_S5P_DEV_G2D */
297
Kukjin Kim57167142011-10-03 09:46:56 +0900298/* FIMD0 */
299
300#ifdef CONFIG_S5P_DEV_FIMD0
301static struct resource s5p_fimd0_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900302 [0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K),
303 [1] = DEFINE_RES_IRQ(IRQ_FIMD0_VSYNC),
304 [2] = DEFINE_RES_IRQ(IRQ_FIMD0_FIFO),
305 [3] = DEFINE_RES_IRQ(IRQ_FIMD0_SYSTEM),
Kukjin Kim57167142011-10-03 09:46:56 +0900306};
307
308struct platform_device s5p_device_fimd0 = {
309 .name = "s5p-fb",
310 .id = 0,
311 .num_resources = ARRAY_SIZE(s5p_fimd0_resource),
312 .resource = s5p_fimd0_resource,
313 .dev = {
314 .dma_mask = &samsung_device_dma_mask,
315 .coherent_dma_mask = DMA_BIT_MASK(32),
316 },
317};
318
319void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd)
320{
321 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
322 &s5p_device_fimd0);
323}
324#endif /* CONFIG_S5P_DEV_FIMD0 */
325
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900326/* HWMON */
327
328#ifdef CONFIG_S3C_DEV_HWMON
329struct platform_device s3c_device_hwmon = {
330 .name = "s3c-hwmon",
331 .id = -1,
332 .dev.parent = &s3c_device_adc.dev,
333};
334
335void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
336{
337 s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
338 &s3c_device_hwmon);
339}
340#endif /* CONFIG_S3C_DEV_HWMON */
341
342/* HSMMC */
343
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900344#ifdef CONFIG_S3C_DEV_HSMMC
345static struct resource s3c_hsmmc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900346 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC0, SZ_4K),
347 [1] = DEFINE_RES_IRQ(IRQ_HSMMC0),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900348};
349
350struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
351 .max_width = 4,
352 .host_caps = (MMC_CAP_4_BIT_DATA |
353 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
354 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
355};
356
357struct platform_device s3c_device_hsmmc0 = {
358 .name = "s3c-sdhci",
359 .id = 0,
360 .num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
361 .resource = s3c_hsmmc_resource,
362 .dev = {
363 .dma_mask = &samsung_device_dma_mask,
364 .coherent_dma_mask = DMA_BIT_MASK(32),
365 .platform_data = &s3c_hsmmc0_def_platdata,
366 },
367};
368
369void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
370{
371 s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
372}
373#endif /* CONFIG_S3C_DEV_HSMMC */
374
375#ifdef CONFIG_S3C_DEV_HSMMC1
376static struct resource s3c_hsmmc1_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900377 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC1, SZ_4K),
378 [1] = DEFINE_RES_IRQ(IRQ_HSMMC1),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900379};
380
381struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
382 .max_width = 4,
383 .host_caps = (MMC_CAP_4_BIT_DATA |
384 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
385 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
386};
387
388struct platform_device s3c_device_hsmmc1 = {
389 .name = "s3c-sdhci",
390 .id = 1,
391 .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource),
392 .resource = s3c_hsmmc1_resource,
393 .dev = {
394 .dma_mask = &samsung_device_dma_mask,
395 .coherent_dma_mask = DMA_BIT_MASK(32),
396 .platform_data = &s3c_hsmmc1_def_platdata,
397 },
398};
399
400void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
401{
402 s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
403}
404#endif /* CONFIG_S3C_DEV_HSMMC1 */
405
406/* HSMMC2 */
407
408#ifdef CONFIG_S3C_DEV_HSMMC2
409static struct resource s3c_hsmmc2_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900410 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC2, SZ_4K),
411 [1] = DEFINE_RES_IRQ(IRQ_HSMMC2),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900412};
413
414struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
415 .max_width = 4,
416 .host_caps = (MMC_CAP_4_BIT_DATA |
417 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
418 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
419};
420
421struct platform_device s3c_device_hsmmc2 = {
422 .name = "s3c-sdhci",
423 .id = 2,
424 .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
425 .resource = s3c_hsmmc2_resource,
426 .dev = {
427 .dma_mask = &samsung_device_dma_mask,
428 .coherent_dma_mask = DMA_BIT_MASK(32),
429 .platform_data = &s3c_hsmmc2_def_platdata,
430 },
431};
432
433void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
434{
435 s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
436}
437#endif /* CONFIG_S3C_DEV_HSMMC2 */
438
439#ifdef CONFIG_S3C_DEV_HSMMC3
440static struct resource s3c_hsmmc3_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900441 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC3, SZ_4K),
442 [1] = DEFINE_RES_IRQ(IRQ_HSMMC3),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900443};
444
445struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
446 .max_width = 4,
447 .host_caps = (MMC_CAP_4_BIT_DATA |
448 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
449 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
450};
451
452struct platform_device s3c_device_hsmmc3 = {
453 .name = "s3c-sdhci",
454 .id = 3,
455 .num_resources = ARRAY_SIZE(s3c_hsmmc3_resource),
456 .resource = s3c_hsmmc3_resource,
457 .dev = {
458 .dma_mask = &samsung_device_dma_mask,
459 .coherent_dma_mask = DMA_BIT_MASK(32),
460 .platform_data = &s3c_hsmmc3_def_platdata,
461 },
462};
463
464void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
465{
466 s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
467}
468#endif /* CONFIG_S3C_DEV_HSMMC3 */
469
470/* I2C */
471
472static struct resource s3c_i2c0_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900473 [0] = DEFINE_RES_MEM(S3C_PA_IIC, SZ_4K),
474 [1] = DEFINE_RES_IRQ(IRQ_IIC),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900475};
476
477struct platform_device s3c_device_i2c0 = {
478 .name = "s3c2410-i2c",
479#ifdef CONFIG_S3C_DEV_I2C1
480 .id = 0,
481#else
482 .id = -1,
483#endif
484 .num_resources = ARRAY_SIZE(s3c_i2c0_resource),
485 .resource = s3c_i2c0_resource,
486};
487
488struct s3c2410_platform_i2c default_i2c_data __initdata = {
489 .flags = 0,
490 .slave_addr = 0x10,
491 .frequency = 100*1000,
492 .sda_delay = 100,
493};
494
495void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
496{
497 struct s3c2410_platform_i2c *npd;
498
499 if (!pd)
500 pd = &default_i2c_data;
501
502 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
503 &s3c_device_i2c0);
504
505 if (!npd->cfg_gpio)
506 npd->cfg_gpio = s3c_i2c0_cfg_gpio;
507}
508
509#ifdef CONFIG_S3C_DEV_I2C1
510static struct resource s3c_i2c1_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900511 [0] = DEFINE_RES_MEM(S3C_PA_IIC1, SZ_4K),
512 [1] = DEFINE_RES_IRQ(IRQ_IIC1),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900513};
514
515struct platform_device s3c_device_i2c1 = {
516 .name = "s3c2410-i2c",
517 .id = 1,
518 .num_resources = ARRAY_SIZE(s3c_i2c1_resource),
519 .resource = s3c_i2c1_resource,
520};
521
522void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
523{
524 struct s3c2410_platform_i2c *npd;
525
526 if (!pd) {
527 pd = &default_i2c_data;
528 pd->bus_num = 1;
529 }
530
531 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
532 &s3c_device_i2c1);
533
534 if (!npd->cfg_gpio)
535 npd->cfg_gpio = s3c_i2c1_cfg_gpio;
536}
537#endif /* CONFIG_S3C_DEV_I2C1 */
538
539#ifdef CONFIG_S3C_DEV_I2C2
540static struct resource s3c_i2c2_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900541 [0] = DEFINE_RES_MEM(S3C_PA_IIC2, SZ_4K),
542 [1] = DEFINE_RES_IRQ(IRQ_IIC2),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900543};
544
545struct platform_device s3c_device_i2c2 = {
546 .name = "s3c2410-i2c",
547 .id = 2,
548 .num_resources = ARRAY_SIZE(s3c_i2c2_resource),
549 .resource = s3c_i2c2_resource,
550};
551
552void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
553{
554 struct s3c2410_platform_i2c *npd;
555
556 if (!pd) {
557 pd = &default_i2c_data;
558 pd->bus_num = 2;
559 }
560
561 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
562 &s3c_device_i2c2);
563
564 if (!npd->cfg_gpio)
565 npd->cfg_gpio = s3c_i2c2_cfg_gpio;
566}
567#endif /* CONFIG_S3C_DEV_I2C2 */
568
569#ifdef CONFIG_S3C_DEV_I2C3
570static struct resource s3c_i2c3_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900571 [0] = DEFINE_RES_MEM(S3C_PA_IIC3, SZ_4K),
572 [1] = DEFINE_RES_IRQ(IRQ_IIC3),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900573};
574
575struct platform_device s3c_device_i2c3 = {
576 .name = "s3c2440-i2c",
577 .id = 3,
578 .num_resources = ARRAY_SIZE(s3c_i2c3_resource),
579 .resource = s3c_i2c3_resource,
580};
581
582void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
583{
584 struct s3c2410_platform_i2c *npd;
585
586 if (!pd) {
587 pd = &default_i2c_data;
588 pd->bus_num = 3;
589 }
590
591 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
592 &s3c_device_i2c3);
593
594 if (!npd->cfg_gpio)
595 npd->cfg_gpio = s3c_i2c3_cfg_gpio;
596}
597#endif /*CONFIG_S3C_DEV_I2C3 */
598
599#ifdef CONFIG_S3C_DEV_I2C4
600static struct resource s3c_i2c4_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900601 [0] = DEFINE_RES_MEM(S3C_PA_IIC4, SZ_4K),
602 [1] = DEFINE_RES_IRQ(IRQ_IIC4),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900603};
604
605struct platform_device s3c_device_i2c4 = {
606 .name = "s3c2440-i2c",
607 .id = 4,
608 .num_resources = ARRAY_SIZE(s3c_i2c4_resource),
609 .resource = s3c_i2c4_resource,
610};
611
612void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
613{
614 struct s3c2410_platform_i2c *npd;
615
616 if (!pd) {
617 pd = &default_i2c_data;
618 pd->bus_num = 4;
619 }
620
621 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
622 &s3c_device_i2c4);
623
624 if (!npd->cfg_gpio)
625 npd->cfg_gpio = s3c_i2c4_cfg_gpio;
626}
627#endif /*CONFIG_S3C_DEV_I2C4 */
628
629#ifdef CONFIG_S3C_DEV_I2C5
630static struct resource s3c_i2c5_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900631 [0] = DEFINE_RES_MEM(S3C_PA_IIC5, SZ_4K),
632 [1] = DEFINE_RES_IRQ(IRQ_IIC5),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900633};
634
635struct platform_device s3c_device_i2c5 = {
636 .name = "s3c2440-i2c",
637 .id = 5,
638 .num_resources = ARRAY_SIZE(s3c_i2c5_resource),
639 .resource = s3c_i2c5_resource,
640};
641
642void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
643{
644 struct s3c2410_platform_i2c *npd;
645
646 if (!pd) {
647 pd = &default_i2c_data;
648 pd->bus_num = 5;
649 }
650
651 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
652 &s3c_device_i2c5);
653
654 if (!npd->cfg_gpio)
655 npd->cfg_gpio = s3c_i2c5_cfg_gpio;
656}
657#endif /*CONFIG_S3C_DEV_I2C5 */
658
659#ifdef CONFIG_S3C_DEV_I2C6
660static struct resource s3c_i2c6_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900661 [0] = DEFINE_RES_MEM(S3C_PA_IIC6, SZ_4K),
662 [1] = DEFINE_RES_IRQ(IRQ_IIC6),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900663};
664
665struct platform_device s3c_device_i2c6 = {
666 .name = "s3c2440-i2c",
667 .id = 6,
668 .num_resources = ARRAY_SIZE(s3c_i2c6_resource),
669 .resource = s3c_i2c6_resource,
670};
671
672void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
673{
674 struct s3c2410_platform_i2c *npd;
675
676 if (!pd) {
677 pd = &default_i2c_data;
678 pd->bus_num = 6;
679 }
680
681 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
682 &s3c_device_i2c6);
683
684 if (!npd->cfg_gpio)
685 npd->cfg_gpio = s3c_i2c6_cfg_gpio;
686}
687#endif /* CONFIG_S3C_DEV_I2C6 */
688
689#ifdef CONFIG_S3C_DEV_I2C7
690static struct resource s3c_i2c7_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900691 [0] = DEFINE_RES_MEM(S3C_PA_IIC7, SZ_4K),
692 [1] = DEFINE_RES_IRQ(IRQ_IIC7),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900693};
694
695struct platform_device s3c_device_i2c7 = {
696 .name = "s3c2440-i2c",
697 .id = 7,
698 .num_resources = ARRAY_SIZE(s3c_i2c7_resource),
699 .resource = s3c_i2c7_resource,
700};
701
702void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
703{
704 struct s3c2410_platform_i2c *npd;
705
706 if (!pd) {
707 pd = &default_i2c_data;
708 pd->bus_num = 7;
709 }
710
711 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
712 &s3c_device_i2c7);
713
714 if (!npd->cfg_gpio)
715 npd->cfg_gpio = s3c_i2c7_cfg_gpio;
716}
717#endif /* CONFIG_S3C_DEV_I2C7 */
718
Kukjin Kim57167142011-10-03 09:46:56 +0900719/* I2C HDMIPHY */
720
721#ifdef CONFIG_S5P_DEV_I2C_HDMIPHY
722static struct resource s5p_i2c_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900723 [0] = DEFINE_RES_MEM(S5P_PA_IIC_HDMIPHY, SZ_4K),
724 [1] = DEFINE_RES_IRQ(IRQ_IIC_HDMIPHY),
Kukjin Kim57167142011-10-03 09:46:56 +0900725};
726
727struct platform_device s5p_device_i2c_hdmiphy = {
728 .name = "s3c2440-hdmiphy-i2c",
729 .id = -1,
730 .num_resources = ARRAY_SIZE(s5p_i2c_resource),
731 .resource = s5p_i2c_resource,
732};
733
734void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd)
735{
736 struct s3c2410_platform_i2c *npd;
737
738 if (!pd) {
739 pd = &default_i2c_data;
740
741 if (soc_is_exynos4210())
742 pd->bus_num = 8;
743 else if (soc_is_s5pv210())
744 pd->bus_num = 3;
745 else
746 pd->bus_num = 0;
747 }
748
749 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
750 &s5p_device_i2c_hdmiphy);
751}
752#endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */
753
Kukjin Kim61c542b2011-10-03 09:46:13 +0900754/* I2S */
755
756#ifdef CONFIG_PLAT_S3C24XX
757static struct resource s3c_iis_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900758 [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
Kukjin Kim61c542b2011-10-03 09:46:13 +0900759};
760
761struct platform_device s3c_device_iis = {
762 .name = "s3c24xx-iis",
763 .id = -1,
764 .num_resources = ARRAY_SIZE(s3c_iis_resource),
765 .resource = s3c_iis_resource,
766 .dev = {
767 .dma_mask = &samsung_device_dma_mask,
768 .coherent_dma_mask = DMA_BIT_MASK(32),
769 }
770};
771#endif /* CONFIG_PLAT_S3C24XX */
772
773#ifdef CONFIG_CPU_S3C2440
774struct platform_device s3c2412_device_iis = {
775 .name = "s3c2412-iis",
776 .id = -1,
777 .dev = {
778 .dma_mask = &samsung_device_dma_mask,
779 .coherent_dma_mask = DMA_BIT_MASK(32),
780 }
781};
782#endif /* CONFIG_CPU_S3C2440 */
783
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900784/* IDE CFCON */
785
786#ifdef CONFIG_SAMSUNG_DEV_IDE
787static struct resource s3c_cfcon_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900788 [0] = DEFINE_RES_MEM(SAMSUNG_PA_CFCON, SZ_16K),
789 [1] = DEFINE_RES_IRQ(IRQ_CFCON),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900790};
791
792struct platform_device s3c_device_cfcon = {
793 .id = 0,
794 .num_resources = ARRAY_SIZE(s3c_cfcon_resource),
795 .resource = s3c_cfcon_resource,
796};
797
798void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
799{
800 s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
801 &s3c_device_cfcon);
802}
803#endif /* CONFIG_SAMSUNG_DEV_IDE */
804
805/* KEYPAD */
806
807#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
808static struct resource samsung_keypad_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900809 [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
810 [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900811};
812
813struct platform_device samsung_device_keypad = {
814 .name = "samsung-keypad",
815 .id = -1,
816 .num_resources = ARRAY_SIZE(samsung_keypad_resources),
817 .resource = samsung_keypad_resources,
818};
819
820void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
821{
822 struct samsung_keypad_platdata *npd;
823
824 npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata),
825 &samsung_device_keypad);
826
827 if (!npd->cfg_gpio)
828 npd->cfg_gpio = samsung_keypad_cfg_gpio;
829}
830#endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
831
Kukjin Kim61c542b2011-10-03 09:46:13 +0900832/* LCD Controller */
833
834#ifdef CONFIG_PLAT_S3C24XX
835static struct resource s3c_lcd_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900836 [0] = DEFINE_RES_MEM(S3C24XX_PA_LCD, S3C24XX_SZ_LCD),
837 [1] = DEFINE_RES_IRQ(IRQ_LCD),
Kukjin Kim61c542b2011-10-03 09:46:13 +0900838};
839
840struct platform_device s3c_device_lcd = {
841 .name = "s3c2410-lcd",
842 .id = -1,
843 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
844 .resource = s3c_lcd_resource,
845 .dev = {
846 .dma_mask = &samsung_device_dma_mask,
847 .coherent_dma_mask = DMA_BIT_MASK(32),
848 }
849};
850
851void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
852{
853 struct s3c2410fb_mach_info *npd;
854
855 npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
856 if (npd) {
857 npd->displays = kmemdup(pd->displays,
858 sizeof(struct s3c2410fb_display) * npd->num_displays,
859 GFP_KERNEL);
860 if (!npd->displays)
861 printk(KERN_ERR "no memory for LCD display data\n");
862 } else {
863 printk(KERN_ERR "no memory for LCD platform data\n");
864 }
865}
866#endif /* CONFIG_PLAT_S3C24XX */
867
Kukjin Kim57167142011-10-03 09:46:56 +0900868/* MFC */
869
870#ifdef CONFIG_S5P_DEV_MFC
871static struct resource s5p_mfc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900872 [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K),
873 [1] = DEFINE_RES_IRQ(IRQ_MFC),
Kukjin Kim57167142011-10-03 09:46:56 +0900874};
875
876struct platform_device s5p_device_mfc = {
877 .name = "s5p-mfc",
878 .id = -1,
879 .num_resources = ARRAY_SIZE(s5p_mfc_resource),
880 .resource = s5p_mfc_resource,
881};
882
883/*
884 * MFC hardware has 2 memory interfaces which are modelled as two separate
885 * platform devices to let dma-mapping distinguish between them.
886 *
887 * MFC parent device (s5p_device_mfc) must be registered before memory
888 * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r).
889 */
890
891struct platform_device s5p_device_mfc_l = {
892 .name = "s5p-mfc-l",
893 .id = -1,
894 .dev = {
895 .parent = &s5p_device_mfc.dev,
896 .dma_mask = &samsung_device_dma_mask,
897 .coherent_dma_mask = DMA_BIT_MASK(32),
898 },
899};
900
901struct platform_device s5p_device_mfc_r = {
902 .name = "s5p-mfc-r",
903 .id = -1,
904 .dev = {
905 .parent = &s5p_device_mfc.dev,
906 .dma_mask = &samsung_device_dma_mask,
907 .coherent_dma_mask = DMA_BIT_MASK(32),
908 },
909};
910#endif /* CONFIG_S5P_DEV_MFC */
911
912/* MIPI CSIS */
913
914#ifdef CONFIG_S5P_DEV_CSIS0
915static struct resource s5p_mipi_csis0_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900916 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_4K),
917 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0),
Kukjin Kim57167142011-10-03 09:46:56 +0900918};
919
920struct platform_device s5p_device_mipi_csis0 = {
921 .name = "s5p-mipi-csis",
922 .id = 0,
923 .num_resources = ARRAY_SIZE(s5p_mipi_csis0_resource),
924 .resource = s5p_mipi_csis0_resource,
925};
926#endif /* CONFIG_S5P_DEV_CSIS0 */
927
928#ifdef CONFIG_S5P_DEV_CSIS1
929static struct resource s5p_mipi_csis1_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900930 [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_4K),
931 [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1),
Kukjin Kim57167142011-10-03 09:46:56 +0900932};
933
934struct platform_device s5p_device_mipi_csis1 = {
935 .name = "s5p-mipi-csis",
936 .id = 1,
937 .num_resources = ARRAY_SIZE(s5p_mipi_csis1_resource),
938 .resource = s5p_mipi_csis1_resource,
939};
940#endif
941
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900942/* NAND */
943
944#ifdef CONFIG_S3C_DEV_NAND
945static struct resource s3c_nand_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +0900946 [0] = DEFINE_RES_MEM(S3C_PA_NAND, SZ_1M),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +0900947};
948
949struct platform_device s3c_device_nand = {
950 .name = "s3c2410-nand",
951 .id = -1,
952 .num_resources = ARRAY_SIZE(s3c_nand_resource),
953 .resource = s3c_nand_resource,
954};
955
956/*
957 * s3c_nand_copy_set() - copy nand set data
958 * @set: The new structure, directly copied from the old.
959 *
960 * Copy all the fields from the NAND set field from what is probably __initdata
961 * to new kernel memory. The code returns 0 if the copy happened correctly or
962 * an error code for the calling function to display.
963 *
964 * Note, we currently do not try and look to see if we've already copied the
965 * data in a previous set.
966 */
967static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
968{
969 void *ptr;
970 int size;
971
972 size = sizeof(struct mtd_partition) * set->nr_partitions;
973 if (size) {
974 ptr = kmemdup(set->partitions, size, GFP_KERNEL);
975 set->partitions = ptr;
976
977 if (!ptr)
978 return -ENOMEM;
979 }
980
981 if (set->nr_map && set->nr_chips) {
982 size = sizeof(int) * set->nr_chips;
983 ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
984 set->nr_map = ptr;
985
986 if (!ptr)
987 return -ENOMEM;
988 }
989
990 if (set->ecc_layout) {
991 ptr = kmemdup(set->ecc_layout,
992 sizeof(struct nand_ecclayout), GFP_KERNEL);
993 set->ecc_layout = ptr;
994
995 if (!ptr)
996 return -ENOMEM;
997 }
998
999 return 0;
1000}
1001
1002void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
1003{
1004 struct s3c2410_platform_nand *npd;
1005 int size;
1006 int ret;
1007
1008 /* note, if we get a failure in allocation, we simply drop out of the
1009 * function. If there is so little memory available at initialisation
1010 * time then there is little chance the system is going to run.
1011 */
1012
1013 npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand),
1014 &s3c_device_nand);
1015 if (!npd)
1016 return;
1017
1018 /* now see if we need to copy any of the nand set data */
1019
1020 size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
1021 if (size) {
1022 struct s3c2410_nand_set *from = npd->sets;
1023 struct s3c2410_nand_set *to;
1024 int i;
1025
1026 to = kmemdup(from, size, GFP_KERNEL);
1027 npd->sets = to; /* set, even if we failed */
1028
1029 if (!to) {
1030 printk(KERN_ERR "%s: no memory for sets\n", __func__);
1031 return;
1032 }
1033
1034 for (i = 0; i < npd->nr_sets; i++) {
1035 ret = s3c_nand_copy_set(to);
1036 if (ret) {
1037 printk(KERN_ERR "%s: failed to copy set %d\n",
1038 __func__, i);
1039 return;
1040 }
1041 to++;
1042 }
1043 }
1044}
1045#endif /* CONFIG_S3C_DEV_NAND */
1046
1047/* ONENAND */
1048
1049#ifdef CONFIG_S3C_DEV_ONENAND
1050static struct resource s3c_onenand_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001051 [0] = DEFINE_RES_MEM(S3C_PA_ONENAND, SZ_1K),
1052 [1] = DEFINE_RES_MEM(S3C_PA_ONENAND_BUF, S3C_SZ_ONENAND_BUF),
1053 [2] = DEFINE_RES_IRQ(IRQ_ONENAND),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001054};
1055
1056struct platform_device s3c_device_onenand = {
1057 .name = "samsung-onenand",
1058 .id = 0,
1059 .num_resources = ARRAY_SIZE(s3c_onenand_resources),
1060 .resource = s3c_onenand_resources,
1061};
1062#endif /* CONFIG_S3C_DEV_ONENAND */
1063
Kukjin Kim0523ec32011-10-03 09:46:56 +09001064#ifdef CONFIG_S3C64XX_DEV_ONENAND1
1065static struct resource s3c64xx_onenand1_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001066 [0] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1, SZ_1K),
1067 [1] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1_BUF, S3C64XX_SZ_ONENAND1_BUF),
1068 [2] = DEFINE_RES_IRQ(IRQ_ONENAND1),
Kukjin Kim0523ec32011-10-03 09:46:56 +09001069};
1070
1071struct platform_device s3c64xx_device_onenand1 = {
1072 .name = "samsung-onenand",
1073 .id = 1,
1074 .num_resources = ARRAY_SIZE(s3c64xx_onenand1_resources),
1075 .resource = s3c64xx_onenand1_resources,
1076};
1077
1078void s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
1079{
1080 s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
1081 &s3c64xx_device_onenand1);
1082}
1083#endif /* CONFIG_S3C64XX_DEV_ONENAND1 */
1084
Kukjin Kim57167142011-10-03 09:46:56 +09001085#ifdef CONFIG_S5P_DEV_ONENAND
1086static struct resource s5p_onenand_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001087 [0] = DEFINE_RES_MEM(S5P_PA_ONENAND, SZ_128K),
1088 [1] = DEFINE_RES_MEM(S5P_PA_ONENAND_DMA, SZ_8K),
1089 [2] = DEFINE_RES_IRQ(IRQ_ONENAND_AUDI),
Kukjin Kim57167142011-10-03 09:46:56 +09001090};
1091
1092struct platform_device s5p_device_onenand = {
1093 .name = "s5pc110-onenand",
1094 .id = -1,
1095 .num_resources = ARRAY_SIZE(s5p_onenand_resources),
1096 .resource = s5p_onenand_resources,
1097};
1098#endif /* CONFIG_S5P_DEV_ONENAND */
1099
1100/* PMU */
1101
1102#ifdef CONFIG_PLAT_S5P
Kukjin Kime663cb72011-10-03 11:34:26 +09001103static struct resource s5p_pmu_resource[] = {
1104 DEFINE_RES_IRQ(IRQ_PMU)
Kukjin Kim57167142011-10-03 09:46:56 +09001105};
1106
1107struct platform_device s5p_device_pmu = {
1108 .name = "arm-pmu",
1109 .id = ARM_PMU_DEVICE_CPU,
Kukjin Kime663cb72011-10-03 11:34:26 +09001110 .num_resources = ARRAY_SIZE(s5p_pmu_resource),
1111 .resource = s5p_pmu_resource,
Kukjin Kim57167142011-10-03 09:46:56 +09001112};
1113
1114static int __init s5p_pmu_init(void)
1115{
1116 platform_device_register(&s5p_device_pmu);
1117 return 0;
1118}
1119arch_initcall(s5p_pmu_init);
1120#endif /* CONFIG_PLAT_S5P */
1121
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001122/* PWM Timer */
1123
1124#ifdef CONFIG_SAMSUNG_DEV_PWM
1125
1126#define TIMER_RESOURCE_SIZE (1)
1127
1128#define TIMER_RESOURCE(_tmr, _irq) \
1129 (struct resource [TIMER_RESOURCE_SIZE]) { \
1130 [0] = { \
1131 .start = _irq, \
1132 .end = _irq, \
1133 .flags = IORESOURCE_IRQ \
1134 } \
1135 }
1136
1137#define DEFINE_S3C_TIMER(_tmr_no, _irq) \
1138 .name = "s3c24xx-pwm", \
1139 .id = _tmr_no, \
1140 .num_resources = TIMER_RESOURCE_SIZE, \
1141 .resource = TIMER_RESOURCE(_tmr_no, _irq), \
1142
1143/*
1144 * since we already have an static mapping for the timer,
1145 * we do not bother setting any IO resource for the base.
1146 */
1147
1148struct platform_device s3c_device_timer[] = {
1149 [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
1150 [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
1151 [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
1152 [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
1153 [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
1154};
1155#endif /* CONFIG_SAMSUNG_DEV_PWM */
1156
Kukjin Kim61c542b2011-10-03 09:46:13 +09001157/* RTC */
1158
1159#ifdef CONFIG_PLAT_S3C24XX
1160static struct resource s3c_rtc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001161 [0] = DEFINE_RES_MEM(S3C24XX_PA_RTC, SZ_256),
1162 [1] = DEFINE_RES_IRQ(IRQ_RTC),
1163 [2] = DEFINE_RES_IRQ(IRQ_TICK),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001164};
1165
1166struct platform_device s3c_device_rtc = {
1167 .name = "s3c2410-rtc",
1168 .id = -1,
1169 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
1170 .resource = s3c_rtc_resource,
1171};
1172#endif /* CONFIG_PLAT_S3C24XX */
1173
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001174#ifdef CONFIG_S3C_DEV_RTC
1175static struct resource s3c_rtc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001176 [0] = DEFINE_RES_MEM(S3C_PA_RTC, SZ_256),
1177 [1] = DEFINE_RES_IRQ(IRQ_RTC_ALARM),
1178 [2] = DEFINE_RES_IRQ(IRQ_RTC_TIC),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001179};
1180
1181struct platform_device s3c_device_rtc = {
1182 .name = "s3c64xx-rtc",
1183 .id = -1,
1184 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
1185 .resource = s3c_rtc_resource,
1186};
1187#endif /* CONFIG_S3C_DEV_RTC */
1188
Kukjin Kim61c542b2011-10-03 09:46:13 +09001189/* SDI */
1190
1191#ifdef CONFIG_PLAT_S3C24XX
1192static struct resource s3c_sdi_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001193 [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
1194 [1] = DEFINE_RES_IRQ(IRQ_SDI),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001195};
1196
1197struct platform_device s3c_device_sdi = {
1198 .name = "s3c2410-sdi",
1199 .id = -1,
1200 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
1201 .resource = s3c_sdi_resource,
1202};
1203
1204void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
1205{
1206 s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
1207 &s3c_device_sdi);
1208}
1209#endif /* CONFIG_PLAT_S3C24XX */
1210
1211/* SPI */
1212
1213#ifdef CONFIG_PLAT_S3C24XX
1214static struct resource s3c_spi0_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001215 [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI, SZ_32),
1216 [1] = DEFINE_RES_IRQ(IRQ_SPI0),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001217};
1218
1219struct platform_device s3c_device_spi0 = {
1220 .name = "s3c2410-spi",
1221 .id = 0,
1222 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
1223 .resource = s3c_spi0_resource,
1224 .dev = {
1225 .dma_mask = &samsung_device_dma_mask,
1226 .coherent_dma_mask = DMA_BIT_MASK(32),
1227 }
1228};
1229
1230static struct resource s3c_spi1_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001231 [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI1, SZ_32),
1232 [1] = DEFINE_RES_IRQ(IRQ_SPI1),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001233};
1234
1235struct platform_device s3c_device_spi1 = {
1236 .name = "s3c2410-spi",
1237 .id = 1,
1238 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
1239 .resource = s3c_spi1_resource,
1240 .dev = {
1241 .dma_mask = &samsung_device_dma_mask,
1242 .coherent_dma_mask = DMA_BIT_MASK(32),
1243 }
1244};
1245#endif /* CONFIG_PLAT_S3C24XX */
1246
1247/* Touchscreen */
1248
1249#ifdef CONFIG_PLAT_S3C24XX
1250static struct resource s3c_ts_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001251 [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
1252 [1] = DEFINE_RES_IRQ(IRQ_TC),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001253};
1254
1255struct platform_device s3c_device_ts = {
1256 .name = "s3c2410-ts",
1257 .id = -1,
1258 .dev.parent = &s3c_device_adc.dev,
1259 .num_resources = ARRAY_SIZE(s3c_ts_resource),
1260 .resource = s3c_ts_resource,
1261};
1262
1263void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
1264{
1265 s3c_set_platdata(hard_s3c2410ts_info,
1266 sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
1267}
1268#endif /* CONFIG_PLAT_S3C24XX */
1269
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001270#ifdef CONFIG_SAMSUNG_DEV_TS
1271static struct resource s3c_ts_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001272 [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
1273 [1] = DEFINE_RES_IRQ(IRQ_TC),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001274};
1275
1276static struct s3c2410_ts_mach_info default_ts_data __initdata = {
1277 .delay = 10000,
1278 .presc = 49,
1279 .oversampling_shift = 2,
1280};
1281
1282struct platform_device s3c_device_ts = {
1283 .name = "s3c64xx-ts",
1284 .id = -1,
1285 .num_resources = ARRAY_SIZE(s3c_ts_resource),
1286 .resource = s3c_ts_resource,
1287};
1288
1289void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
1290{
1291 if (!pd)
1292 pd = &default_ts_data;
1293
1294 s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
1295 &s3c_device_ts);
1296}
1297#endif /* CONFIG_SAMSUNG_DEV_TS */
1298
Kukjin Kim57167142011-10-03 09:46:56 +09001299/* TV */
1300
1301#ifdef CONFIG_S5P_DEV_TV
1302
1303static struct resource s5p_hdmi_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001304 [0] = DEFINE_RES_MEM(S5P_PA_HDMI, SZ_1M),
1305 [1] = DEFINE_RES_IRQ(IRQ_HDMI),
Kukjin Kim57167142011-10-03 09:46:56 +09001306};
1307
1308struct platform_device s5p_device_hdmi = {
1309 .name = "s5p-hdmi",
1310 .id = -1,
1311 .num_resources = ARRAY_SIZE(s5p_hdmi_resources),
1312 .resource = s5p_hdmi_resources,
1313};
1314
1315static struct resource s5p_sdo_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001316 [0] = DEFINE_RES_MEM(S5P_PA_SDO, SZ_64K),
1317 [1] = DEFINE_RES_IRQ(IRQ_SDO),
Kukjin Kim57167142011-10-03 09:46:56 +09001318};
1319
1320struct platform_device s5p_device_sdo = {
1321 .name = "s5p-sdo",
1322 .id = -1,
1323 .num_resources = ARRAY_SIZE(s5p_sdo_resources),
1324 .resource = s5p_sdo_resources,
1325};
1326
1327static struct resource s5p_mixer_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001328 [0] = DEFINE_RES_MEM_NAMED(S5P_PA_MIXER, SZ_64K, "mxr"),
1329 [1] = DEFINE_RES_MEM_NAMED(S5P_PA_VP, SZ_64K, "vp"),
1330 [2] = DEFINE_RES_IRQ_NAMED(IRQ_MIXER, "irq"),
Kukjin Kim57167142011-10-03 09:46:56 +09001331};
1332
1333struct platform_device s5p_device_mixer = {
1334 .name = "s5p-mixer",
1335 .id = -1,
1336 .num_resources = ARRAY_SIZE(s5p_mixer_resources),
1337 .resource = s5p_mixer_resources,
1338 .dev = {
1339 .dma_mask = &samsung_device_dma_mask,
1340 .coherent_dma_mask = DMA_BIT_MASK(32),
1341 }
1342};
1343#endif /* CONFIG_S5P_DEV_TV */
1344
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001345/* USB */
1346
1347#ifdef CONFIG_S3C_DEV_USB_HOST
1348static struct resource s3c_usb_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001349 [0] = DEFINE_RES_MEM(S3C_PA_USBHOST, SZ_256),
1350 [1] = DEFINE_RES_IRQ(IRQ_USBH),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001351};
1352
1353struct platform_device s3c_device_ohci = {
1354 .name = "s3c2410-ohci",
1355 .id = -1,
1356 .num_resources = ARRAY_SIZE(s3c_usb_resource),
1357 .resource = s3c_usb_resource,
1358 .dev = {
1359 .dma_mask = &samsung_device_dma_mask,
1360 .coherent_dma_mask = DMA_BIT_MASK(32),
1361 }
1362};
1363
1364/*
1365 * s3c_ohci_set_platdata - initialise OHCI device platform data
1366 * @info: The platform data.
1367 *
1368 * This call copies the @info passed in and sets the device .platform_data
1369 * field to that copy. The @info is copied so that the original can be marked
1370 * __initdata.
1371 */
1372
1373void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
1374{
1375 s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
1376 &s3c_device_ohci);
1377}
1378#endif /* CONFIG_S3C_DEV_USB_HOST */
1379
Kukjin Kim61c542b2011-10-03 09:46:13 +09001380/* USB Device (Gadget) */
1381
1382#ifdef CONFIG_PLAT_S3C24XX
1383static struct resource s3c_usbgadget_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001384 [0] = DEFINE_RES_MEM(S3C24XX_PA_USBDEV, S3C24XX_SZ_USBDEV),
1385 [1] = DEFINE_RES_IRQ(IRQ_USBD),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001386};
1387
1388struct platform_device s3c_device_usbgadget = {
1389 .name = "s3c2410-usbgadget",
1390 .id = -1,
1391 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
1392 .resource = s3c_usbgadget_resource,
1393};
1394
1395void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
1396{
1397 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
1398}
1399#endif /* CONFIG_PLAT_S3C24XX */
1400
Kukjin Kim57167142011-10-03 09:46:56 +09001401/* USB EHCI Host Controller */
1402
1403#ifdef CONFIG_S5P_DEV_USB_EHCI
1404static struct resource s5p_ehci_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001405 [0] = DEFINE_RES_MEM(S5P_PA_EHCI, SZ_256),
1406 [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
Kukjin Kim57167142011-10-03 09:46:56 +09001407};
1408
1409struct platform_device s5p_device_ehci = {
1410 .name = "s5p-ehci",
1411 .id = -1,
1412 .num_resources = ARRAY_SIZE(s5p_ehci_resource),
1413 .resource = s5p_ehci_resource,
1414 .dev = {
1415 .dma_mask = &samsung_device_dma_mask,
1416 .coherent_dma_mask = DMA_BIT_MASK(32),
1417 }
1418};
1419
1420void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
1421{
1422 struct s5p_ehci_platdata *npd;
1423
1424 npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata),
1425 &s5p_device_ehci);
1426
1427 if (!npd->phy_init)
1428 npd->phy_init = s5p_usb_phy_init;
1429 if (!npd->phy_exit)
1430 npd->phy_exit = s5p_usb_phy_exit;
1431}
1432#endif /* CONFIG_S5P_DEV_USB_EHCI */
1433
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001434/* USB HSOTG */
1435
1436#ifdef CONFIG_S3C_DEV_USB_HSOTG
1437static struct resource s3c_usb_hsotg_resources[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001438 [0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_16K),
1439 [1] = DEFINE_RES_IRQ(IRQ_OTG),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001440};
1441
1442struct platform_device s3c_device_usb_hsotg = {
1443 .name = "s3c-hsotg",
1444 .id = -1,
1445 .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources),
1446 .resource = s3c_usb_hsotg_resources,
1447 .dev = {
1448 .dma_mask = &samsung_device_dma_mask,
1449 .coherent_dma_mask = DMA_BIT_MASK(32),
1450 },
1451};
1452#endif /* CONFIG_S3C_DEV_USB_HSOTG */
1453
Kukjin Kim61c542b2011-10-03 09:46:13 +09001454/* USB High Spped 2.0 Device (Gadget) */
1455
1456#ifdef CONFIG_PLAT_S3C24XX
1457static struct resource s3c_hsudc_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001458 [0] = DEFINE_RES_MEM(S3C2416_PA_HSUDC, S3C2416_SZ_HSUDC),
1459 [1] = DEFINE_RES_IRQ(IRQ_USBD),
Kukjin Kim61c542b2011-10-03 09:46:13 +09001460};
1461
1462struct platform_device s3c_device_usb_hsudc = {
1463 .name = "s3c-hsudc",
1464 .id = -1,
1465 .num_resources = ARRAY_SIZE(s3c_hsudc_resource),
1466 .resource = s3c_hsudc_resource,
1467 .dev = {
1468 .dma_mask = &samsung_device_dma_mask,
1469 .coherent_dma_mask = DMA_BIT_MASK(32),
1470 },
1471};
1472
1473void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
1474{
1475 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
1476}
1477#endif /* CONFIG_PLAT_S3C24XX */
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001478
1479/* WDT */
1480
1481#ifdef CONFIG_S3C_DEV_WDT
1482static struct resource s3c_wdt_resource[] = {
Kukjin Kime663cb72011-10-03 11:34:26 +09001483 [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
1484 [1] = DEFINE_RES_IRQ(IRQ_WDT),
Kukjin Kimbad1e6a2011-10-03 09:47:58 +09001485};
1486
1487struct platform_device s3c_device_wdt = {
1488 .name = "s3c2410-wdt",
1489 .id = -1,
1490 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
1491 .resource = s3c_wdt_resource,
1492};
1493#endif /* CONFIG_S3C_DEV_WDT */
Padmavathi Venna875a5932011-12-23 10:14:31 +09001494
1495#ifdef CONFIG_S3C64XX_DEV_SPI0
1496static struct resource s3c64xx_spi0_resource[] = {
1497 [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
1498 [1] = DEFINE_RES_DMA(DMACH_SPI0_TX),
1499 [2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
1500 [3] = DEFINE_RES_IRQ(IRQ_SPI0),
1501};
1502
1503struct platform_device s3c64xx_device_spi0 = {
1504 .name = "s3c64xx-spi",
1505 .id = 0,
1506 .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
1507 .resource = s3c64xx_spi0_resource,
1508 .dev = {
1509 .dma_mask = &samsung_device_dma_mask,
1510 .coherent_dma_mask = DMA_BIT_MASK(32),
1511 },
1512};
1513
1514void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd,
1515 int src_clk_nr, int num_cs)
1516{
1517 if (!pd) {
1518 pr_err("%s:Need to pass platform data\n", __func__);
1519 return;
1520 }
1521
1522 /* Reject invalid configuration */
1523 if (!num_cs || src_clk_nr < 0) {
1524 pr_err("%s: Invalid SPI configuration\n", __func__);
1525 return;
1526 }
1527
1528 pd->num_cs = num_cs;
1529 pd->src_clk_nr = src_clk_nr;
Padmavathi Venna4566c7f2011-12-23 10:14:36 +09001530 if (!pd->cfg_gpio)
1531 pd->cfg_gpio = s3c64xx_spi0_cfg_gpio;
1532
Padmavathi Venna875a5932011-12-23 10:14:31 +09001533 s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0);
1534}
1535#endif /* CONFIG_S3C64XX_DEV_SPI0 */
1536
1537#ifdef CONFIG_S3C64XX_DEV_SPI1
1538static struct resource s3c64xx_spi1_resource[] = {
1539 [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
1540 [1] = DEFINE_RES_DMA(DMACH_SPI1_TX),
1541 [2] = DEFINE_RES_DMA(DMACH_SPI1_RX),
1542 [3] = DEFINE_RES_IRQ(IRQ_SPI1),
1543};
1544
1545struct platform_device s3c64xx_device_spi1 = {
1546 .name = "s3c64xx-spi",
1547 .id = 1,
1548 .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource),
1549 .resource = s3c64xx_spi1_resource,
1550 .dev = {
1551 .dma_mask = &samsung_device_dma_mask,
1552 .coherent_dma_mask = DMA_BIT_MASK(32),
1553 },
1554};
1555
1556void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd,
1557 int src_clk_nr, int num_cs)
1558{
1559 if (!pd) {
1560 pr_err("%s:Need to pass platform data\n", __func__);
1561 return;
1562 }
1563
1564 /* Reject invalid configuration */
1565 if (!num_cs || src_clk_nr < 0) {
1566 pr_err("%s: Invalid SPI configuration\n", __func__);
1567 return;
1568 }
1569
1570 pd->num_cs = num_cs;
1571 pd->src_clk_nr = src_clk_nr;
Padmavathi Venna4566c7f2011-12-23 10:14:36 +09001572 if (!pd->cfg_gpio)
1573 pd->cfg_gpio = s3c64xx_spi1_cfg_gpio;
1574
Padmavathi Venna875a5932011-12-23 10:14:31 +09001575 s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1);
1576}
1577#endif /* CONFIG_S3C64XX_DEV_SPI1 */
1578
1579#ifdef CONFIG_S3C64XX_DEV_SPI2
1580static struct resource s3c64xx_spi2_resource[] = {
1581 [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
1582 [1] = DEFINE_RES_DMA(DMACH_SPI2_TX),
1583 [2] = DEFINE_RES_DMA(DMACH_SPI2_RX),
1584 [3] = DEFINE_RES_IRQ(IRQ_SPI2),
1585};
1586
1587struct platform_device s3c64xx_device_spi2 = {
1588 .name = "s3c64xx-spi",
1589 .id = 2,
1590 .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource),
1591 .resource = s3c64xx_spi2_resource,
1592 .dev = {
1593 .dma_mask = &samsung_device_dma_mask,
1594 .coherent_dma_mask = DMA_BIT_MASK(32),
1595 },
1596};
1597
1598void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd,
1599 int src_clk_nr, int num_cs)
1600{
1601 if (!pd) {
1602 pr_err("%s:Need to pass platform data\n", __func__);
1603 return;
1604 }
1605
1606 /* Reject invalid configuration */
1607 if (!num_cs || src_clk_nr < 0) {
1608 pr_err("%s: Invalid SPI configuration\n", __func__);
1609 return;
1610 }
1611
1612 pd->num_cs = num_cs;
1613 pd->src_clk_nr = src_clk_nr;
Padmavathi Venna323d7712011-12-23 10:14:45 +09001614 if (!pd->cfg_gpio)
1615 pd->cfg_gpio = s3c64xx_spi2_cfg_gpio;
1616
Padmavathi Venna875a5932011-12-23 10:14:31 +09001617 s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2);
1618}
1619#endif /* CONFIG_S3C64XX_DEV_SPI2 */