aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung/devs.c
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2011-10-02 20:47:58 -0400
committerKukjin Kim <kgene.kim@samsung.com>2011-10-05 22:15:11 -0400
commitbad1e6aadd17c97b0d10e8ccd9205ea5b7858c53 (patch)
treea3aed0a1fc21fae6d9416dd37ac203613f34ffb9 /arch/arm/plat-samsung/devs.c
parent5716714927b789a27853eaacdbba1f2675505af0 (diff)
ARM: SAMSUNG: Cleanup plat-samsung/devs.c and devs.h
This patch merges each dev files to one devs.c file in plat-samsung directory and this help to keep it more easily to reduce plat- directories such as plat-s3c24xx and plat-s5p. Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung/devs.c')
-rw-r--r--arch/arm/plat-samsung/devs.c987
1 files changed, 987 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index d8bd7ad6367c..a2112aa88c1f 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -26,6 +26,8 @@
26#include <linux/gfp.h> 26#include <linux/gfp.h>
27#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
28#include <linux/mtd/onenand.h> 28#include <linux/mtd/onenand.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mmc/host.h>
29#include <linux/ioport.h> 31#include <linux/ioport.h>
30 32
31#include <asm/irq.h> 33#include <asm/irq.h>
@@ -41,13 +43,20 @@
41 43
42#include <plat/cpu.h> 44#include <plat/cpu.h>
43#include <plat/devs.h> 45#include <plat/devs.h>
46#include <plat/adc.h>
47#include <plat/ata.h>
44#include <plat/ehci.h> 48#include <plat/ehci.h>
45#include <plat/fb.h> 49#include <plat/fb.h>
46#include <plat/fb-s3c2410.h> 50#include <plat/fb-s3c2410.h>
51#include <plat/hwmon.h>
47#include <plat/iic.h> 52#include <plat/iic.h>
53#include <plat/keypad.h>
48#include <plat/mci.h> 54#include <plat/mci.h>
55#include <plat/nand.h>
56#include <plat/sdhci.h>
49#include <plat/ts.h> 57#include <plat/ts.h>
50#include <plat/udc.h> 58#include <plat/udc.h>
59#include <plat/usb-control.h>
51#include <plat/usb-phy.h> 60#include <plat/usb-phy.h>
52#include <plat/regs-iic.h> 61#include <plat/regs-iic.h>
53#include <plat/regs-serial.h> 62#include <plat/regs-serial.h>
@@ -129,6 +138,33 @@ struct platform_device s3c_device_adc = {
129}; 138};
130#endif /* CONFIG_PLAT_S3C24XX */ 139#endif /* CONFIG_PLAT_S3C24XX */
131 140
141#if defined(CONFIG_SAMSUNG_DEV_ADC)
142static struct resource s3c_adc_resource[] = {
143 [0] = {
144 .start = SAMSUNG_PA_ADC,
145 .end = SAMSUNG_PA_ADC + SZ_256 - 1,
146 .flags = IORESOURCE_MEM,
147 },
148 [1] = {
149 .start = IRQ_TC,
150 .end = IRQ_TC,
151 .flags = IORESOURCE_IRQ,
152 },
153 [2] = {
154 .start = IRQ_ADC,
155 .end = IRQ_ADC,
156 .flags = IORESOURCE_IRQ,
157 },
158};
159
160struct platform_device s3c_device_adc = {
161 .name = "samsung-adc",
162 .id = -1,
163 .num_resources = ARRAY_SIZE(s3c_adc_resource),
164 .resource = s3c_adc_resource,
165};
166#endif /* CONFIG_SAMSUNG_DEV_ADC */
167
132/* Camif Controller */ 168/* Camif Controller */
133 169
134#ifdef CONFIG_CPU_S3C2440 170#ifdef CONFIG_CPU_S3C2440
@@ -157,6 +193,70 @@ struct platform_device s3c_device_camif = {
157}; 193};
158#endif /* CONFIG_CPU_S3C2440 */ 194#endif /* CONFIG_CPU_S3C2440 */
159 195
196/* ASOC DMA */
197
198struct platform_device samsung_asoc_dma = {
199 .name = "samsung-audio",
200 .id = -1,
201 .dev = {
202 .dma_mask = &samsung_device_dma_mask,
203 .coherent_dma_mask = DMA_BIT_MASK(32),
204 }
205};
206
207struct platform_device samsung_asoc_idma = {
208 .name = "samsung-idma",
209 .id = -1,
210 .dev = {
211 .dma_mask = &samsung_device_dma_mask,
212 .coherent_dma_mask = DMA_BIT_MASK(32),
213 }
214};
215
216/* FB */
217
218#ifdef CONFIG_S3C_DEV_FB
219static struct resource s3c_fb_resource[] = {
220 [0] = {
221 .start = S3C_PA_FB,
222 .end = S3C_PA_FB + SZ_16K - 1,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .start = IRQ_LCD_VSYNC,
227 .end = IRQ_LCD_VSYNC,
228 .flags = IORESOURCE_IRQ,
229 },
230 [2] = {
231 .start = IRQ_LCD_FIFO,
232 .end = IRQ_LCD_FIFO,
233 .flags = IORESOURCE_IRQ,
234 },
235 [3] = {
236 .start = IRQ_LCD_SYSTEM,
237 .end = IRQ_LCD_SYSTEM,
238 .flags = IORESOURCE_IRQ,
239 },
240};
241
242struct platform_device s3c_device_fb = {
243 .name = "s3c-fb",
244 .id = -1,
245 .num_resources = ARRAY_SIZE(s3c_fb_resource),
246 .resource = s3c_fb_resource,
247 .dev = {
248 .dma_mask = &samsung_device_dma_mask,
249 .coherent_dma_mask = DMA_BIT_MASK(32),
250 },
251};
252
253void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
254{
255 s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
256 &s3c_device_fb);
257}
258#endif /* CONFIG_S3C_DEV_FB */
259
160/* FIMC */ 260/* FIMC */
161 261
162#ifdef CONFIG_S5P_DEV_FIMC0 262#ifdef CONFIG_S5P_DEV_FIMC0
@@ -307,6 +407,497 @@ void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd)
307} 407}
308#endif /* CONFIG_S5P_DEV_FIMD0 */ 408#endif /* CONFIG_S5P_DEV_FIMD0 */
309 409
410/* HWMON */
411
412#ifdef CONFIG_S3C_DEV_HWMON
413struct platform_device s3c_device_hwmon = {
414 .name = "s3c-hwmon",
415 .id = -1,
416 .dev.parent = &s3c_device_adc.dev,
417};
418
419void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
420{
421 s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
422 &s3c_device_hwmon);
423}
424#endif /* CONFIG_S3C_DEV_HWMON */
425
426/* HSMMC */
427
428#define S3C_SZ_HSMMC 0x1000
429
430#ifdef CONFIG_S3C_DEV_HSMMC
431static struct resource s3c_hsmmc_resource[] = {
432 [0] = {
433 .start = S3C_PA_HSMMC0,
434 .end = S3C_PA_HSMMC0 + S3C_SZ_HSMMC - 1,
435 .flags = IORESOURCE_MEM,
436 },
437 [1] = {
438 .start = IRQ_HSMMC0,
439 .end = IRQ_HSMMC0,
440 .flags = IORESOURCE_IRQ,
441 }
442};
443
444struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
445 .max_width = 4,
446 .host_caps = (MMC_CAP_4_BIT_DATA |
447 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
448 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
449};
450
451struct platform_device s3c_device_hsmmc0 = {
452 .name = "s3c-sdhci",
453 .id = 0,
454 .num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
455 .resource = s3c_hsmmc_resource,
456 .dev = {
457 .dma_mask = &samsung_device_dma_mask,
458 .coherent_dma_mask = DMA_BIT_MASK(32),
459 .platform_data = &s3c_hsmmc0_def_platdata,
460 },
461};
462
463void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
464{
465 s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
466}
467#endif /* CONFIG_S3C_DEV_HSMMC */
468
469#ifdef CONFIG_S3C_DEV_HSMMC1
470static struct resource s3c_hsmmc1_resource[] = {
471 [0] = {
472 .start = S3C_PA_HSMMC1,
473 .end = S3C_PA_HSMMC1 + S3C_SZ_HSMMC - 1,
474 .flags = IORESOURCE_MEM,
475 },
476 [1] = {
477 .start = IRQ_HSMMC1,
478 .end = IRQ_HSMMC1,
479 .flags = IORESOURCE_IRQ,
480 }
481};
482
483struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
484 .max_width = 4,
485 .host_caps = (MMC_CAP_4_BIT_DATA |
486 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
487 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
488};
489
490struct platform_device s3c_device_hsmmc1 = {
491 .name = "s3c-sdhci",
492 .id = 1,
493 .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource),
494 .resource = s3c_hsmmc1_resource,
495 .dev = {
496 .dma_mask = &samsung_device_dma_mask,
497 .coherent_dma_mask = DMA_BIT_MASK(32),
498 .platform_data = &s3c_hsmmc1_def_platdata,
499 },
500};
501
502void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
503{
504 s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
505}
506#endif /* CONFIG_S3C_DEV_HSMMC1 */
507
508/* HSMMC2 */
509
510#ifdef CONFIG_S3C_DEV_HSMMC2
511static struct resource s3c_hsmmc2_resource[] = {
512 [0] = {
513 .start = S3C_PA_HSMMC2,
514 .end = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1,
515 .flags = IORESOURCE_MEM,
516 },
517 [1] = {
518 .start = IRQ_HSMMC2,
519 .end = IRQ_HSMMC2,
520 .flags = IORESOURCE_IRQ,
521 }
522};
523
524struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
525 .max_width = 4,
526 .host_caps = (MMC_CAP_4_BIT_DATA |
527 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
528 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
529};
530
531struct platform_device s3c_device_hsmmc2 = {
532 .name = "s3c-sdhci",
533 .id = 2,
534 .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
535 .resource = s3c_hsmmc2_resource,
536 .dev = {
537 .dma_mask = &samsung_device_dma_mask,
538 .coherent_dma_mask = DMA_BIT_MASK(32),
539 .platform_data = &s3c_hsmmc2_def_platdata,
540 },
541};
542
543void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
544{
545 s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
546}
547#endif /* CONFIG_S3C_DEV_HSMMC2 */
548
549#ifdef CONFIG_S3C_DEV_HSMMC3
550static struct resource s3c_hsmmc3_resource[] = {
551 [0] = {
552 .start = S3C_PA_HSMMC3,
553 .end = S3C_PA_HSMMC3 + S3C_SZ_HSMMC - 1,
554 .flags = IORESOURCE_MEM,
555 },
556 [1] = {
557 .start = IRQ_HSMMC3,
558 .end = IRQ_HSMMC3,
559 .flags = IORESOURCE_IRQ,
560 }
561};
562
563struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
564 .max_width = 4,
565 .host_caps = (MMC_CAP_4_BIT_DATA |
566 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
567 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
568};
569
570struct platform_device s3c_device_hsmmc3 = {
571 .name = "s3c-sdhci",
572 .id = 3,
573 .num_resources = ARRAY_SIZE(s3c_hsmmc3_resource),
574 .resource = s3c_hsmmc3_resource,
575 .dev = {
576 .dma_mask = &samsung_device_dma_mask,
577 .coherent_dma_mask = DMA_BIT_MASK(32),
578 .platform_data = &s3c_hsmmc3_def_platdata,
579 },
580};
581
582void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
583{
584 s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
585}
586#endif /* CONFIG_S3C_DEV_HSMMC3 */
587
588/* I2C */
589
590static struct resource s3c_i2c0_resource[] = {
591 [0] = {
592 .start = S3C_PA_IIC,
593 .end = S3C_PA_IIC + SZ_4K - 1,
594 .flags = IORESOURCE_MEM,
595 },
596 [1] = {
597 .start = IRQ_IIC,
598 .end = IRQ_IIC,
599 .flags = IORESOURCE_IRQ,
600 },
601};
602
603struct platform_device s3c_device_i2c0 = {
604 .name = "s3c2410-i2c",
605#ifdef CONFIG_S3C_DEV_I2C1
606 .id = 0,
607#else
608 .id = -1,
609#endif
610 .num_resources = ARRAY_SIZE(s3c_i2c0_resource),
611 .resource = s3c_i2c0_resource,
612};
613
614struct s3c2410_platform_i2c default_i2c_data __initdata = {
615 .flags = 0,
616 .slave_addr = 0x10,
617 .frequency = 100*1000,
618 .sda_delay = 100,
619};
620
621void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
622{
623 struct s3c2410_platform_i2c *npd;
624
625 if (!pd)
626 pd = &default_i2c_data;
627
628 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
629 &s3c_device_i2c0);
630
631 if (!npd->cfg_gpio)
632 npd->cfg_gpio = s3c_i2c0_cfg_gpio;
633}
634
635#ifdef CONFIG_S3C_DEV_I2C1
636static struct resource s3c_i2c1_resource[] = {
637 [0] = {
638 .start = S3C_PA_IIC1,
639 .end = S3C_PA_IIC1 + SZ_4K - 1,
640 .flags = IORESOURCE_MEM,
641 },
642 [1] = {
643 .start = IRQ_IIC1,
644 .end = IRQ_IIC1,
645 .flags = IORESOURCE_IRQ,
646 },
647};
648
649struct platform_device s3c_device_i2c1 = {
650 .name = "s3c2410-i2c",
651 .id = 1,
652 .num_resources = ARRAY_SIZE(s3c_i2c1_resource),
653 .resource = s3c_i2c1_resource,
654};
655
656void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
657{
658 struct s3c2410_platform_i2c *npd;
659
660 if (!pd) {
661 pd = &default_i2c_data;
662 pd->bus_num = 1;
663 }
664
665 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
666 &s3c_device_i2c1);
667
668 if (!npd->cfg_gpio)
669 npd->cfg_gpio = s3c_i2c1_cfg_gpio;
670}
671#endif /* CONFIG_S3C_DEV_I2C1 */
672
673#ifdef CONFIG_S3C_DEV_I2C2
674static struct resource s3c_i2c2_resource[] = {
675 [0] = {
676 .start = S3C_PA_IIC2,
677 .end = S3C_PA_IIC2 + SZ_4K - 1,
678 .flags = IORESOURCE_MEM,
679 },
680 [1] = {
681 .start = IRQ_IIC2,
682 .end = IRQ_IIC2,
683 .flags = IORESOURCE_IRQ,
684 },
685};
686
687struct platform_device s3c_device_i2c2 = {
688 .name = "s3c2410-i2c",
689 .id = 2,
690 .num_resources = ARRAY_SIZE(s3c_i2c2_resource),
691 .resource = s3c_i2c2_resource,
692};
693
694void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
695{
696 struct s3c2410_platform_i2c *npd;
697
698 if (!pd) {
699 pd = &default_i2c_data;
700 pd->bus_num = 2;
701 }
702
703 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
704 &s3c_device_i2c2);
705
706 if (!npd->cfg_gpio)
707 npd->cfg_gpio = s3c_i2c2_cfg_gpio;
708}
709#endif /* CONFIG_S3C_DEV_I2C2 */
710
711#ifdef CONFIG_S3C_DEV_I2C3
712static struct resource s3c_i2c3_resource[] = {
713 [0] = {
714 .start = S3C_PA_IIC3,
715 .end = S3C_PA_IIC3 + SZ_4K - 1,
716 .flags = IORESOURCE_MEM,
717 },
718 [1] = {
719 .start = IRQ_IIC3,
720 .end = IRQ_IIC3,
721 .flags = IORESOURCE_IRQ,
722 },
723};
724
725struct platform_device s3c_device_i2c3 = {
726 .name = "s3c2440-i2c",
727 .id = 3,
728 .num_resources = ARRAY_SIZE(s3c_i2c3_resource),
729 .resource = s3c_i2c3_resource,
730};
731
732void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
733{
734 struct s3c2410_platform_i2c *npd;
735
736 if (!pd) {
737 pd = &default_i2c_data;
738 pd->bus_num = 3;
739 }
740
741 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
742 &s3c_device_i2c3);
743
744 if (!npd->cfg_gpio)
745 npd->cfg_gpio = s3c_i2c3_cfg_gpio;
746}
747#endif /*CONFIG_S3C_DEV_I2C3 */
748
749#ifdef CONFIG_S3C_DEV_I2C4
750static struct resource s3c_i2c4_resource[] = {
751 [0] = {
752 .start = S3C_PA_IIC4,
753 .end = S3C_PA_IIC4 + SZ_4K - 1,
754 .flags = IORESOURCE_MEM,
755 },
756 [1] = {
757 .start = IRQ_IIC4,
758 .end = IRQ_IIC4,
759 .flags = IORESOURCE_IRQ,
760 },
761};
762
763struct platform_device s3c_device_i2c4 = {
764 .name = "s3c2440-i2c",
765 .id = 4,
766 .num_resources = ARRAY_SIZE(s3c_i2c4_resource),
767 .resource = s3c_i2c4_resource,
768};
769
770void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
771{
772 struct s3c2410_platform_i2c *npd;
773
774 if (!pd) {
775 pd = &default_i2c_data;
776 pd->bus_num = 4;
777 }
778
779 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
780 &s3c_device_i2c4);
781
782 if (!npd->cfg_gpio)
783 npd->cfg_gpio = s3c_i2c4_cfg_gpio;
784}
785#endif /*CONFIG_S3C_DEV_I2C4 */
786
787#ifdef CONFIG_S3C_DEV_I2C5
788static struct resource s3c_i2c5_resource[] = {
789 [0] = {
790 .start = S3C_PA_IIC5,
791 .end = S3C_PA_IIC5 + SZ_4K - 1,
792 .flags = IORESOURCE_MEM,
793 },
794 [1] = {
795 .start = IRQ_IIC5,
796 .end = IRQ_IIC5,
797 .flags = IORESOURCE_IRQ,
798 },
799};
800
801struct platform_device s3c_device_i2c5 = {
802 .name = "s3c2440-i2c",
803 .id = 5,
804 .num_resources = ARRAY_SIZE(s3c_i2c5_resource),
805 .resource = s3c_i2c5_resource,
806};
807
808void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
809{
810 struct s3c2410_platform_i2c *npd;
811
812 if (!pd) {
813 pd = &default_i2c_data;
814 pd->bus_num = 5;
815 }
816
817 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
818 &s3c_device_i2c5);
819
820 if (!npd->cfg_gpio)
821 npd->cfg_gpio = s3c_i2c5_cfg_gpio;
822}
823#endif /*CONFIG_S3C_DEV_I2C5 */
824
825#ifdef CONFIG_S3C_DEV_I2C6
826static struct resource s3c_i2c6_resource[] = {
827 [0] = {
828 .start = S3C_PA_IIC6,
829 .end = S3C_PA_IIC6 + SZ_4K - 1,
830 .flags = IORESOURCE_MEM,
831 },
832 [1] = {
833 .start = IRQ_IIC6,
834 .end = IRQ_IIC6,
835 .flags = IORESOURCE_IRQ,
836 },
837};
838
839struct platform_device s3c_device_i2c6 = {
840 .name = "s3c2440-i2c",
841 .id = 6,
842 .num_resources = ARRAY_SIZE(s3c_i2c6_resource),
843 .resource = s3c_i2c6_resource,
844};
845
846void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
847{
848 struct s3c2410_platform_i2c *npd;
849
850 if (!pd) {
851 pd = &default_i2c_data;
852 pd->bus_num = 6;
853 }
854
855 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
856 &s3c_device_i2c6);
857
858 if (!npd->cfg_gpio)
859 npd->cfg_gpio = s3c_i2c6_cfg_gpio;
860}
861#endif /* CONFIG_S3C_DEV_I2C6 */
862
863#ifdef CONFIG_S3C_DEV_I2C7
864static struct resource s3c_i2c7_resource[] = {
865 [0] = {
866 .start = S3C_PA_IIC7,
867 .end = S3C_PA_IIC7 + SZ_4K - 1,
868 .flags = IORESOURCE_MEM,
869 },
870 [1] = {
871 .start = IRQ_IIC7,
872 .end = IRQ_IIC7,
873 .flags = IORESOURCE_IRQ,
874 },
875};
876
877struct platform_device s3c_device_i2c7 = {
878 .name = "s3c2440-i2c",
879 .id = 7,
880 .num_resources = ARRAY_SIZE(s3c_i2c7_resource),
881 .resource = s3c_i2c7_resource,
882};
883
884void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
885{
886 struct s3c2410_platform_i2c *npd;
887
888 if (!pd) {
889 pd = &default_i2c_data;
890 pd->bus_num = 7;
891 }
892
893 npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
894 &s3c_device_i2c7);
895
896 if (!npd->cfg_gpio)
897 npd->cfg_gpio = s3c_i2c7_cfg_gpio;
898}
899#endif /* CONFIG_S3C_DEV_I2C7 */
900
310/* I2C HDMIPHY */ 901/* I2C HDMIPHY */
311 902
312#ifdef CONFIG_S5P_DEV_I2C_HDMIPHY 903#ifdef CONFIG_S5P_DEV_I2C_HDMIPHY
@@ -384,6 +975,70 @@ struct platform_device s3c2412_device_iis = {
384}; 975};
385#endif /* CONFIG_CPU_S3C2440 */ 976#endif /* CONFIG_CPU_S3C2440 */
386 977
978/* IDE CFCON */
979
980#ifdef CONFIG_SAMSUNG_DEV_IDE
981static struct resource s3c_cfcon_resource[] = {
982 [0] = {
983 .start = SAMSUNG_PA_CFCON,
984 .end = SAMSUNG_PA_CFCON + SZ_16K - 1,
985 .flags = IORESOURCE_MEM,
986 },
987 [1] = {
988 .start = IRQ_CFCON,
989 .end = IRQ_CFCON,
990 .flags = IORESOURCE_IRQ,
991 },
992};
993
994struct platform_device s3c_device_cfcon = {
995 .id = 0,
996 .num_resources = ARRAY_SIZE(s3c_cfcon_resource),
997 .resource = s3c_cfcon_resource,
998};
999
1000void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
1001{
1002 s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
1003 &s3c_device_cfcon);
1004}
1005#endif /* CONFIG_SAMSUNG_DEV_IDE */
1006
1007/* KEYPAD */
1008
1009#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
1010static struct resource samsung_keypad_resources[] = {
1011 [0] = {
1012 .start = SAMSUNG_PA_KEYPAD,
1013 .end = SAMSUNG_PA_KEYPAD + 0x20 - 1,
1014 .flags = IORESOURCE_MEM,
1015 },
1016 [1] = {
1017 .start = IRQ_KEYPAD,
1018 .end = IRQ_KEYPAD,
1019 .flags = IORESOURCE_IRQ,
1020 },
1021};
1022
1023struct platform_device samsung_device_keypad = {
1024 .name = "samsung-keypad",
1025 .id = -1,
1026 .num_resources = ARRAY_SIZE(samsung_keypad_resources),
1027 .resource = samsung_keypad_resources,
1028};
1029
1030void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
1031{
1032 struct samsung_keypad_platdata *npd;
1033
1034 npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata),
1035 &samsung_device_keypad);
1036
1037 if (!npd->cfg_gpio)
1038 npd->cfg_gpio = samsung_keypad_cfg_gpio;
1039}
1040#endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
1041
387/* LCD Controller */ 1042/* LCD Controller */
388 1043
389#ifdef CONFIG_PLAT_S3C24XX 1044#ifdef CONFIG_PLAT_S3C24XX
@@ -526,6 +1181,144 @@ struct platform_device s5p_device_mipi_csis1 = {
526}; 1181};
527#endif 1182#endif
528 1183
1184/* NAND */
1185
1186#ifdef CONFIG_S3C_DEV_NAND
1187static struct resource s3c_nand_resource[] = {
1188 [0] = {
1189 .start = S3C_PA_NAND,
1190 .end = S3C_PA_NAND + SZ_1M,
1191 .flags = IORESOURCE_MEM,
1192 }
1193};
1194
1195struct platform_device s3c_device_nand = {
1196 .name = "s3c2410-nand",
1197 .id = -1,
1198 .num_resources = ARRAY_SIZE(s3c_nand_resource),
1199 .resource = s3c_nand_resource,
1200};
1201
1202/*
1203 * s3c_nand_copy_set() - copy nand set data
1204 * @set: The new structure, directly copied from the old.
1205 *
1206 * Copy all the fields from the NAND set field from what is probably __initdata
1207 * to new kernel memory. The code returns 0 if the copy happened correctly or
1208 * an error code for the calling function to display.
1209 *
1210 * Note, we currently do not try and look to see if we've already copied the
1211 * data in a previous set.
1212 */
1213static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
1214{
1215 void *ptr;
1216 int size;
1217
1218 size = sizeof(struct mtd_partition) * set->nr_partitions;
1219 if (size) {
1220 ptr = kmemdup(set->partitions, size, GFP_KERNEL);
1221 set->partitions = ptr;
1222
1223 if (!ptr)
1224 return -ENOMEM;
1225 }
1226
1227 if (set->nr_map && set->nr_chips) {
1228 size = sizeof(int) * set->nr_chips;
1229 ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
1230 set->nr_map = ptr;
1231
1232 if (!ptr)
1233 return -ENOMEM;
1234 }
1235
1236 if (set->ecc_layout) {
1237 ptr = kmemdup(set->ecc_layout,
1238 sizeof(struct nand_ecclayout), GFP_KERNEL);
1239 set->ecc_layout = ptr;
1240
1241 if (!ptr)
1242 return -ENOMEM;
1243 }
1244
1245 return 0;
1246}
1247
1248void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
1249{
1250 struct s3c2410_platform_nand *npd;
1251 int size;
1252 int ret;
1253
1254 /* note, if we get a failure in allocation, we simply drop out of the
1255 * function. If there is so little memory available at initialisation
1256 * time then there is little chance the system is going to run.
1257 */
1258
1259 npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand),
1260 &s3c_device_nand);
1261 if (!npd)
1262 return;
1263
1264 /* now see if we need to copy any of the nand set data */
1265
1266 size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
1267 if (size) {
1268 struct s3c2410_nand_set *from = npd->sets;
1269 struct s3c2410_nand_set *to;
1270 int i;
1271
1272 to = kmemdup(from, size, GFP_KERNEL);
1273 npd->sets = to; /* set, even if we failed */
1274
1275 if (!to) {
1276 printk(KERN_ERR "%s: no memory for sets\n", __func__);
1277 return;
1278 }
1279
1280 for (i = 0; i < npd->nr_sets; i++) {
1281 ret = s3c_nand_copy_set(to);
1282 if (ret) {
1283 printk(KERN_ERR "%s: failed to copy set %d\n",
1284 __func__, i);
1285 return;
1286 }
1287 to++;
1288 }
1289 }
1290}
1291#endif /* CONFIG_S3C_DEV_NAND */
1292
1293/* ONENAND */
1294
1295#ifdef CONFIG_S3C_DEV_ONENAND
1296static struct resource s3c_onenand_resources[] = {
1297 [0] = {
1298 .start = S3C_PA_ONENAND,
1299 .end = S3C_PA_ONENAND + 0x400 - 1,
1300 .flags = IORESOURCE_MEM,
1301 },
1302 [1] = {
1303 .start = S3C_PA_ONENAND_BUF,
1304 .end = S3C_PA_ONENAND_BUF + S3C_SZ_ONENAND_BUF - 1,
1305 .flags = IORESOURCE_MEM,
1306 },
1307 [2] = {
1308 .start = IRQ_ONENAND,
1309 .end = IRQ_ONENAND,
1310 .flags = IORESOURCE_IRQ,
1311 },
1312};
1313
1314struct platform_device s3c_device_onenand = {
1315 .name = "samsung-onenand",
1316 .id = 0,
1317 .num_resources = ARRAY_SIZE(s3c_onenand_resources),
1318 .resource = s3c_onenand_resources,
1319};
1320#endif /* CONFIG_S3C_DEV_ONENAND */
1321
529#ifdef CONFIG_S3C64XX_DEV_ONENAND1 1322#ifdef CONFIG_S3C64XX_DEV_ONENAND1
530static struct resource s3c64xx_onenand1_resources[] = { 1323static struct resource s3c64xx_onenand1_resources[] = {
531 [0] = { 1324 [0] = {
@@ -610,6 +1403,41 @@ static int __init s5p_pmu_init(void)
610arch_initcall(s5p_pmu_init); 1403arch_initcall(s5p_pmu_init);
611#endif /* CONFIG_PLAT_S5P */ 1404#endif /* CONFIG_PLAT_S5P */
612 1405
1406/* PWM Timer */
1407
1408#ifdef CONFIG_SAMSUNG_DEV_PWM
1409
1410#define TIMER_RESOURCE_SIZE (1)
1411
1412#define TIMER_RESOURCE(_tmr, _irq) \
1413 (struct resource [TIMER_RESOURCE_SIZE]) { \
1414 [0] = { \
1415 .start = _irq, \
1416 .end = _irq, \
1417 .flags = IORESOURCE_IRQ \
1418 } \
1419 }
1420
1421#define DEFINE_S3C_TIMER(_tmr_no, _irq) \
1422 .name = "s3c24xx-pwm", \
1423 .id = _tmr_no, \
1424 .num_resources = TIMER_RESOURCE_SIZE, \
1425 .resource = TIMER_RESOURCE(_tmr_no, _irq), \
1426
1427/*
1428 * since we already have an static mapping for the timer,
1429 * we do not bother setting any IO resource for the base.
1430 */
1431
1432struct platform_device s3c_device_timer[] = {
1433 [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
1434 [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
1435 [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
1436 [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
1437 [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
1438};
1439#endif /* CONFIG_SAMSUNG_DEV_PWM */
1440
613/* RTC */ 1441/* RTC */
614 1442
615#ifdef CONFIG_PLAT_S3C24XX 1443#ifdef CONFIG_PLAT_S3C24XX
@@ -639,6 +1467,33 @@ struct platform_device s3c_device_rtc = {
639}; 1467};
640#endif /* CONFIG_PLAT_S3C24XX */ 1468#endif /* CONFIG_PLAT_S3C24XX */
641 1469
1470#ifdef CONFIG_S3C_DEV_RTC
1471static struct resource s3c_rtc_resource[] = {
1472 [0] = {
1473 .start = S3C_PA_RTC,
1474 .end = S3C_PA_RTC + 0xff,
1475 .flags = IORESOURCE_MEM,
1476 },
1477 [1] = {
1478 .start = IRQ_RTC_ALARM,
1479 .end = IRQ_RTC_ALARM,
1480 .flags = IORESOURCE_IRQ,
1481 },
1482 [2] = {
1483 .start = IRQ_RTC_TIC,
1484 .end = IRQ_RTC_TIC,
1485 .flags = IORESOURCE_IRQ
1486 }
1487};
1488
1489struct platform_device s3c_device_rtc = {
1490 .name = "s3c64xx-rtc",
1491 .id = -1,
1492 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
1493 .resource = s3c_rtc_resource,
1494};
1495#endif /* CONFIG_S3C_DEV_RTC */
1496
642/* SDI */ 1497/* SDI */
643 1498
644#ifdef CONFIG_PLAT_S3C24XX 1499#ifdef CONFIG_PLAT_S3C24XX
@@ -753,6 +1608,43 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_
753} 1608}
754#endif /* CONFIG_PLAT_S3C24XX */ 1609#endif /* CONFIG_PLAT_S3C24XX */
755 1610
1611#ifdef CONFIG_SAMSUNG_DEV_TS
1612static struct resource s3c_ts_resource[] = {
1613 [0] = {
1614 .start = SAMSUNG_PA_ADC,
1615 .end = SAMSUNG_PA_ADC + SZ_256 - 1,
1616 .flags = IORESOURCE_MEM,
1617 },
1618 [1] = {
1619 .start = IRQ_TC,
1620 .end = IRQ_TC,
1621 .flags = IORESOURCE_IRQ,
1622 },
1623};
1624
1625static struct s3c2410_ts_mach_info default_ts_data __initdata = {
1626 .delay = 10000,
1627 .presc = 49,
1628 .oversampling_shift = 2,
1629};
1630
1631struct platform_device s3c_device_ts = {
1632 .name = "s3c64xx-ts",
1633 .id = -1,
1634 .num_resources = ARRAY_SIZE(s3c_ts_resource),
1635 .resource = s3c_ts_resource,
1636};
1637
1638void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
1639{
1640 if (!pd)
1641 pd = &default_ts_data;
1642
1643 s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
1644 &s3c_device_ts);
1645}
1646#endif /* CONFIG_SAMSUNG_DEV_TS */
1647
756/* TV */ 1648/* TV */
757 1649
758#ifdef CONFIG_S5P_DEV_TV 1650#ifdef CONFIG_S5P_DEV_TV
@@ -830,6 +1722,49 @@ struct platform_device s5p_device_mixer = {
830}; 1722};
831#endif /* CONFIG_S5P_DEV_TV */ 1723#endif /* CONFIG_S5P_DEV_TV */
832 1724
1725/* USB */
1726
1727#ifdef CONFIG_S3C_DEV_USB_HOST
1728static struct resource s3c_usb_resource[] = {
1729 [0] = {
1730 .start = S3C_PA_USBHOST,
1731 .end = S3C_PA_USBHOST + 0x100 - 1,
1732 .flags = IORESOURCE_MEM,
1733 },
1734 [1] = {
1735 .start = IRQ_USBH,
1736 .end = IRQ_USBH,
1737 .flags = IORESOURCE_IRQ,
1738 }
1739};
1740
1741struct platform_device s3c_device_ohci = {
1742 .name = "s3c2410-ohci",
1743 .id = -1,
1744 .num_resources = ARRAY_SIZE(s3c_usb_resource),
1745 .resource = s3c_usb_resource,
1746 .dev = {
1747 .dma_mask = &samsung_device_dma_mask,
1748 .coherent_dma_mask = DMA_BIT_MASK(32),
1749 }
1750};
1751
1752/*
1753 * s3c_ohci_set_platdata - initialise OHCI device platform data
1754 * @info: The platform data.
1755 *
1756 * This call copies the @info passed in and sets the device .platform_data
1757 * field to that copy. The @info is copied so that the original can be marked
1758 * __initdata.
1759 */
1760
1761void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
1762{
1763 s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
1764 &s3c_device_ohci);
1765}
1766#endif /* CONFIG_S3C_DEV_USB_HOST */
1767
833/* USB Device (Gadget) */ 1768/* USB Device (Gadget) */
834 1769
835#ifdef CONFIG_PLAT_S3C24XX 1770#ifdef CONFIG_PLAT_S3C24XX
@@ -900,6 +1835,34 @@ void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
900} 1835}
901#endif /* CONFIG_S5P_DEV_USB_EHCI */ 1836#endif /* CONFIG_S5P_DEV_USB_EHCI */
902 1837
1838/* USB HSOTG */
1839
1840#ifdef CONFIG_S3C_DEV_USB_HSOTG
1841static struct resource s3c_usb_hsotg_resources[] = {
1842 [0] = {
1843 .start = S3C_PA_USB_HSOTG,
1844 .end = S3C_PA_USB_HSOTG + 0x10000 - 1,
1845 .flags = IORESOURCE_MEM,
1846 },
1847 [1] = {
1848 .start = IRQ_OTG,
1849 .end = IRQ_OTG,
1850 .flags = IORESOURCE_IRQ,
1851 },
1852};
1853
1854struct platform_device s3c_device_usb_hsotg = {
1855 .name = "s3c-hsotg",
1856 .id = -1,
1857 .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources),
1858 .resource = s3c_usb_hsotg_resources,
1859 .dev = {
1860 .dma_mask = &samsung_device_dma_mask,
1861 .coherent_dma_mask = DMA_BIT_MASK(32),
1862 },
1863};
1864#endif /* CONFIG_S3C_DEV_USB_HSOTG */
1865
903/* USB High Spped 2.0 Device (Gadget) */ 1866/* USB High Spped 2.0 Device (Gadget) */
904 1867
905#ifdef CONFIG_PLAT_S3C24XX 1868#ifdef CONFIG_PLAT_S3C24XX
@@ -932,3 +1895,27 @@ void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
932 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc); 1895 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
933} 1896}
934#endif /* CONFIG_PLAT_S3C24XX */ 1897#endif /* CONFIG_PLAT_S3C24XX */
1898
1899/* WDT */
1900
1901#ifdef CONFIG_S3C_DEV_WDT
1902static struct resource s3c_wdt_resource[] = {
1903 [0] = {
1904 .start = S3C_PA_WDT,
1905 .end = S3C_PA_WDT + SZ_1K,
1906 .flags = IORESOURCE_MEM,
1907 },
1908 [1] = {
1909 .start = IRQ_WDT,
1910 .end = IRQ_WDT,
1911 .flags = IORESOURCE_IRQ,
1912 }
1913};
1914
1915struct platform_device s3c_device_wdt = {
1916 .name = "s3c2410-wdt",
1917 .id = -1,
1918 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
1919 .resource = s3c_wdt_resource,
1920};
1921#endif /* CONFIG_S3C_DEV_WDT */