]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/arm/mach-pxa/balloon3.c
ARM: pxa: encode IRQ number into .nr_irqs
[mv-sheeva.git] / arch / arm / mach-pxa / balloon3.c
index f3b5ace815e51488f8437f4fc08866e6478e12be..2b81e64beb42609ac67cf331e4c9e8b10b328436 100644 (file)
 #include <linux/fb.h>
 #include <linux/gpio.h>
 #include <linux/ioport.h>
+#include <linux/ucb1400.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/types.h>
+#include <linux/i2c/pcf857x.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/physmap.h>
+#include <linux/regulator/max1586.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include "generic.h"
 #include "devices.h"
 
+/******************************************************************************
+ * Pin configuration
+ ******************************************************************************/
+static unsigned long balloon3_pin_config[] __initdata = {
+       /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
+       GPIO42_BTUART_RXD,
+       GPIO43_BTUART_TXD,
+       GPIO44_BTUART_CTS,
+       GPIO45_BTUART_RTS,
+
+       /* Reset, configured as GPIO wakeup source */
+       GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
+
+       /* LEDs */
+       GPIO9_GPIO,     /* NAND activity LED */
+       GPIO10_GPIO,    /* Heartbeat LED */
+
+       /* AC97 */
+       GPIO28_AC97_BITCLK,
+       GPIO29_AC97_SDATA_IN_0,
+       GPIO30_AC97_SDATA_OUT,
+       GPIO31_AC97_SYNC,
+       GPIO113_AC97_nRESET,
+       GPIO95_GPIO,
+
+       /* MMC */
+       GPIO32_MMC_CLK,
+       GPIO92_MMC_DAT_0,
+       GPIO109_MMC_DAT_1,
+       GPIO110_MMC_DAT_2,
+       GPIO111_MMC_DAT_3,
+       GPIO112_MMC_CMD,
+
+       /* USB Host */
+       GPIO88_USBH1_PWR,
+       GPIO89_USBH1_PEN,
+
+       /* PC Card */
+       GPIO48_nPOE,
+       GPIO49_nPWE,
+       GPIO50_nPIOR,
+       GPIO51_nPIOW,
+       GPIO85_nPCE_1,
+       GPIO54_nPCE_2,
+       GPIO79_PSKTSEL,
+       GPIO55_nPREG,
+       GPIO56_nPWAIT,
+       GPIO57_nIOIS16,
+};
+
+/******************************************************************************
+ * Compatibility: Parameter parsing
+ ******************************************************************************/
 static unsigned long balloon3_irq_enabled;
 
 static unsigned long balloon3_features_present =
@@ -73,6 +131,321 @@ int __init parse_balloon3_features(char *arg)
 }
 early_param("balloon3_features", parse_balloon3_features);
 
