]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/arm/plat-s3c24xx/devs.c
ARM: Merge for-2635/samsung-hwmon
[linux-2.6.git] / arch / arm / plat-s3c24xx / devs.c
index e546e933b3f7648204b9715e88066df1b1b93ffb..cd5b41d0b5a406122a76e382dd525d58cd25ac3f 100644 (file)
 #include <linux/init.h>
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/string.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
-#include <asm/arch/fb.h>
-#include <asm/hardware.h>
-#include <asm/io.h>
+#include <mach/fb.h>
+#include <mach/hardware.h>
+#include <mach/dma.h>
+#include <mach/irqs.h>
 #include <asm/irq.h>
 
-#include <asm/plat-s3c/regs-serial.h>
-#include <asm/plat-s3c24xx/udc.h>
+#include <plat/regs-serial.h>
+#include <plat/udc.h>
+#include <plat/mci.h>
 
-#include <asm/plat-s3c24xx/devs.h>
-#include <asm/plat-s3c24xx/cpu.h>
-#include <asm/plat-s3c24xx/regs-spi.h>
+#include <plat/devs.h>
+#include <plat/cpu.h>
+#include <plat/regs-spi.h>
+
+#include <mach/ts.h>
 
 /* Serial port registrations */
 
@@ -76,6 +83,19 @@ static struct resource s3c2410_uart2_resource[] = {
        }
 };
 
+static struct resource s3c2410_uart3_resource[] = {
+       [0] = {
+               .start = S3C2443_PA_UART3,
+               .end   = S3C2443_PA_UART3 + 0x3fff,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_S3CUART_RX3,
+               .end   = IRQ_S3CUART_ERR3,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
        [0] = {
                .resources      = s3c2410_uart0_resource,
@@ -89,61 +109,12 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
                .resources      = s3c2410_uart2_resource,
                .nr_resources   = ARRAY_SIZE(s3c2410_uart2_resource),
        },
-};
-
-/* yart devices */
-
-static struct platform_device s3c24xx_uart_device0 = {
-       .id             = 0,
-};
-
-static struct platform_device s3c24xx_uart_device1 = {
-       .id             = 1,
-};
-
-static struct platform_device s3c24xx_uart_device2 = {
-       .id             = 2,
-};
-
-struct platform_device *s3c24xx_uart_src[3] = {
-       &s3c24xx_uart_device0,
-       &s3c24xx_uart_device1,
-       &s3c24xx_uart_device2,
-};
-
-struct platform_device *s3c24xx_uart_devs[3] = {
-};
-
-/* USB Host Controller */
-
-static struct resource s3c_usb_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_USBHOST,
-               .end   = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
-               .flags = IORESOURCE_MEM,
+       [3] = {
+               .resources      = s3c2410_uart3_resource,
+               .nr_resources   = ARRAY_SIZE(s3c2410_uart3_resource),
        },
-       [1] = {
-               .start = IRQ_USBH,
-               .end   = IRQ_USBH,
-               .flags = IORESOURCE_IRQ,
-       }
 };
 
