Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
[pandora-kernel.git] / arch / arm / mach-pxa / vpac270.c
index b2bef61..9884fa9 100644 (file)
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
+#include <linux/mtd/onenand.h>
+#include <linux/dm9000.h>
+#include <linux/ucb1400.h>
+#include <linux/ata_platform.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
 #include <mach/pxa27x.h>
+#include <mach/audio.h>
 #include <mach/vpac270.h>
 #include <mach/mmc.h>
 #include <mach/pxafb.h>
@@ -33,6 +38,8 @@
 #include <mach/pxa27x-udc.h>
 #include <mach/udc.h>
 
+#include <plat/i2c.h>
+
 #include "generic.h"
 #include "devices.h"
 
@@ -117,13 +124,33 @@ static unsigned long vpac270_pin_config[] __initdata = {
 
        /* UDC */
        GPIO41_GPIO,
+
+       /* Ethernet */
+       GPIO114_GPIO,   /* IRQ */
+
+       /* AC97 */
+       GPIO28_AC97_BITCLK,
+       GPIO29_AC97_SDATA_IN_0,
+       GPIO30_AC97_SDATA_OUT,
+       GPIO31_AC97_SYNC,
+       GPIO95_AC97_nRESET,
+       GPIO98_AC97_SYSCLK,
+       GPIO113_GPIO,   /* TS IRQ */
+
+       /* I2C */
+       GPIO117_I2C_SCL,
+       GPIO118_I2C_SDA,
+
+       /* IDE */
+       GPIO36_GPIO,    /* IDE IRQ */
+       GPIO80_DREQ_1,
 };
 
 /******************************************************************************
  * NOR Flash
  ******************************************************************************/
 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
