1 /* linux/arch/arm/plat-samsung/devs.c
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Base SAMSUNG platform device definitions
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.
13 #include <linux/amba/pl330.h>
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>
20 #include <linux/serial_core.h>
21 #include <linux/serial_s3c.h>
22 #include <linux/platform_device.h>
24 #include <linux/slab.h>
25 #include <linux/string.h>
26 #include <linux/dma-mapping.h>
28 #include <linux/gfp.h>
29 #include <linux/mtd/mtd.h>
30 #include <linux/mtd/onenand.h>
31 #include <linux/mtd/partitions.h>
32 #include <linux/mmc/host.h>
33 #include <linux/ioport.h>
34 #include <linux/sizes.h>
35 #include <linux/platform_data/s3c-hsudc.h>
36 #include <linux/platform_data/s3c-hsotg.h>
37 #include <linux/platform_data/dma-s3c24xx.h>
39 #include <linux/platform_data/media/s5p_hdmi.h>
42 #include <asm/mach/arch.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/irq.h>
47 #include <mach/irqs.h>
51 #include <plat/devs.h>
53 #include <linux/platform_data/ata-samsung_cf.h>
55 #include <plat/fb-s3c2410.h>
56 #include <linux/platform_data/hwmon-s3c.h>
57 #include <linux/platform_data/i2c-s3c2410.h>
58 #include <plat/keypad.h>
59 #include <linux/platform_data/mmc-s3cmci.h>
60 #include <linux/platform_data/mtd-nand-s3c2410.h>
61 #include <plat/pwm-core.h>
62 #include <plat/sdhci.h>
63 #include <linux/platform_data/touchscreen-s3c2410.h>
64 #include <linux/platform_data/usb-s3c2410_udc.h>
65 #include <linux/platform_data/usb-ohci-s3c2410.h>
66 #include <plat/usb-phy.h>
67 #include <plat/regs-spi.h>
68 #include <linux/platform_data/asoc-s3c.h>
69 #include <linux/platform_data/spi-s3c64xx.h>
71 #define samsung_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
74 #ifdef CONFIG_CPU_S3C2440
75 static struct resource s3c_ac97_resource[] = {
76 [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
77 [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
80 struct platform_device s3c_device_ac97 = {
81 .name = "samsung-ac97",
83 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
84 .resource = s3c_ac97_resource,
86 .dma_mask = &samsung_device_dma_mask,
87 .coherent_dma_mask = DMA_BIT_MASK(32),
90 #endif /* CONFIG_CPU_S3C2440 */
94 #ifdef CONFIG_PLAT_S3C24XX
95 static struct resource s3c_adc_resource[] = {
96 [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
97 [1] = DEFINE_RES_IRQ(IRQ_TC),
98 [2] = DEFINE_RES_IRQ(IRQ_ADC),
101 struct platform_device s3c_device_adc = {
102 .name = "s3c24xx-adc",
104 .num_resources = ARRAY_SIZE(s3c_adc_resource),
105 .resource = s3c_adc_resource,
107 #endif /* CONFIG_PLAT_S3C24XX */
109 #if defined(CONFIG_SAMSUNG_DEV_ADC)
110 static struct resource s3c_adc_resource[] = {
111 [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
112 [1] = DEFINE_RES_IRQ(IRQ_ADC),
113 [2] = DEFINE_RES_IRQ(IRQ_TC),
116 struct platform_device s3c_device_adc = {
117 .name = "exynos-adc",
119 .num_resources = ARRAY_SIZE(s3c_adc_resource),
120 .resource = s3c_adc_resource,
122 #endif /* CONFIG_SAMSUNG_DEV_ADC */
124 /* Camif Controller */
126 #ifdef CONFIG_CPU_S3C2440
127 static struct resource s3c_camif_resource[] = {
128 [0] = DEFINE_RES_MEM(S3C2440_PA_CAMIF, S3C2440_SZ_CAMIF),
129 [1] = DEFINE_RES_IRQ(IRQ_S3C2440_CAM_C),
130 [2] = DEFINE_RES_IRQ(IRQ_S3C2440_CAM_P),
133 struct platform_device s3c_device_camif = {
134 .name = "s3c2440-camif",
136 .num_resources = ARRAY_SIZE(s3c_camif_resource),
137 .resource = s3c_camif_resource,
139 .dma_mask = &samsung_device_dma_mask,
140 .coherent_dma_mask = DMA_BIT_MASK(32),
143 #endif /* CONFIG_CPU_S3C2440 */
147 #ifdef CONFIG_S3C_DEV_FB
148 static struct resource s3c_fb_resource[] = {
149 [0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K),
150 [1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC),
151 [2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO),
152 [3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM),
155 struct platform_device s3c_device_fb = {
158 .num_resources = ARRAY_SIZE(s3c_fb_resource),
159 .resource = s3c_fb_resource,
161 .dma_mask = &samsung_device_dma_mask,
162 .coherent_dma_mask = DMA_BIT_MASK(32),
166 void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
168 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
171 #endif /* CONFIG_S3C_DEV_FB */
175 #ifdef CONFIG_S3C_DEV_HWMON
176 struct platform_device s3c_device_hwmon = {
179 .dev.parent = &s3c_device_adc.dev,
182 void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
184 s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
187 #endif /* CONFIG_S3C_DEV_HWMON */
191 #ifdef CONFIG_S3C_DEV_HSMMC
192 static struct resource s3c_hsmmc_resource[] = {
193 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC0, SZ_4K),
194 [1] = DEFINE_RES_IRQ(IRQ_HSMMC0),
197 struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
199 .host_caps = (MMC_CAP_4_BIT_DATA |
200 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
203 struct platform_device s3c_device_hsmmc0 = {
206 .num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
207 .resource = s3c_hsmmc_resource,
209 .dma_mask = &samsung_device_dma_mask,
210 .coherent_dma_mask = DMA_BIT_MASK(32),
211 .platform_data = &s3c_hsmmc0_def_platdata,
215 void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
217 s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
219 #endif /* CONFIG_S3C_DEV_HSMMC */
221 #ifdef CONFIG_S3C_DEV_HSMMC1
222 static struct resource s3c_hsmmc1_resource[] = {
223 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC1, SZ_4K),
224 [1] = DEFINE_RES_IRQ(IRQ_HSMMC1),
227 struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
229 .host_caps = (MMC_CAP_4_BIT_DATA |
230 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
233 struct platform_device s3c_device_hsmmc1 = {
236 .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource),
237 .resource = s3c_hsmmc1_resource,
239 .dma_mask = &samsung_device_dma_mask,
240 .coherent_dma_mask = DMA_BIT_MASK(32),
241 .platform_data = &s3c_hsmmc1_def_platdata,
245 void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
247 s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
249 #endif /* CONFIG_S3C_DEV_HSMMC1 */
253 #ifdef CONFIG_S3C_DEV_HSMMC2
254 static struct resource s3c_hsmmc2_resource[] = {
255 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC2, SZ_4K),
256 [1] = DEFINE_RES_IRQ(IRQ_HSMMC2),
259 struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
261 .host_caps = (MMC_CAP_4_BIT_DATA |
262 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
265 struct platform_device s3c_device_hsmmc2 = {
268 .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
269 .resource = s3c_hsmmc2_resource,
271 .dma_mask = &samsung_device_dma_mask,
272 .coherent_dma_mask = DMA_BIT_MASK(32),
273 .platform_data = &s3c_hsmmc2_def_platdata,
277 void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
279 s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
281 #endif /* CONFIG_S3C_DEV_HSMMC2 */
283 #ifdef CONFIG_S3C_DEV_HSMMC3
284 static struct resource s3c_hsmmc3_resource[] = {
285 [0] = DEFINE_RES_MEM(S3C_PA_HSMMC3, SZ_4K),
286 [1] = DEFINE_RES_IRQ(IRQ_HSMMC3),
289 struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
291 .host_caps = (MMC_CAP_4_BIT_DATA |
292 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
295 struct platform_device s3c_device_hsmmc3 = {
298 .num_resources = ARRAY_SIZE(s3c_hsmmc3_resource),
299 .resource = s3c_hsmmc3_resource,
301 .dma_mask = &samsung_device_dma_mask,
302 .coherent_dma_mask = DMA_BIT_MASK(32),
303 .platform_data = &s3c_hsmmc3_def_platdata,
307 void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
309 s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
311 #endif /* CONFIG_S3C_DEV_HSMMC3 */
315 static struct resource s3c_i2c0_resource[] = {
316 [0] = DEFINE_RES_MEM(S3C_PA_IIC, SZ_4K),
317 [1] = DEFINE_RES_IRQ(IRQ_IIC),
320 struct platform_device s3c_device_i2c0 = {
321 .name = "s3c2410-i2c",
323 .num_resources = ARRAY_SIZE(s3c_i2c0_resource),
324 .resource = s3c_i2c0_resource,
327 struct s3c2410_platform_i2c default_i2c_data __initdata = {
330 .frequency = 100*1000,
334 void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
336 struct s3c2410_platform_i2c *npd;
339 pd = &default_i2c_data;
343 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
347 npd->cfg_gpio = s3c_i2c0_cfg_gpio;
350 #ifdef CONFIG_S3C_DEV_I2C1
351 static struct resource s3c_i2c1_resource[] = {
352 [0] = DEFINE_RES_MEM(S3C_PA_IIC1, SZ_4K),
353 [1] = DEFINE_RES_IRQ(IRQ_IIC1),
356 struct platform_device s3c_device_i2c1 = {
357 .name = "s3c2410-i2c",
359 .num_resources = ARRAY_SIZE(s3c_i2c1_resource),
360 .resource = s3c_i2c1_resource,
363 void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
365 struct s3c2410_platform_i2c *npd;
368 pd = &default_i2c_data;
372 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
376 npd->cfg_gpio = s3c_i2c1_cfg_gpio;
378 #endif /* CONFIG_S3C_DEV_I2C1 */
380 #ifdef CONFIG_S3C_DEV_I2C2
381 static struct resource s3c_i2c2_resource[] = {
382 [0] = DEFINE_RES_MEM(S3C_PA_IIC2, SZ_4K),
383 [1] = DEFINE_RES_IRQ(IRQ_IIC2),
386 struct platform_device s3c_device_i2c2 = {
387 .name = "s3c2410-i2c",
389 .num_resources = ARRAY_SIZE(s3c_i2c2_resource),
390 .resource = s3c_i2c2_resource,
393 void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
395 struct s3c2410_platform_i2c *npd;
398 pd = &default_i2c_data;
402 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
406 npd->cfg_gpio = s3c_i2c2_cfg_gpio;
408 #endif /* CONFIG_S3C_DEV_I2C2 */
410 #ifdef CONFIG_S3C_DEV_I2C3
411 static struct resource s3c_i2c3_resource[] = {
412 [0] = DEFINE_RES_MEM(S3C_PA_IIC3, SZ_4K),
413 [1] = DEFINE_RES_IRQ(IRQ_IIC3),
416 struct platform_device s3c_device_i2c3 = {
417 .name = "s3c2440-i2c",
419 .num_resources = ARRAY_SIZE(s3c_i2c3_resource),
420 .resource = s3c_i2c3_resource,
423 void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
425 struct s3c2410_platform_i2c *npd;
428 pd = &default_i2c_data;
432 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
436 npd->cfg_gpio = s3c_i2c3_cfg_gpio;
438 #endif /*CONFIG_S3C_DEV_I2C3 */
440 #ifdef CONFIG_S3C_DEV_I2C4
441 static struct resource s3c_i2c4_resource[] = {
442 [0] = DEFINE_RES_MEM(S3C_PA_IIC4, SZ_4K),
443 [1] = DEFINE_RES_IRQ(IRQ_IIC4),
446 struct platform_device s3c_device_i2c4 = {
447 .name = "s3c2440-i2c",
449 .num_resources = ARRAY_SIZE(s3c_i2c4_resource),
450 .resource = s3c_i2c4_resource,
453 void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
455 struct s3c2410_platform_i2c *npd;
458 pd = &default_i2c_data;
462 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
466 npd->cfg_gpio = s3c_i2c4_cfg_gpio;
468 #endif /*CONFIG_S3C_DEV_I2C4 */
470 #ifdef CONFIG_S3C_DEV_I2C5
471 static struct resource s3c_i2c5_resource[] = {
472 [0] = DEFINE_RES_MEM(S3C_PA_IIC5, SZ_4K),
473 [1] = DEFINE_RES_IRQ(IRQ_IIC5),
476 struct platform_device s3c_device_i2c5 = {
477 .name = "s3c2440-i2c",
479 .num_resources = ARRAY_SIZE(s3c_i2c5_resource),
480 .resource = s3c_i2c5_resource,
483 void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
485 struct s3c2410_platform_i2c *npd;
488 pd = &default_i2c_data;
492 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
496 npd->cfg_gpio = s3c_i2c5_cfg_gpio;
498 #endif /*CONFIG_S3C_DEV_I2C5 */
500 #ifdef CONFIG_S3C_DEV_I2C6
501 static struct resource s3c_i2c6_resource[] = {
502 [0] = DEFINE_RES_MEM(S3C_PA_IIC6, SZ_4K),
503 [1] = DEFINE_RES_IRQ(IRQ_IIC6),
506 struct platform_device s3c_device_i2c6 = {
507 .name = "s3c2440-i2c",
509 .num_resources = ARRAY_SIZE(s3c_i2c6_resource),
510 .resource = s3c_i2c6_resource,
513 void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
515 struct s3c2410_platform_i2c *npd;
518 pd = &default_i2c_data;
522 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
526 npd->cfg_gpio = s3c_i2c6_cfg_gpio;
528 #endif /* CONFIG_S3C_DEV_I2C6 */
530 #ifdef CONFIG_S3C_DEV_I2C7
531 static struct resource s3c_i2c7_resource[] = {
532 [0] = DEFINE_RES_MEM(S3C_PA_IIC7, SZ_4K),
533 [1] = DEFINE_RES_IRQ(IRQ_IIC7),
536 struct platform_device s3c_device_i2c7 = {
537 .name = "s3c2440-i2c",
539 .num_resources = ARRAY_SIZE(s3c_i2c7_resource),
540 .resource = s3c_i2c7_resource,
543 void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
545 struct s3c2410_platform_i2c *npd;
548 pd = &default_i2c_data;
552 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
556 npd->cfg_gpio = s3c_i2c7_cfg_gpio;
558 #endif /* CONFIG_S3C_DEV_I2C7 */
562 #ifdef CONFIG_PLAT_S3C24XX
563 static struct resource s3c_iis_resource[] = {
564 [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
567 struct platform_device s3c_device_iis = {
568 .name = "s3c24xx-iis",
570 .num_resources = ARRAY_SIZE(s3c_iis_resource),
571 .resource = s3c_iis_resource,
573 .dma_mask = &samsung_device_dma_mask,
574 .coherent_dma_mask = DMA_BIT_MASK(32),
577 #endif /* CONFIG_PLAT_S3C24XX */
581 #ifdef CONFIG_SAMSUNG_DEV_IDE
582 static struct resource s3c_cfcon_resource[] = {
583 [0] = DEFINE_RES_MEM(SAMSUNG_PA_CFCON, SZ_16K),
584 [1] = DEFINE_RES_IRQ(IRQ_CFCON),
587 struct platform_device s3c_device_cfcon = {
589 .num_resources = ARRAY_SIZE(s3c_cfcon_resource),
590 .resource = s3c_cfcon_resource,
593 void __init s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
595 s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
598 #endif /* CONFIG_SAMSUNG_DEV_IDE */
602 #ifdef CONFIG_SAMSUNG_DEV_KEYPAD
603 static struct resource samsung_keypad_resources[] = {
604 [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
605 [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
608 struct platform_device samsung_device_keypad = {
609 .name = "samsung-keypad",
611 .num_resources = ARRAY_SIZE(samsung_keypad_resources),
612 .resource = samsung_keypad_resources,
615 void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
617 struct samsung_keypad_platdata *npd;
619 npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata),
620 &samsung_device_keypad);
623 npd->cfg_gpio = samsung_keypad_cfg_gpio;
625 #endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
629 #ifdef CONFIG_PLAT_S3C24XX
630 static struct resource s3c_lcd_resource[] = {
631 [0] = DEFINE_RES_MEM(S3C24XX_PA_LCD, S3C24XX_SZ_LCD),
632 [1] = DEFINE_RES_IRQ(IRQ_LCD),
635 struct platform_device s3c_device_lcd = {
636 .name = "s3c2410-lcd",
638 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
639 .resource = s3c_lcd_resource,
641 .dma_mask = &samsung_device_dma_mask,
642 .coherent_dma_mask = DMA_BIT_MASK(32),
646 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
648 struct s3c2410fb_mach_info *npd;
650 npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
652 npd->displays = kmemdup(pd->displays,
653 sizeof(struct s3c2410fb_display) * npd->num_displays,
656 printk(KERN_ERR "no memory for LCD display data\n");
658 printk(KERN_ERR "no memory for LCD platform data\n");
661 #endif /* CONFIG_PLAT_S3C24XX */
665 #ifdef CONFIG_S3C_DEV_NAND
666 static struct resource s3c_nand_resource[] = {
667 [0] = DEFINE_RES_MEM(S3C_PA_NAND, SZ_1M),
670 struct platform_device s3c_device_nand = {
671 .name = "s3c2410-nand",
673 .num_resources = ARRAY_SIZE(s3c_nand_resource),
674 .resource = s3c_nand_resource,
678 * s3c_nand_copy_set() - copy nand set data
679 * @set: The new structure, directly copied from the old.
681 * Copy all the fields from the NAND set field from what is probably __initdata
682 * to new kernel memory. The code returns 0 if the copy happened correctly or
683 * an error code for the calling function to display.
685 * Note, we currently do not try and look to see if we've already copied the
686 * data in a previous set.
688 static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
693 size = sizeof(struct mtd_partition) * set->nr_partitions;
695 ptr = kmemdup(set->partitions, size, GFP_KERNEL);
696 set->partitions = ptr;
702 if (set->nr_map && set->nr_chips) {
703 size = sizeof(int) * set->nr_chips;
704 ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
714 void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
716 struct s3c2410_platform_nand *npd;
720 /* note, if we get a failure in allocation, we simply drop out of the
721 * function. If there is so little memory available at initialisation
722 * time then there is little chance the system is going to run.
725 npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand),
730 /* now see if we need to copy any of the nand set data */
732 size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
734 struct s3c2410_nand_set *from = npd->sets;
735 struct s3c2410_nand_set *to;
738 to = kmemdup(from, size, GFP_KERNEL);
739 npd->sets = to; /* set, even if we failed */
742 printk(KERN_ERR "%s: no memory for sets\n", __func__);
746 for (i = 0; i < npd->nr_sets; i++) {
747 ret = s3c_nand_copy_set(to);
749 printk(KERN_ERR "%s: failed to copy set %d\n",
757 #endif /* CONFIG_S3C_DEV_NAND */
761 #ifdef CONFIG_S3C_DEV_ONENAND
762 static struct resource s3c_onenand_resources[] = {
763 [0] = DEFINE_RES_MEM(S3C_PA_ONENAND, SZ_1K),
764 [1] = DEFINE_RES_MEM(S3C_PA_ONENAND_BUF, S3C_SZ_ONENAND_BUF),
765 [2] = DEFINE_RES_IRQ(IRQ_ONENAND),
768 struct platform_device s3c_device_onenand = {
769 .name = "samsung-onenand",
771 .num_resources = ARRAY_SIZE(s3c_onenand_resources),
772 .resource = s3c_onenand_resources,
774 #endif /* CONFIG_S3C_DEV_ONENAND */
776 #ifdef CONFIG_S3C64XX_DEV_ONENAND1
777 static struct resource s3c64xx_onenand1_resources[] = {
778 [0] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1, SZ_1K),
779 [1] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1_BUF, S3C64XX_SZ_ONENAND1_BUF),
780 [2] = DEFINE_RES_IRQ(IRQ_ONENAND1),
783 struct platform_device s3c64xx_device_onenand1 = {
784 .name = "samsung-onenand",
786 .num_resources = ARRAY_SIZE(s3c64xx_onenand1_resources),
787 .resource = s3c64xx_onenand1_resources,
790 void __init s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
792 s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
793 &s3c64xx_device_onenand1);
795 #endif /* CONFIG_S3C64XX_DEV_ONENAND1 */
799 #ifdef CONFIG_SAMSUNG_DEV_PWM
800 static struct resource samsung_pwm_resource[] = {
801 DEFINE_RES_MEM(SAMSUNG_PA_TIMER, SZ_4K),
804 struct platform_device samsung_device_pwm = {
805 .name = "samsung-pwm",
807 .num_resources = ARRAY_SIZE(samsung_pwm_resource),
808 .resource = samsung_pwm_resource,
811 void __init samsung_pwm_set_platdata(struct samsung_pwm_variant *pd)
813 samsung_device_pwm.dev.platform_data = pd;
815 #endif /* CONFIG_SAMSUNG_DEV_PWM */
819 #ifdef CONFIG_PLAT_S3C24XX
820 static struct resource s3c_rtc_resource[] = {
821 [0] = DEFINE_RES_MEM(S3C24XX_PA_RTC, SZ_256),
822 [1] = DEFINE_RES_IRQ(IRQ_RTC),
823 [2] = DEFINE_RES_IRQ(IRQ_TICK),
826 struct platform_device s3c_device_rtc = {
827 .name = "s3c2410-rtc",
829 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
830 .resource = s3c_rtc_resource,
832 #endif /* CONFIG_PLAT_S3C24XX */
834 #ifdef CONFIG_S3C_DEV_RTC
835 static struct resource s3c_rtc_resource[] = {
836 [0] = DEFINE_RES_MEM(S3C_PA_RTC, SZ_256),
837 [1] = DEFINE_RES_IRQ(IRQ_RTC_ALARM),
838 [2] = DEFINE_RES_IRQ(IRQ_RTC_TIC),
841 struct platform_device s3c_device_rtc = {
842 .name = "s3c64xx-rtc",
844 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
845 .resource = s3c_rtc_resource,
847 #endif /* CONFIG_S3C_DEV_RTC */
851 #ifdef CONFIG_PLAT_S3C24XX
852 static struct resource s3c_sdi_resource[] = {
853 [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
854 [1] = DEFINE_RES_IRQ(IRQ_SDI),
857 struct platform_device s3c_device_sdi = {
858 .name = "s3c2410-sdi",
860 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
861 .resource = s3c_sdi_resource,
864 void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
866 s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
869 #endif /* CONFIG_PLAT_S3C24XX */
873 #ifdef CONFIG_PLAT_S3C24XX
874 static struct resource s3c_spi0_resource[] = {
875 [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI, SZ_32),
876 [1] = DEFINE_RES_IRQ(IRQ_SPI0),
879 struct platform_device s3c_device_spi0 = {
880 .name = "s3c2410-spi",
882 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
883 .resource = s3c_spi0_resource,
885 .dma_mask = &samsung_device_dma_mask,
886 .coherent_dma_mask = DMA_BIT_MASK(32),
890 static struct resource s3c_spi1_resource[] = {
891 [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI1, SZ_32),
892 [1] = DEFINE_RES_IRQ(IRQ_SPI1),
895 struct platform_device s3c_device_spi1 = {
896 .name = "s3c2410-spi",
898 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
899 .resource = s3c_spi1_resource,
901 .dma_mask = &samsung_device_dma_mask,
902 .coherent_dma_mask = DMA_BIT_MASK(32),
905 #endif /* CONFIG_PLAT_S3C24XX */
909 #ifdef CONFIG_PLAT_S3C24XX
910 static struct resource s3c_ts_resource[] = {
911 [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
912 [1] = DEFINE_RES_IRQ(IRQ_TC),
915 struct platform_device s3c_device_ts = {
916 .name = "s3c2410-ts",
918 .dev.parent = &s3c_device_adc.dev,
919 .num_resources = ARRAY_SIZE(s3c_ts_resource),
920 .resource = s3c_ts_resource,
923 void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
925 s3c_set_platdata(hard_s3c2410ts_info,
926 sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
928 #endif /* CONFIG_PLAT_S3C24XX */
930 #ifdef CONFIG_SAMSUNG_DEV_TS
931 static struct s3c2410_ts_mach_info default_ts_data __initdata = {
934 .oversampling_shift = 2,
937 void __init s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
940 pd = &default_ts_data;
942 s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
945 #endif /* CONFIG_SAMSUNG_DEV_TS */
949 #ifdef CONFIG_S3C_DEV_USB_HOST
950 static struct resource s3c_usb_resource[] = {
951 [0] = DEFINE_RES_MEM(S3C_PA_USBHOST, SZ_256),
952 [1] = DEFINE_RES_IRQ(IRQ_USBH),
955 struct platform_device s3c_device_ohci = {
956 .name = "s3c2410-ohci",
958 .num_resources = ARRAY_SIZE(s3c_usb_resource),
959 .resource = s3c_usb_resource,
961 .dma_mask = &samsung_device_dma_mask,
962 .coherent_dma_mask = DMA_BIT_MASK(32),
967 * s3c_ohci_set_platdata - initialise OHCI device platform data
968 * @info: The platform data.
970 * This call copies the @info passed in and sets the device .platform_data
971 * field to that copy. The @info is copied so that the original can be marked
975 void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
977 s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
980 #endif /* CONFIG_S3C_DEV_USB_HOST */
982 /* USB Device (Gadget) */
984 #ifdef CONFIG_PLAT_S3C24XX
985 static struct resource s3c_usbgadget_resource[] = {
986 [0] = DEFINE_RES_MEM(S3C24XX_PA_USBDEV, S3C24XX_SZ_USBDEV),
987 [1] = DEFINE_RES_IRQ(IRQ_USBD),
990 struct platform_device s3c_device_usbgadget = {
991 .name = "s3c2410-usbgadget",
993 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
994 .resource = s3c_usbgadget_resource,
997 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
999 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
1001 #endif /* CONFIG_PLAT_S3C24XX */
1005 #ifdef CONFIG_S3C_DEV_USB_HSOTG
1006 static struct resource s3c_usb_hsotg_resources[] = {
1007 [0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
1008 [1] = DEFINE_RES_IRQ(IRQ_OTG),
1011 struct platform_device s3c_device_usb_hsotg = {
1012 .name = "s3c-hsotg",
1014 .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources),
1015 .resource = s3c_usb_hsotg_resources,
1017 .dma_mask = &samsung_device_dma_mask,
1018 .coherent_dma_mask = DMA_BIT_MASK(32),
1022 void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd)
1024 struct dwc2_hsotg_plat *npd;
1026 npd = s3c_set_platdata(pd, sizeof(struct dwc2_hsotg_plat),
1027 &s3c_device_usb_hsotg);
1030 npd->phy_init = s5p_usb_phy_init;
1032 npd->phy_exit = s5p_usb_phy_exit;
1034 #endif /* CONFIG_S3C_DEV_USB_HSOTG */
1036 /* USB High Spped 2.0 Device (Gadget) */
1038 #ifdef CONFIG_PLAT_S3C24XX
1039 static struct resource s3c_hsudc_resource[] = {
1040 [0] = DEFINE_RES_MEM(S3C2416_PA_HSUDC, S3C2416_SZ_HSUDC),
1041 [1] = DEFINE_RES_IRQ(IRQ_USBD),
1044 struct platform_device s3c_device_usb_hsudc = {
1045 .name = "s3c-hsudc",
1047 .num_resources = ARRAY_SIZE(s3c_hsudc_resource),
1048 .resource = s3c_hsudc_resource,
1050 .dma_mask = &samsung_device_dma_mask,
1051 .coherent_dma_mask = DMA_BIT_MASK(32),
1055 void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
1057 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
1059 #endif /* CONFIG_PLAT_S3C24XX */
1063 #ifdef CONFIG_S3C_DEV_WDT
1064 static struct resource s3c_wdt_resource[] = {
1065 [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
1066 [1] = DEFINE_RES_IRQ(IRQ_WDT),
1069 struct platform_device s3c_device_wdt = {
1070 .name = "s3c2410-wdt",
1072 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
1073 .resource = s3c_wdt_resource,
1075 #endif /* CONFIG_S3C_DEV_WDT */
1077 #ifdef CONFIG_S3C64XX_DEV_SPI0
1078 static struct resource s3c64xx_spi0_resource[] = {
1079 [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
1080 [1] = DEFINE_RES_IRQ(IRQ_SPI0),
1083 struct platform_device s3c64xx_device_spi0 = {
1084 .name = "s3c6410-spi",
1086 .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
1087 .resource = s3c64xx_spi0_resource,
1089 .dma_mask = &samsung_device_dma_mask,
1090 .coherent_dma_mask = DMA_BIT_MASK(32),
1094 void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1097 struct s3c64xx_spi_info pd;
1099 /* Reject invalid configuration */
1100 if (!num_cs || src_clk_nr < 0) {
1101 pr_err("%s: Invalid SPI configuration\n", __func__);
1106 pd.src_clk_nr = src_clk_nr;
1107 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
1109 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
1111 #endif /* CONFIG_S3C64XX_DEV_SPI0 */
1113 #ifdef CONFIG_S3C64XX_DEV_SPI1
1114 static struct resource s3c64xx_spi1_resource[] = {
1115 [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
1116 [1] = DEFINE_RES_IRQ(IRQ_SPI1),
1119 struct platform_device s3c64xx_device_spi1 = {
1120 .name = "s3c6410-spi",
1122 .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource),
1123 .resource = s3c64xx_spi1_resource,
1125 .dma_mask = &samsung_device_dma_mask,
1126 .coherent_dma_mask = DMA_BIT_MASK(32),
1130 void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1133 struct s3c64xx_spi_info pd;
1135 /* Reject invalid configuration */
1136 if (!num_cs || src_clk_nr < 0) {
1137 pr_err("%s: Invalid SPI configuration\n", __func__);
1142 pd.src_clk_nr = src_clk_nr;
1143 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
1145 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
1147 #endif /* CONFIG_S3C64XX_DEV_SPI1 */
1149 #ifdef CONFIG_S3C64XX_DEV_SPI2
1150 static struct resource s3c64xx_spi2_resource[] = {
1151 [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
1152 [1] = DEFINE_RES_IRQ(IRQ_SPI2),
1155 struct platform_device s3c64xx_device_spi2 = {
1156 .name = "s3c6410-spi",
1158 .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource),
1159 .resource = s3c64xx_spi2_resource,
1161 .dma_mask = &samsung_device_dma_mask,
1162 .coherent_dma_mask = DMA_BIT_MASK(32),
1166 void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1169 struct s3c64xx_spi_info pd;
1171 /* Reject invalid configuration */
1172 if (!num_cs || src_clk_nr < 0) {
1173 pr_err("%s: Invalid SPI configuration\n", __func__);
1178 pd.src_clk_nr = src_clk_nr;
1179 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
1181 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
1183 #endif /* CONFIG_S3C64XX_DEV_SPI2 */