-static u64 s3c_device_usb_dmamask = 0xffffffffUL;
-
-struct platform_device s3c_device_usb = {
-       .name             = "s3c2410-ohci",
-       .id               = -1,
-       .num_resources    = ARRAY_SIZE(s3c_usb_resource),
-       .resource         = s3c_usb_resource,
-       .dev              = {
-               .dma_mask = &s3c_device_usb_dmamask,
-               .coherent_dma_mask = 0xffffffffUL
-       }
-};
-
-EXPORT_SYMBOL(s3c_device_usb);
-
 /* LCD Controller */
 
 static struct resource s3c_lcd_resource[] = {
@@ -179,33 +150,52 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
 {
        struct s3c2410fb_mach_info *npd;
 
-       npd = kmalloc(sizeof(*npd), GFP_KERNEL);
+       npd = kmemdup(pd, sizeof(*npd), GFP_KERNEL);
        if (npd) {
-               memcpy(npd, pd, sizeof(*npd));
                s3c_device_lcd.dev.platform_data = npd;
+               npd->displays = kmemdup(pd->displays,
+                       sizeof(struct s3c2410fb_display) * npd->num_displays,
+                       GFP_KERNEL);
+               if (!npd->displays)
+                       printk(KERN_ERR "no memory for LCD display data\n");
        } else {
                printk(KERN_ERR "no memory for LCD platform data\n");
        }
 }
 
-/* NAND Controller */
+/* Touchscreen */
 
-static struct resource s3c_nand_resource[] = {
+static struct resource s3c_ts_resource[] = {
        [0] = {
-               .start = S3C2410_PA_NAND,
-               .end   = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
+               .start = S3C24XX_PA_ADC,
+               .end   = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
                .flags = IORESOURCE_MEM,
-       }
+       },
+       [1] = {
+               .start = IRQ_TC,
+               .end   = IRQ_TC,
+               .flags = IORESOURCE_IRQ,
+       },
+
 };
 
-struct platform_device s3c_device_nand = {
-       .name             = "s3c2410-nand",
+struct platform_device s3c_device_ts = {
+       .name             = "s3c2410-ts",
        .id               = -1,
-       .num_resources    = ARRAY_SIZE(s3c_nand_resource),
-       .resource         = s3c_nand_resource,
+       .dev.parent     = &s3c_device_adc.dev,
+       .num_resources    = ARRAY_SIZE(s3c_ts_resource),
+       .resource         = s3c_ts_resource,
 };
+EXPORT_SYMBOL(s3c_device_ts);
+
+static struct s3c2410_ts_mach_info s3c2410ts_info;
 
-EXPORT_SYMBOL(s3c_device_nand);
+void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
+{
+       memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info));
+       s3c_device_ts.dev.platform_data = &s3c2410ts_info;
+}
+EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
 
 /* USB Device (Gadget)*/
 
@@ -271,31 +261,6 @@ struct platform_device s3c_device_wdt = {
 
 EXPORT_SYMBOL(s3c_device_wdt);
 
-/* I2C */
-
-static struct resource s3c_i2c_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_IIC,
-               .end   = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_IIC,
-               .end   = IRQ_IIC,
-               .flags = IORESOURCE_IRQ,
-       }
-
-};
-
-struct platform_device s3c_device_i2c = {
-       .name             = "s3c2410-i2c",
-       .id               = -1,
-       .num_resources    = ARRAY_SIZE(s3c_i2c_resource),
-       .resource         = s3c_i2c_resource,
-};
-
-EXPORT_SYMBOL(s3c_device_i2c);
-
 /* IIS */
 
 static struct resource s3c_iis_resource[] = {
@@ -372,7 +337,7 @@ static struct resource s3c_adc_resource[] = {
 };
 
 struct platform_device s3c_device_adc = {
-       .name             = "s3c2410-adc",
+       .name             = "s3c24xx-adc",
        .id               = -1,
        .num_resources    = ARRAY_SIZE(s3c_adc_resource),
        .resource         = s3c_adc_resource,
@@ -382,8 +347,8 @@ struct platform_device s3c_device_adc = {
 
 static struct resource s3c_sdi_resource[] = {
        [0] = {
-               .start = S3C2410_PA_SDI,
-               .end   = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
+               .start = S3C24XX_PA_SDI,
+               .end   = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
                .flags = IORESOURCE_MEM,
        },
        [1] = {
@@ -403,34 +368,16 @@ struct platform_device s3c_device_sdi = {
 
 EXPORT_SYMBOL(s3c_device_sdi);
 
-/* High-speed MMC/SD */
-
-static struct resource s3c_hsmmc_resource[] = {
-       [0] = {
-               .start = S3C2443_PA_HSMMC,
-               .end   = S3C2443_PA_HSMMC + S3C2443_SZ_HSMMC - 1,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_S3C2443_HSMMC,
-               .end   = IRQ_S3C2443_HSMMC,
-               .flags = IORESOURCE_IRQ,
-       }
-};
-
-static u64 s3c_device_hsmmc_dmamask = 0xffffffffUL;
+void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
+{
+       struct s3c24xx_mci_pdata *npd;
 
-struct platform_device s3c_device_hsmmc = {
-       .name             = "s3c-sdhci",
-       .id               = -1,
-       .num_resources    = ARRAY_SIZE(s3c_hsmmc_resource),
-       .resource         = s3c_hsmmc_resource,
-       .dev              = {
-               .dma_mask = &s3c_device_hsmmc_dmamask,
-               .coherent_dma_mask = 0xffffffffUL
-       }
-};
+       npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL);
+       if (!npd)
+               printk(KERN_ERR "%s: no memory to copy pdata", __func__);
 
+       s3c_device_sdi.dev.platform_data = npd;
+}
 
 
 /* SPI (0) */
@@ -495,106 +442,6 @@ struct platform_device s3c_device_spi1 = {
 
 EXPORT_SYMBOL(s3c_device_spi1);
 
-/* pwm timer blocks */
-
-static struct resource s3c_timer0_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_TIMER + 0x0C,
-               .end   = S3C24XX_PA_TIMER + 0x0C + 0xB,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_TIMER0,
-               .end   = IRQ_TIMER0,
-               .flags = IORESOURCE_IRQ,
-       }
-
-};
-
-struct platform_device s3c_device_timer0 = {
-       .name             = "s3c2410-timer",
-       .id               = 0,
-       .num_resources    = ARRAY_SIZE(s3c_timer0_resource),
-       .resource         = s3c_timer0_resource,
-};
-
-EXPORT_SYMBOL(s3c_device_timer0);
-
-/* timer 1 */
-
-static struct resource s3c_timer1_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_TIMER + 0x18,
-               .end   = S3C24XX_PA_TIMER + 0x23,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_TIMER1,
-               .end   = IRQ_TIMER1,
-               .flags = IORESOURCE_IRQ,
-       }
-
-};
-
-struct platform_device s3c_device_timer1 = {
-       .name             = "s3c2410-timer",
-       .id               = 1,
-       .num_resources    = ARRAY_SIZE(s3c_timer1_resource),
-       .resource         = s3c_timer1_resource,
-};
-
-EXPORT_SYMBOL(s3c_device_timer1);
-
-/* timer 2 */
-
-static struct resource s3c_timer2_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_TIMER + 0x24,
-               .end   = S3C24XX_PA_TIMER + 0x2F,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_TIMER2,
-               .end   = IRQ_TIMER2,
-               .flags = IORESOURCE_IRQ,
-       }
-
-};
-
-struct platform_device s3c_device_timer2 = {
-       .name             = "s3c2410-timer",
-       .id               = 2,
-       .num_resources    = ARRAY_SIZE(s3c_timer2_resource),
-       .resource         = s3c_timer2_resource,
-};
-
-EXPORT_SYMBOL(s3c_device_timer2);
-
-/* timer 3 */
-
-static struct resource s3c_timer3_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_TIMER + 0x30,
-               .end   = S3C24XX_PA_TIMER + 0x3B,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_TIMER3,
-               .end   = IRQ_TIMER3,
-               .flags = IORESOURCE_IRQ,
-       }
-
-};
-
-struct platform_device s3c_device_timer3 = {
-       .name             = "s3c2410-timer",
-       .id               = 3,
-       .num_resources    = ARRAY_SIZE(s3c_timer3_resource),
-       .resource         = s3c_timer3_resource,
-};
-
-EXPORT_SYMBOL(s3c_device_timer3);
-
 #ifdef CONFIG_CPU_S3C2440
 
 /* Camif Controller */