-static struct mtd_partition vpac270_partitions[] = {
+static struct mtd_partition vpac270_nor_partitions[] = {
        {
                .name           = "Flash",
                .offset         = 0x00000000,
@@ -134,8 +161,8 @@ static struct mtd_partition vpac270_partitions[] = {
 static struct physmap_flash_data vpac270_flash_data[] = {
        {
                .width          = 2,    /* bankwidth in bytes */
-               .parts          = vpac270_partitions,
-               .nr_parts       = ARRAY_SIZE(vpac270_partitions)
+               .parts          = vpac270_nor_partitions,
+               .nr_parts       = ARRAY_SIZE(vpac270_nor_partitions)
        }
 };
 
@@ -162,6 +189,49 @@ static void __init vpac270_nor_init(void)
 static inline void vpac270_nor_init(void) {}
 #endif
 
+/******************************************************************************
+ * OneNAND Flash
+ ******************************************************************************/
+#if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
+static struct mtd_partition vpac270_onenand_partitions[] = {
+       {
+               .name           = "Flash",
+               .offset         = 0x00000000,
+               .size           = MTDPART_SIZ_FULL,
+       }
+};
+
+static struct onenand_platform_data vpac270_onenand_info = {
+       .parts          = vpac270_onenand_partitions,
+       .nr_parts       = ARRAY_SIZE(vpac270_onenand_partitions),
+};
+
+static struct resource vpac270_onenand_resources[] = {
+       [0] = {
+               .start  = PXA_CS0_PHYS,
+               .end    = PXA_CS0_PHYS + SZ_1M,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device vpac270_onenand = {
+       .name           = "onenand-flash",
+       .id             = -1,
+       .resource       = vpac270_onenand_resources,
+       .num_resources  = ARRAY_SIZE(vpac270_onenand_resources),
+       .dev            = {
+               .platform_data  = &vpac270_onenand_info,
+       },
+};
+
+static void __init vpac270_onenand_init(void)
+{
+       platform_device_register(&vpac270_onenand);
+}
+#else
+static void __init vpac270_onenand_init(void) {}
+#endif
+
 /******************************************************************************
  * SD/MMC card controller
  ******************************************************************************/
@@ -170,7 +240,7 @@ static struct pxamci_platform_data vpac270_mci_platform_data = {
        .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
        .gpio_card_detect       = GPIO53_VPAC270_SD_DETECT_N,
        .gpio_card_ro           = GPIO52_VPAC270_SD_READONLY,
-       .detect_delay           = 20,
+       .detect_delay_ms        = 200,
 };
 
 static void __init vpac270_mmc_init(void)
@@ -289,9 +359,9 @@ static struct platform_device vpac270_gpio_vbus = {
 static void vpac270_udc_command(int cmd)
 {
        if (cmd == PXA2XX_UDC_CMD_CONNECT)
-               UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+               UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
        else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
-               UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
+               UP2OCR = UP2OCR_HXOE;
 }
 
 static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
@@ -308,6 +378,99 @@ static void __init vpac270_udc_init(void)
 static inline void vpac270_udc_init(void) {}
 #endif
 
+/******************************************************************************
+ * Ethernet
+ ******************************************************************************/
+#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
+static struct resource vpac270_dm9000_resources[] = {
+       [0] = {
+               .start  = PXA_CS2_PHYS + 0x300,
+               .end    = PXA_CS2_PHYS + 0x303,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = PXA_CS2_PHYS + 0x304,
+               .end    = PXA_CS2_PHYS + 0x343,
+               .flags  = IORESOURCE_MEM,
+       },
+       [2] = {
+               .start  = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
+               .end    = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+       },
+};
+
+static struct dm9000_plat_data vpac270_dm9000_platdata = {
+       .flags          = DM9000_PLATF_32BITONLY,
+};
+
+static struct platform_device vpac270_dm9000_device = {
+       .name           = "dm9000",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(vpac270_dm9000_resources),
+       .resource       = vpac270_dm9000_resources,
+       .dev            = {
+               .platform_data = &vpac270_dm9000_platdata,
+       }
+};
+
+static void __init vpac270_eth_init(void)
+{
+       platform_device_register(&vpac270_dm9000_device);
+}
+#else
+static inline void vpac270_eth_init(void) {}
+#endif
+
+/******************************************************************************
+ * Audio and Touchscreen
+ ******************************************************************************/
+#if    defined(CONFIG_TOUCHSCREEN_UCB1400) || \
+       defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
+       .reset_gpio     = 95,
+};
+
+static struct ucb1400_pdata vpac270_ucb1400_pdata = {
+       .irq            = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
+};
+
+static struct platform_device vpac270_ucb1400_device = {
+       .name           = "ucb1400_core",
+       .id             = -1,
+       .dev            = {
+               .platform_data = &vpac270_ucb1400_pdata,
+       },
+};
+
+static void __init vpac270_ts_init(void)
+{
+       pxa_set_ac97_info(&vpac270_ac97_pdata);
+       platform_device_register(&vpac270_ucb1400_device);
+}
+#else
+static inline void vpac270_ts_init(void) {}
+#endif
+
+/******************************************************************************
+ * RTC
+ ******************************************************************************/
+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
+static struct i2c_board_info __initdata vpac270_i2c_devs[] = {
+       {
+               I2C_BOARD_INFO("ds1339", 0x68),
+       },
+};
+
+static void __init vpac270_rtc_init(void)
+{
+       pxa_set_i2c_info(NULL);
+       i2c_register_board_info(0, ARRAY_AND_SIZE(vpac270_i2c_devs));
+}
+#else
+static inline void vpac270_rtc_init(void) {}
+#endif
+
 /******************************************************************************
  * Framebuffer
  ******************************************************************************/
@@ -372,6 +535,50 @@ err:
 static inline void vpac270_lcd_init(void) {}
 #endif
 
+/******************************************************************************
+ * PATA IDE
+ ******************************************************************************/
+#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
+static struct pata_platform_info vpac270_pata_pdata = {
+       .ioport_shift   = 1,
+       .irq_flags      = IRQF_TRIGGER_RISING,
+};
+
+static struct resource vpac270_ide_resources[] = {
+       [0] = { /* I/O Base address */
+              .start   = PXA_CS3_PHYS + 0x120,
+              .end     = PXA_CS3_PHYS + 0x13f,
+              .flags   = IORESOURCE_MEM
+       },
+       [1] = { /* CTL Base address */
+              .start   = PXA_CS3_PHYS + 0x15c,
+              .end     = PXA_CS3_PHYS + 0x15f,
+              .flags   = IORESOURCE_MEM
+       },
+       [2] = { /* IDE IRQ pin */
+              .start   = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
+              .end     = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
+              .flags   = IORESOURCE_IRQ
+       }
+};
+
+static struct platform_device vpac270_ide_device = {
+       .name           = "pata_platform",
+       .num_resources  = ARRAY_SIZE(vpac270_ide_resources),
+       .resource       = vpac270_ide_resources,
+       .dev            = {
+               .platform_data  = &vpac270_pata_pdata,
+       }
+};
+
+static void __init vpac270_ide_init(void)
+{
+       platform_device_register(&vpac270_ide_device);
+}
+#else
+static inline void vpac270_ide_init(void) {}
+#endif
+
 /******************************************************************************
  * Machine init
  ******************************************************************************/
@@ -386,10 +593,15 @@ static void __init vpac270_init(void)
        vpac270_lcd_init();
        vpac270_mmc_init();
        vpac270_nor_init();
+       vpac270_onenand_init();
        vpac270_leds_init();
        vpac270_keys_init();
        vpac270_uhc_init();
        vpac270_udc_init();
+       vpac270_eth_init();
+       vpac270_ts_init();
+       vpac270_rtc_init();
+       vpac270_ide_init();
 }
 
 MACHINE_START(VPAC270, "Voipac PXA270")