Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
[pandora-kernel.git] / arch / arm / mach-pxa / vpac270.c
index fa428ca..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>
@@ -36,6 +38,8 @@
 #include <mach/pxa27x-udc.h>
 #include <mach/udc.h>
 
+#include <plat/i2c.h>
+
 #include "generic.h"
 #include "devices.h"
 
@@ -132,13 +136,21 @@ static unsigned long vpac270_pin_config[] __initdata = {
        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,
@@ -149,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)
        }
 };
 
@@ -177,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
  ******************************************************************************/
@@ -185,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)
@@ -304,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 = {
@@ -377,7 +432,7 @@ static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
 };
 
 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
-       .irq            = IRQ_GPIO(113),
+       .irq            = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
 };
 
 static struct platform_device vpac270_ucb1400_device = {
@@ -397,6 +452,25 @@ static void __init vpac270_ts_init(void)
 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
  ******************************************************************************/
@@ -461,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
  ******************************************************************************/
@@ -475,12 +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")