Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[pandora-kernel.git] / arch / arm / mach-pxa / devices.c
index d6c05b6..84489dc 100644 (file)
 #include <asm/arch/mmc.h>
 #include <asm/arch/irda.h>
 #include <asm/arch/i2c.h>
+#include <asm/arch/mfp-pxa27x.h>
 #include <asm/arch/ohci.h>
 #include <asm/arch/pxa27x_keypad.h>
+#include <asm/arch/pxa2xx_spi.h>
 #include <asm/arch/camera.h>
+#include <asm/arch/audio.h>
+#include <asm/arch/pxa3xx_nand.h>
 
 #include "devices.h"
+#include "generic.h"
 
 void __init pxa_register_device(struct platform_device *dev, void *data)
 {
@@ -91,8 +96,19 @@ static struct resource pxa2xx_udc_resources[] = {
 
 static u64 udc_dma_mask = ~(u32)0;
 
-struct platform_device pxa_device_udc = {
-       .name           = "pxa2xx-udc",
+struct platform_device pxa25x_device_udc = {
+       .name           = "pxa25x-udc",
+       .id             = -1,
+       .resource       = pxa2xx_udc_resources,
+       .num_resources  = ARRAY_SIZE(pxa2xx_udc_resources),
+       .dev            =  {
+               .platform_data  = &pxa_udc_info,
+               .dma_mask       = &udc_dma_mask,
+       }
+};
+
+struct platform_device pxa27x_device_udc = {
+       .name           = "pxa27x-udc",
        .id             = -1,
        .resource       = pxa2xx_udc_resources,
        .num_resources  = ARRAY_SIZE(pxa2xx_udc_resources),
@@ -233,8 +249,15 @@ struct platform_device pxa_device_i2c = {
        .num_resources  = ARRAY_SIZE(pxai2c_resources),
 };
 
+static unsigned long pxa27x_i2c_mfp_cfg[] = {
+       GPIO117_I2C_SCL,
+       GPIO118_I2C_SDA,
+};
+
 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
 {
+       if (cpu_is_pxa27x())
+               pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
        pxa_register_device(&pxa_device_i2c, info);
 }
 
@@ -278,8 +301,69 @@ struct platform_device pxa_device_rtc = {
        .id             = -1,
 };
 
+static struct resource pxa_ac97_resources[] = {
+       [0] = {
+               .start  = 0x40500000,
+               .end    = 0x40500000 + 0xfff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_AC97,
+               .end    = IRQ_AC97,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static u64 pxa_ac97_dmamask = 0xffffffffUL;
+
+struct platform_device pxa_device_ac97 = {
+       .name           = "pxa2xx-ac97",
+       .id             = -1,
+       .dev            = {
+               .dma_mask = &pxa_ac97_dmamask,
+               .coherent_dma_mask = 0xffffffff,
+       },
+       .num_resources  = ARRAY_SIZE(pxa_ac97_resources),
+       .resource       = pxa_ac97_resources,
+};
+
+void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
+{
+       pxa_register_device(&pxa_device_ac97, ops);
+}
+
 #ifdef CONFIG_PXA25x
 
+static struct resource pxa25x_resource_pwm0[] = {
+       [0] = {
+               .start  = 0x40b00000,
+               .end    = 0x40b0000f,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+struct platform_device pxa25x_device_pwm0 = {
+       .name           = "pxa25x-pwm",
+       .id             = 0,
+       .resource       = pxa25x_resource_pwm0,
+       .num_resources  = ARRAY_SIZE(pxa25x_resource_pwm0),
+};
+
+static struct resource pxa25x_resource_pwm1[] = {
+       [0] = {
+               .start  = 0x40c00000,
+               .end    = 0x40c0000f,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+struct platform_device pxa25x_device_pwm1 = {
+       .name           = "pxa25x-pwm",
+       .id             = 1,
+       .resource       = pxa25x_resource_pwm1,
+       .num_resources  = ARRAY_SIZE(pxa25x_resource_pwm1),
+};
+
 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
 
 static struct resource pxa25x_resource_ssp[] = {
@@ -568,6 +652,36 @@ struct platform_device pxa27x_device_ssp3 = {
        .num_resources  = ARRAY_SIZE(pxa27x_resource_ssp3),
 };
 
+static struct resource pxa27x_resource_pwm0[] = {
+       [0] = {
+               .start  = 0x40b00000,
+               .end    = 0x40b0001f,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+struct platform_device pxa27x_device_pwm0 = {
+       .name           = "pxa27x-pwm",
+       .id             = 0,
+       .resource       = pxa27x_resource_pwm0,
+       .num_resources  = ARRAY_SIZE(pxa27x_resource_pwm0),
+};
+
+static struct resource pxa27x_resource_pwm1[] = {
+       [0] = {
+               .start  = 0x40c00000,
+               .end    = 0x40c0001f,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+struct platform_device pxa27x_device_pwm1 = {
+       .name           = "pxa27x-pwm",
+       .id             = 1,
+       .resource       = pxa27x_resource_pwm1,
+       .num_resources  = ARRAY_SIZE(pxa27x_resource_pwm1),
+};
+
 static struct resource pxa27x_resource_camera[] = {
        [0] = {
                .start  = 0x50000000,
@@ -718,4 +832,63 @@ void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
        pxa_register_device(&pxa3xx_device_mci3, info);
 }
 
+static struct resource pxa3xx_resources_nand[] = {
+       [0] = {
+               .start  = 0x43100000,
+               .end    = 0x43100053,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_NAND,
+               .end    = IRQ_NAND,
+               .flags  = IORESOURCE_IRQ,
+       },
+       [2] = {
+               /* DRCMR for Data DMA */
+               .start  = 97,
+               .end    = 97,
+               .flags  = IORESOURCE_DMA,
+       },
+       [3] = {
+               /* DRCMR for Command DMA */
+               .start  = 99,
+               .end    = 99,
+               .flags  = IORESOURCE_DMA,
+       },
+};
+
+static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
+
+struct platform_device pxa3xx_device_nand = {
+       .name           = "pxa3xx-nand",
+       .id             = -1,
+       .dev            = {
+               .dma_mask = &pxa3xx_nand_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+       },
+       .num_resources  = ARRAY_SIZE(pxa3xx_resources_nand),
+       .resource       = pxa3xx_resources_nand,
+};
+
+void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info)
+{
+       pxa_register_device(&pxa3xx_device_nand, info);
+}
 #endif /* CONFIG_PXA3xx */
+
+/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
+ * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
+void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
+{
+       struct platform_device *pd;
+
+       pd = platform_device_alloc("pxa2xx-spi", id);
+       if (pd == NULL) {
+               printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
+                      id);
+               return;
+       }
+
+       pd->dev.platform_data = info;
+       platform_device_add(pd);
+}