+/******************************************************************************
+ * NOR Flash
+ ******************************************************************************/
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
+static struct mtd_partition balloon3_nor_partitions[] = {
+       {
+               .name           = "Flash",
+               .offset         = 0x00000000,
+               .size           = MTDPART_SIZ_FULL,
+       }
+};
+
+static struct physmap_flash_data balloon3_flash_data[] = {
+       {
+               .width          = 2,    /* bankwidth in bytes */
+               .parts          = balloon3_nor_partitions,
+               .nr_parts       = ARRAY_SIZE(balloon3_nor_partitions)
+       }
+};
+
+static struct resource balloon3_flash_resource = {
+       .start  = PXA_CS0_PHYS,
+       .end    = PXA_CS0_PHYS + SZ_64M - 1,
+       .flags  = IORESOURCE_MEM,
+};
+
+static struct platform_device balloon3_flash = {
+       .name           = "physmap-flash",
+       .id             = 0,
+       .resource       = &balloon3_flash_resource,
+       .num_resources  = 1,
+       .dev            = {
+               .platform_data = balloon3_flash_data,
+       },
+};
+static void __init balloon3_nor_init(void)
+{
+       platform_device_register(&balloon3_flash);
+}
+#else
+static inline void balloon3_nor_init(void) {}
+#endif
+
+/******************************************************************************
+ * Audio and Touchscreen
+ ******************************************************************************/
+#if    defined(CONFIG_TOUCHSCREEN_UCB1400) || \
+       defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct ucb1400_pdata vpac270_ucb1400_pdata = {
+       .irq            = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
+};
+
+
+static struct platform_device balloon3_ucb1400_device = {
+       .name           = "ucb1400_core",
+       .id             = -1,
+       .dev            = {
+               .platform_data = &vpac270_ucb1400_pdata,
+       },
+};
+
+static void __init balloon3_ts_init(void)
+{
+       if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
+               return;
+
+       pxa_set_ac97_info(NULL);
+       platform_device_register(&balloon3_ucb1400_device);
+}
+#else
+static inline void balloon3_ts_init(void) {}
+#endif
+
+/******************************************************************************
+ * Framebuffer
+ ******************************************************************************/
+#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
+static struct pxafb_mode_info balloon3_lcd_modes[] = {
+       {
+               .pixclock               = 38000,
+               .xres                   = 480,
+               .yres                   = 640,
+               .bpp                    = 16,
+               .hsync_len              = 8,
+               .left_margin            = 8,
+               .right_margin           = 8,
+               .vsync_len              = 2,
+               .upper_margin           = 4,
+               .lower_margin           = 5,
+               .sync                   = 0,
+       },
+};
+
+static struct pxafb_mach_info balloon3_lcd_screen = {
+       .modes                  = balloon3_lcd_modes,
+       .num_modes              = ARRAY_SIZE(balloon3_lcd_modes),
+       .lcd_conn               = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
+};
+
+static void balloon3_backlight_power(int on)
+{
+       gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
+}
+
+static void __init balloon3_lcd_init(void)
+{
+       int ret;
+
+       if (!balloon3_has(BALLOON3_FEATURE_TOPPOLY))
+               return;
+
+       ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
+       if (ret) {
+               pr_err("Requesting BKL-ON GPIO failed!\n");
+               goto err;
+       }
+
+       ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
+       if (ret) {
+               pr_err("Setting BKL-ON GPIO direction failed!\n");
+               goto err2;
+       }
+
+       balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power;
+       set_pxa_fb_info(&balloon3_lcd_screen);
+       return;
+
+err2:
+       gpio_free(BALLOON3_GPIO_RUN_BACKLIGHT);
+err:
+       return;
+}
+#else
+static inline void balloon3_lcd_init(void) {}
+#endif
+
+/******************************************************************************
+ * SD/MMC card controller
+ ******************************************************************************/
+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
+static struct pxamci_platform_data balloon3_mci_platform_data = {
+       .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
+       .gpio_card_detect       = -1,
+       .gpio_card_ro           = -1,
+       .gpio_power             = -1,
+       .detect_delay_ms        = 200,
+};
+
+static void __init balloon3_mmc_init(void)
+{
+       pxa_set_mci_info(&balloon3_mci_platform_data);
+}
+#else
+static inline void balloon3_mmc_init(void) {}
+#endif
+
+/******************************************************************************
+ * USB Gadget
+ ******************************************************************************/
+#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
+static void balloon3_udc_command(int cmd)
+{
+       if (cmd == PXA2XX_UDC_CMD_CONNECT)
+               UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
+       else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+               UP2OCR &= ~UP2OCR_DPPUE;
+}
+
+static int balloon3_udc_is_connected(void)
+{
+       return 1;
+}
+
+static struct pxa2xx_udc_mach_info balloon3_udc_info __initdata = {
+       .udc_command            = balloon3_udc_command,
+       .udc_is_connected       = balloon3_udc_is_connected,
+       .gpio_pullup            = -1,
+};
+
+static void __init balloon3_udc_init(void)
+{
+       pxa_set_udc_info(&balloon3_udc_info);
+       platform_device_register(&balloon3_gpio_vbus);
+}
+#else
+static inline void balloon3_udc_init(void) {}
+#endif
+
+/******************************************************************************
+ * IrDA
+ ******************************************************************************/
+#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
+static struct pxaficp_platform_data balloon3_ficp_platform_data = {
+       .transceiver_cap        = IR_FIRMODE | IR_SIRMODE | IR_OFF,
+};
+
+static void __init balloon3_irda_init(void)
+{
+       pxa_set_ficp_info(&balloon3_ficp_platform_data);
+}
+#else
+static inline void balloon3_irda_init(void) {}
+#endif
+
+/******************************************************************************
+ * USB Host
+ ******************************************************************************/
+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+static struct pxaohci_platform_data balloon3_ohci_info = {
+       .port_mode      = PMM_PERPORT_MODE,
+       .flags          = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
+};
+
+static void __init balloon3_uhc_init(void)
+{
+       if (!balloon3_has(BALLOON3_FEATURE_OHCI))
+               return;
+       pxa_set_ohci_info(&balloon3_ohci_info);
+}
+#else
+static inline void balloon3_uhc_init(void) {}
+#endif
+
+/******************************************************************************
+ * LEDs
+ ******************************************************************************/
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+struct gpio_led balloon3_gpio_leds[] = {
+       {
+               .name                   = "balloon3:green:idle",
+               .default_trigger        = "heartbeat",
+               .gpio                   = BALLOON3_GPIO_LED_IDLE,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:green:nand",
+               .default_trigger        = "nand-disk",
+               .gpio                   = BALLOON3_GPIO_LED_NAND,
+               .active_low             = 1,
+       },
+};
+
+static struct gpio_led_platform_data balloon3_gpio_led_info = {
+       .leds           = balloon3_gpio_leds,
+       .num_leds       = ARRAY_SIZE(balloon3_gpio_leds),
+};
+
+static struct platform_device balloon3_leds = {
+       .name   = "leds-gpio",
+       .id     = 0,
+       .dev    = {
+               .platform_data  = &balloon3_gpio_led_info,
+       }
+};
+
+struct gpio_led balloon3_pcf_gpio_leds[] = {
+       {
+               .name                   = "balloon3:green:led0",
+               .gpio                   = BALLOON3_PCF_GPIO_LED0,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:green:led1",
+               .gpio                   = BALLOON3_PCF_GPIO_LED1,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:orange:led2",
+               .gpio                   = BALLOON3_PCF_GPIO_LED2,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:orange:led3",
+               .gpio                   = BALLOON3_PCF_GPIO_LED3,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:orange:led4",
+               .gpio                   = BALLOON3_PCF_GPIO_LED4,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:orange:led5",
+               .gpio                   = BALLOON3_PCF_GPIO_LED5,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:red:led6",
+               .gpio                   = BALLOON3_PCF_GPIO_LED6,
+               .active_low             = 1,
+       }, {
+               .name                   = "balloon3:red:led7",
+               .gpio                   = BALLOON3_PCF_GPIO_LED7,
+               .active_low             = 1,
+       },
+};
+
+static struct gpio_led_platform_data balloon3_pcf_gpio_led_info = {
+       .leds           = balloon3_pcf_gpio_leds,
+       .num_leds       = ARRAY_SIZE(balloon3_pcf_gpio_leds),
+};
+
+static struct platform_device balloon3_pcf_leds = {
+       .name   = "leds-gpio",
+       .id     = 1,
+       .dev    = {
+               .platform_data  = &balloon3_pcf_gpio_led_info,
+       }
+};
+
+static void __init balloon3_leds_init(void)
+{
+       platform_device_register(&balloon3_leds);
+       platform_device_register(&balloon3_pcf_leds);
+}
+#else
+static inline void balloon3_leds_init(void) {}
+#endif
+
+/******************************************************************************
+ * FPGA IRQ
+ ******************************************************************************/
 static void balloon3_mask_irq(unsigned int irq)
 {
        int balloon3_irq = (irq - BALLOON3_IRQ(0));
@@ -98,7 +471,6 @@ static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
        unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
                                        balloon3_irq_enabled;
-
        do {
                /* clear useless edge notification */
                if (desc->chip->ack)
@@ -132,201 +504,259 @@ static void __init balloon3_init_irq(void)
                "enabled\n", __func__, BALLOON3_AUX_NIRQ);
 }
 