@@ -628,4 +475,52 @@ struct platform_device s3c_device_camif = {
 
 EXPORT_SYMBOL(s3c_device_camif);
 
+/* AC97 */
+
+static struct resource s3c_ac97_resource[] = {
+       [0] = {
+               .start = S3C2440_PA_AC97,
+               .end   = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_S3C244x_AC97,
+               .end   = IRQ_S3C244x_AC97,
+               .flags = IORESOURCE_IRQ,
+       },
+       [2] = {
+               .name  = "PCM out",
+               .start = DMACH_PCM_OUT,
+               .end   = DMACH_PCM_OUT,
+               .flags = IORESOURCE_DMA,
+       },
+       [3] = {
+               .name  = "PCM in",
+               .start = DMACH_PCM_IN,
+               .end   = DMACH_PCM_IN,
+               .flags = IORESOURCE_DMA,
+       },
+       [4] = {
+               .name  = "Mic in",
+               .start = DMACH_MIC_IN,
+               .end   = DMACH_MIC_IN,
+               .flags = IORESOURCE_DMA,
+       },
+};
+
+static u64 s3c_device_ac97_dmamask = 0xffffffffUL;
+
+struct platform_device s3c_device_ac97 = {
+       .name             = "s3c-ac97",
+       .id               = -1,
+       .num_resources    = ARRAY_SIZE(s3c_ac97_resource),
+       .resource         = s3c_ac97_resource,
+       .dev              = {
+               .dma_mask = &s3c_device_ac97_dmamask,
+               .coherent_dma_mask = 0xffffffffUL
+       }
+};
+
+EXPORT_SYMBOL(s3c_device_ac97);
+
 #endif // CONFIG_CPU_S32440