Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-4430sdp.c
index 41fed92..e4a5d66 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/gpio.h>
 #include <linux/usb/otg.h>
 #include <linux/spi/spi.h>
+#include <linux/i2c/twl.h>
+#include <linux/regulator/machine.h>
 
 #include <mach/hardware.h>
 #include <mach/omap4-common.h>
@@ -31,6 +33,8 @@
 #include <plat/control.h>
 #include <plat/timer-gp.h>
 #include <plat/usb.h>
+#include <plat/mmc.h>
+#include "hsmmc.h"
 
 #define ETH_KS8851_IRQ                 34
 #define ETH_KS8851_POWER_ON            48
@@ -135,13 +139,228 @@ static struct omap_musb_board_data musb_board_data = {
        .mode                   = MUSB_PERIPHERAL,
        .power                  = 100,
 };
+
+static struct omap2_hsmmc_info mmc[] = {
+       {
+               .mmc            = 1,
+               .wires          = 8,
+               .gpio_wp        = -EINVAL,
+       },
+       {
+               .mmc            = 2,
+               .wires          = 8,
+               .gpio_cd        = -EINVAL,
+               .gpio_wp        = -EINVAL,
+               .nonremovable   = true,
+       },
+       {}      /* Terminator */
+};
+
+static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
+       {
+               .supply = "vmmc",
+               .dev_name = "mmci-omap-hs.0",
+       },
+       {
+               .supply = "vmmc",
+               .dev_name = "mmci-omap-hs.1",
+       },
+};
+
+static int omap4_twl6030_hsmmc_late_init(struct device *dev)
+{
+       int ret = 0;
+       struct platform_device *pdev = container_of(dev,
+                               struct platform_device, dev);
+       struct omap_mmc_platform_data *pdata = dev->platform_data;
+
+       /* Setting MMC1 Card detect Irq */
+       if (pdev->id == 0)
+               pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
+                                               MMCDETECT_INTR_OFFSET;
+       return ret;
+}
+
+static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
+{
+       struct omap_mmc_platform_data *pdata = dev->platform_data;
+
+       pdata->init =   omap4_twl6030_hsmmc_late_init;
+}
+
+static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
+{
+       struct omap2_hsmmc_info *c;
+
+       omap2_hsmmc_init(controllers);
+       for (c = controllers; c->mmc; c++)
+               omap4_twl6030_hsmmc_set_late_init(c->dev);
+
+       return 0;
+}
+
+static struct regulator_init_data sdp4430_vaux1 = {
+       .constraints = {
+               .min_uV                 = 1000000,
+               .max_uV                 = 3000000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vaux2 = {
+       .constraints = {
+               .min_uV                 = 1200000,
+               .max_uV                 = 2800000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vaux3 = {
+       .constraints = {
+               .min_uV                 = 1000000,
+               .max_uV                 = 3000000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+/* VMMC1 for MMC1 card */
+static struct regulator_init_data sdp4430_vmmc = {
+       .constraints = {
+               .min_uV                 = 1200000,
+               .max_uV                 = 3000000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+       .num_consumer_supplies  = 2,
+       .consumer_supplies      = sdp4430_vmmc_supply,
+};
+
+static struct regulator_init_data sdp4430_vpp = {
+       .constraints = {
+               .min_uV                 = 1800000,
+               .max_uV                 = 2500000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vusim = {
+       .constraints = {
+               .min_uV                 = 1200000,
+               .max_uV                 = 2900000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vana = {
+       .constraints = {
+               .min_uV                 = 2100000,
+               .max_uV                 = 2100000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vcxio = {
+       .constraints = {
+               .min_uV                 = 1800000,
+               .max_uV                 = 1800000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vdac = {
+       .constraints = {
+               .min_uV                 = 1800000,
+               .max_uV                 = 1800000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct regulator_init_data sdp4430_vusb = {
+       .constraints = {
+               .min_uV                 = 3300000,
+               .max_uV                 = 3300000,
+               .apply_uV               = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  =      REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+static struct twl4030_platform_data sdp4430_twldata = {
+       .irq_base       = TWL6030_IRQ_BASE,
+       .irq_end        = TWL6030_IRQ_END,
+
+       /* Regulators */
+       .vmmc           = &sdp4430_vmmc,
+       .vpp            = &sdp4430_vpp,
+       .vusim          = &sdp4430_vusim,
+       .vana           = &sdp4430_vana,
+       .vcxio          = &sdp4430_vcxio,
+       .vdac           = &sdp4430_vdac,
+       .vusb           = &sdp4430_vusb,
+       .vaux1          = &sdp4430_vaux1,
+       .vaux2          = &sdp4430_vaux2,
+       .vaux3          = &sdp4430_vaux3,
+};
+
+static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
+       {
+               I2C_BOARD_INFO("twl6030", 0x48),
+               .flags = I2C_CLIENT_WAKE,
+               .irq = OMAP44XX_IRQ_SYS_1N,
+               .platform_data = &sdp4430_twldata,
+       },
+};
 static int __init omap4_i2c_init(void)
 {
        /*
         * Phoenix Audio IC needs I2C1 to
         * start with 400 KHz or less
         */
-       omap_register_i2c_bus(1, 400, NULL, 0);
+       omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
+                       ARRAY_SIZE(sdp4430_i2c_boardinfo));
        omap_register_i2c_bus(2, 400, NULL, 0);
        omap_register_i2c_bus(3, 400, NULL, 0);
        omap_register_i2c_bus(4, 400, NULL, 0);
@@ -154,6 +373,7 @@ static void __init omap_4430sdp_init(void)
        omap4_i2c_init();
        platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
        omap_serial_init();
+       omap4_twl6030_hsmmc_init(mmc);
        /* OMAP4 SDP uses internal transceiver so register nop transceiver */
        usb_nop_xceiv_register();
        /* FIXME: allow multi-omap to boot until musb is updated for omap4 */