-static unsigned long balloon3_ac97_pin_config[] = {
-       GPIO28_AC97_BITCLK,
-       GPIO29_AC97_SDATA_IN_0,
-       GPIO30_AC97_SDATA_OUT,
-       GPIO31_AC97_SYNC,
-       GPIO113_AC97_nRESET,
-};
-
-static void balloon3_backlight_power(int on)
-{
-       pr_debug("%s: power is %s\n", __func__, on ? "on" : "off");
-       gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
-}
-
-static unsigned long balloon3_lcd_pin_config[] = {
-       /* LCD - 16bpp Active TFT */
-       GPIOxx_LCD_TFT_16BPP,
-
-       GPIO99_GPIO,            /* Backlight */
+/******************************************************************************
+ * GPIO expander
+ ******************************************************************************/
+#if defined(CONFIG_GPIO_PCF857X) || defined(CONFIG_GPIO_PCF857X_MODULE)
+static struct pcf857x_platform_data balloon3_pcf857x_pdata = {
+       .gpio_base      = BALLOON3_PCF_GPIO_BASE,
+       .n_latch        = 0,
+       .setup          = NULL,
+       .teardown       = NULL,
+       .context        = NULL,
 };
 
-static struct pxafb_mode_info balloon3_lcd_modes[] = {
+static struct i2c_board_info __initdata balloon3_i2c_devs[] = {
        {
-               .pixclock               = 38000,
-               .xres                   = 480,
-               .yres                   = 640,
-               .bpp                    = 16,
-               .hsync_len              = 8,
-               .left_margin            = 8,
-               .right_margin           = 8,
-               .vsync_len              = 2,
-               .upper_margin           = 4,
-               .lower_margin           = 5,
-               .sync                   = 0,
+               I2C_BOARD_INFO("pcf8574a", 0x38),
+               .platform_data  = &balloon3_pcf857x_pdata,
        },
 };
 
-static struct pxafb_mach_info balloon3_pxafb_info = {
-       .modes                  = balloon3_lcd_modes,
-       .num_modes              = ARRAY_SIZE(balloon3_lcd_modes),
-       .lcd_conn               = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
-       .pxafb_backlight_power  = balloon3_backlight_power,
-};
+static void __init balloon3_i2c_init(void)
+{
+       pxa_set_i2c_info(NULL);
+       i2c_register_board_info(0, ARRAY_AND_SIZE(balloon3_i2c_devs));
+}
+#else
+static inline void balloon3_i2c_init(void) {}
+#endif
+
+/******************************************************************************
+ * NAND
+ ******************************************************************************/
+#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
+static uint16_t balloon3_ctl =
+       BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
+       BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 |
+       BALLOON3_NAND_CONTROL_FLWP;
+
+static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
+{
+       struct nand_chip *this = mtd->priv;
 
-static unsigned long balloon3_mmc_pin_config[] = {
-       GPIO32_MMC_CLK,
-       GPIO92_MMC_DAT_0,
-       GPIO109_MMC_DAT_1,
-       GPIO110_MMC_DAT_2,
-       GPIO111_MMC_DAT_3,
-       GPIO112_MMC_CMD,
-};
+       if (ctrl & NAND_CTRL_CHANGE) {
+               if (ctrl & NAND_CLE)
+                       balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCLE;
+               else
+                       balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLCLE;
 
-static void balloon3_mci_setpower(struct device *dev, unsigned int vdd)
-{
-       struct pxamci_platform_data *p_d = dev->platform_data;
-
-       if ((1 << vdd) & p_d->ocr_mask) {
-               pr_debug("%s: on\n", __func__);
-               /* FIXME something to prod here? */
-       } else {
-               pr_debug("%s: off\n", __func__);
-               /* FIXME something to prod here? */
+               if (ctrl & NAND_ALE)
+                       balloon3_ctl |= BALLOON3_NAND_CONTROL_FLALE;
+               else
+                       balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLALE;
+
+               __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
        }
+
+       if (cmd != NAND_CMD_NONE)
+               writeb(cmd, this->IO_ADDR_W);
 }
 
-static struct pxamci_platform_data balloon3_mci_platform_data = {
-       .ocr_mask       = MMC_VDD_32_33|MMC_VDD_33_34,
-       .setpower       = balloon3_mci_setpower,
-};
+static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+       if (chip < 0 || chip > 3)
+               return;
 
-static int balloon3_udc_is_connected(void)
+       balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCE0 |
+                       BALLOON3_NAND_CONTROL_FLCE1 |
+                       BALLOON3_NAND_CONTROL_FLCE2 |
+                       BALLOON3_NAND_CONTROL_FLCE3;
+
+       /* Deassert correct nCE line */
+       balloon3_ctl &= ~(BALLOON3_NAND_CONTROL_FLCE0 << chip);
+
+       __raw_writew(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
+}
+
+static int balloon3_nand_probe(struct platform_device *pdev)
 {
-       pr_debug("%s: udc connected\n", __func__);
-       return 1;
+       void __iomem *temp_map;
+       uint16_t ver;
+       int ret;
+
+       __raw_writew(BALLOON3_NAND_CONTROL2_16BIT, BALLOON3_NAND_CONTROL2_REG);
+
+       ver = __raw_readw(BALLOON3_FPGA_VER);
+       if (ver > 0x0201)
+               pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. "
+                       "NAND support might be broken in this version!", ver);
+
+       /* Power up the NAND chips */
+       ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND");
+       if (ret)
+               goto err1;
+
+       ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1);
+       if (ret)
+               goto err2;
+
+       gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
+
+       /* Deassert all nCE lines and write protect line */
+       __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
+       return 0;
+
+err2:
+       gpio_free(BALLOON3_GPIO_RUN_NAND);
+err1:
+       return ret;
 }
 
-static void balloon3_udc_command(int cmd)
+static void balloon3_nand_remove(struct platform_device *pdev)
 {
-       switch (cmd) {
-       case PXA2XX_UDC_CMD_CONNECT:
-               UP2OCR |= (UP2OCR_DPPUE + UP2OCR_DPPUBE);
-               pr_debug("%s: connect\n", __func__);
-               break;
-       case PXA2XX_UDC_CMD_DISCONNECT:
-               UP2OCR &= ~UP2OCR_DPPUE;
-               pr_debug("%s: disconnect\n", __func__);
-               break;
-       }
+       /* Power down the NAND chips */
+       gpio_set_value(BALLOON3_GPIO_RUN_NAND, 0);
+       gpio_free(BALLOON3_GPIO_RUN_NAND);
 }
 
-static struct pxa2xx_udc_mach_info balloon3_udc_info = {
-       .udc_is_connected = balloon3_udc_is_connected,
-       .udc_command      = balloon3_udc_command,
+static struct mtd_partition balloon3_partition_info[] = {
+       [0] = {
+               .name   = "Boot",
+               .offset = 0,
+               .size   = SZ_4M,
+       },
+       [1] = {
+               .name   = "RootFS",
+               .offset = MTDPART_OFS_APPEND,
+               .size   = MTDPART_SIZ_FULL
+       },
 };
 
-static struct pxaficp_platform_data balloon3_ficp_platform_data = {
-       .transceiver_cap  = IR_SIRMODE | IR_FIRMODE | IR_OFF,
-};
+static const char *balloon3_part_probes[] = { "cmdlinepart", NULL };
 
-static unsigned long balloon3_ohci_pin_config[] = {
-       GPIO88_USBH1_PWR,
-       GPIO89_USBH1_PEN,
+struct platform_nand_data balloon3_nand_pdata = {
+       .chip = {
+               .nr_chips       = 4,
+               .chip_offset    = 0,
+               .nr_partitions  = ARRAY_SIZE(balloon3_partition_info),
+               .partitions     = balloon3_partition_info,
+               .chip_delay     = 50,
+               .part_probe_types = balloon3_part_probes,
+       },
+       .ctrl = {
+               .hwcontrol      = 0,
+               .dev_ready      = 0,
+               .select_chip    = balloon3_nand_select_chip,
+               .cmd_ctrl       = balloon3_nand_cmd_ctl,
+               .probe          = balloon3_nand_probe,
+               .remove         = balloon3_nand_remove,
+       },
 };
 
-static struct pxaohci_platform_data balloon3_ohci_platform_data = {
-       .port_mode      = PMM_PERPORT_MODE,
-       .flags          = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
+static struct resource balloon3_nand_resource[] = {
+       [0] = {
+               .start = BALLOON3_NAND_BASE,
+               .end   = BALLOON3_NAND_BASE + 0x4,
+               .flags = IORESOURCE_MEM,
+       },
 };
 
-static unsigned long balloon3_pin_config[] __initdata = {
-       /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
-       GPIO42_BTUART_RXD,
-       GPIO43_BTUART_TXD,
-       GPIO44_BTUART_CTS,
-       GPIO45_BTUART_RTS,
-
-       /* Wakeup GPIO */
-       GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
-
-       /* NAND & IDLE LED GPIOs */
-       GPIO9_GPIO,
-       GPIO10_GPIO,
+static struct platform_device balloon3_nand = {
+       .name           = "gen_nand",
+       .num_resources  = ARRAY_SIZE(balloon3_nand_resource),
+       .resource       = balloon3_nand_resource,
+       .id             = -1,
+       .dev            = {
+               .platform_data = &balloon3_nand_pdata,
+       }
 };
 
-static struct gpio_led balloon3_gpio_leds[] = {
+static void __init balloon3_nand_init(void)
+{
+       platform_device_register(&balloon3_nand);
+}
+#else
+static inline void balloon3_nand_init(void) {}
+#endif
+
+/******************************************************************************
+ * Core power regulator
+ ******************************************************************************/
+#if defined(CONFIG_REGULATOR_MAX1586) || \
+    defined(CONFIG_REGULATOR_MAX1586_MODULE)
+static struct regulator_consumer_supply balloon3_max1587a_consumers[] = {
        {
-               .name                   = "balloon3:green:idle",
-               .default_trigger        = "heartbeat",
-               .gpio                   = BALLOON3_GPIO_LED_IDLE,
-               .active_low             = 1,
+               .supply = "vcc_core",
+       }
+};
+
+static struct regulator_init_data balloon3_max1587a_v3_info = {
+       .constraints = {
+               .name           = "vcc_core range",
+               .min_uV         = 900000,
+               .max_uV         = 1705000,
+               .always_on      = 1,
+               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
        },
+       .consumer_supplies      = balloon3_max1587a_consumers,
+       .num_consumer_supplies  = ARRAY_SIZE(balloon3_max1587a_consumers),
+};
+
+static struct max1586_subdev_data balloon3_max1587a_subdevs[] = {
        {
-               .name                   = "balloon3:green:nand",
-               .default_trigger        = "nand-disk",
-               .gpio                   = BALLOON3_GPIO_LED_NAND,
-               .active_low             = 1,
-       },
+               .name           = "vcc_core",
+               .id             = MAX1586_V3,
+               .platform_data  = &balloon3_max1587a_v3_info,
+       }
 };
 
-static struct gpio_led_platform_data balloon3_gpio_leds_platform_data = {
-       .leds           = balloon3_gpio_leds,
-       .num_leds       = ARRAY_SIZE(balloon3_gpio_leds),
+static struct max1586_platform_data balloon3_max1587a_info = {
+       .subdevs     = balloon3_max1587a_subdevs,
+       .num_subdevs = ARRAY_SIZE(balloon3_max1587a_subdevs),
+       .v3_gain     = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
 };
 
-static struct platform_device balloon3led_device = {
-       .name   = "leds-gpio",
-       .id     = -1,
-       .dev    = {
-               .platform_data  = &balloon3_gpio_leds_platform_data,
+static struct i2c_board_info __initdata balloon3_pi2c_board_info[] = {
+       {
+               I2C_BOARD_INFO("max1586", 0x14),
+               .platform_data  = &balloon3_max1587a_info,
        },
 };
 
-static void __init balloon3_init(void)
+static void __init balloon3_pmic_init(void)
 {
-       pr_info("Initialising Balloon3\n");
+       pxa27x_set_i2c_power_info(NULL);
+       i2c_register_board_info(1, ARRAY_AND_SIZE(balloon3_pi2c_board_info));
+}
+#else
+static inline void balloon3_pmic_init(void) {}
+#endif
 
-       /* system bus arbiter setting
-        * - Core_Park
-        * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
-        */
+/******************************************************************************
+ * Machine init
+ ******************************************************************************/
+static void __init balloon3_init(void)
+{
        ARB_CNTRL = ARB_CORE_PARK | 0x234;
 
+       pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
+
        pxa_set_ffuart_info(NULL);
        pxa_set_btuart_info(NULL);
        pxa_set_stuart_info(NULL);
 
-       pxa_set_i2c_info(NULL);
-       if (balloon3_has(BALLOON3_FEATURE_AUDIO)) {
-               pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));
-               pxa_set_ac97_info(NULL);
-       }
-
-       if (balloon3_has(BALLOON3_FEATURE_TOPPOLY)) {
-               pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config));
-               gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT,
-                       "LCD Backlight Power");
-               gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
-               set_pxa_fb_info(&balloon3_pxafb_info);
-       }
-
-       if (balloon3_has(BALLOON3_FEATURE_MMC)) {
-               pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_mmc_pin_config));
-               pxa_set_mci_info(&balloon3_mci_platform_data);
-       }
-       pxa_set_ficp_info(&balloon3_ficp_platform_data);
-       if (balloon3_has(BALLOON3_FEATURE_OHCI)) {
-               pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ohci_pin_config));
-               pxa_set_ohci_info(&balloon3_ohci_platform_data);
-       }
-       pxa_set_udc_info(&balloon3_udc_info);
-
-       pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_pin_config));
-
-       platform_device_register(&balloon3led_device);
+       balloon3_i2c_init();
+       balloon3_irda_init();
+       balloon3_lcd_init();
+       balloon3_leds_init();
+       balloon3_mmc_init();
+       balloon3_nand_init();
+       balloon3_nor_init();
+       balloon3_pmic_init();
+       balloon3_ts_init();
+       balloon3_udc_init();
+       balloon3_uhc_init();
 }
 
 static struct map_desc balloon3_io_desc[] __initdata = {
@@ -349,6 +779,7 @@ MACHINE_START(BALLOON3, "Balloon3")
        .phys_io        = 0x40000000,
        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
        .map_io         = balloon3_map_io,
+       .nr_irqs        = BALLOON3_NR_IRQS,
        .init_irq       = balloon3_init_irq,
        .timer          = &pxa_timer,
        .init_machine   = balloon3_init,