pandora: remove unused i2c_boardinfo
[pandora-kernel.git] / arch / arm / mach-omap2 / hsmmc.c
index 097a42d..606a8cd 100644 (file)
@@ -19,6 +19,7 @@
 #include <plat/omap-pm.h>
 #include <plat/mux.h>
 #include <plat/omap_device.h>
+#include <asm/mach-types.h>
 
 #include "mux.h"
 #include "hsmmc.h"
@@ -129,15 +130,11 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
         * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
         * card with Vcc regulator (from twl4030 or whatever).  OMAP has both
         * 1.8V and 3.0V modes, controlled by the PBIAS register.
-        *
-        * In 8-bit modes, OMAP VMMC1A (for DAT4..7) needs a supply, which
-        * is most naturally TWL VSIM; those pins also use PBIAS.
-        *
-        * FIXME handle VMMC1A as needed ...
         */
        reg = omap4_ctrl_pad_readl(control_pbias_offset);
        reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
-               OMAP4_MMC1_PWRDNZ_MASK);
+               OMAP4_MMC1_PWRDNZ_MASK |
+               OMAP4_MMC1_PBIASLITE_VMODE_MASK);
        omap4_ctrl_pad_writel(reg, control_pbias_offset);
 }
 
@@ -172,16 +169,10 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
                        reg &= ~(OMAP4_MMC1_PWRDNZ_MASK);
                        omap4_ctrl_pad_writel(reg, control_pbias_offset);
                }
-       } else {
-               reg = omap4_ctrl_pad_readl(control_pbias_offset);
-               reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
-                       OMAP4_MMC1_PWRDNZ_MASK |
-                       OMAP4_MMC1_PBIASLITE_VMODE_MASK);
-               omap4_ctrl_pad_writel(reg, control_pbias_offset);
        }
 }
 
-static void hsmmc23_before_set_reg(struct device *dev, int slot,
+static void hsmmc2_before_set_reg(struct device *dev, int slot,
                                   int power_on, int vdd)
 {
        struct omap_mmc_platform_data *mmc = dev->platform_data;
@@ -190,14 +181,14 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
                mmc->slots[0].remux(dev, slot, power_on);
 
        if (power_on) {
-               /* Only MMC2 supports a CLKIN */
-               if (mmc->slots[0].internal_clock) {
-                       u32 reg;
+               u32 reg;
 
-                       reg = omap_ctrl_readl(control_devconf1_offset);
+               reg = omap_ctrl_readl(control_devconf1_offset);
+               if (mmc->slots[0].internal_clock)
                        reg |= OMAP2_MMCSDIO2ADPCLKISEL;
-                       omap_ctrl_writel(reg, control_devconf1_offset);
-               }
+               else
+                       reg &= ~OMAP2_MMCSDIO2ADPCLKISEL;
+               omap_ctrl_writel(reg, control_devconf1_offset);
        }
 }
 
@@ -388,14 +379,13 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
                        c->caps &= ~MMC_CAP_8_BIT_DATA;
                        c->caps |= MMC_CAP_4_BIT_DATA;
                }
-               /* FALLTHROUGH */
-       case 3:
                if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
                        /* off-chip level shifting, or none */
-                       mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+                       mmc->slots[0].before_set_reg = hsmmc2_before_set_reg;
                        mmc->slots[0].after_set_reg = NULL;
                }
                break;
+       case 3:
        case 4:
        case 5:
                mmc->slots[0].before_set_reg = NULL;
@@ -409,31 +399,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
        return 0;
 }
 
-static struct omap_device_pm_latency omap_hsmmc_latency[] = {
-       [0] = {
-               .deactivate_func = omap_device_idle_hwmods,
-               .activate_func   = omap_device_enable_hwmods,
-               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-       },
-       /*
-        * XXX There should also be an entry here to power off/on the
-        * MMC regulators/PBIAS cells, etc.
-        */
-};
-
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN            16
 
 void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 {
        struct omap_hwmod *oh;
-       struct omap_device *od;
-       struct omap_device_pm_latency *ohl;
+       struct platform_device *pdev;
        char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
        struct omap_mmc_platform_data *mmc_data;
        struct omap_mmc_dev_attr *mmc_dev_attr;
        char *name;
        int l;
-       int ohl_cnt = 0;
 
        mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
        if (!mmc_data) {
@@ -448,8 +424,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
        omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
 
        name = "omap_hsmmc";
-       ohl = omap_hsmmc_latency;
-       ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
 
        l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
                     "mmc%d", ctrl_nr);
@@ -465,11 +439,18 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
        if (oh->dev_attr != NULL) {
                mmc_dev_attr = oh->dev_attr;
                mmc_data->controller_flags = mmc_dev_attr->flags;
+               /*
+                * erratum 2.1.1.128 doesn't apply if board has
+                * a transceiver is attached
+                */
+               if (hsmmcinfo->transceiver)
+                       mmc_data->controller_flags &=
+                               ~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
        }
 
-       od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
-               sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
-       if (IS_ERR(od)) {
+       pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
+               sizeof(struct omap_mmc_platform_data), NULL, 0, false);
+       if (IS_ERR(pdev)) {
                WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
                kfree(mmc_data->slots[0].name);
                goto done;
@@ -478,7 +459,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
         * return device handle to board setup code
         * required to populate for regulator framework structure
         */
-       hsmmcinfo->dev = &od->pdev.dev;
+       hsmmcinfo->dev = &pdev->dev;
 
 done:
        kfree(mmc_data);
@@ -496,6 +477,13 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
                        control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
                        control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
                }
+
+               if (machine_is_omap3_pandora()) {
+                       /* needed for gpio_126 - gpio_129 to work correctly */
+                       reg = omap_ctrl_readl(control_pbias_offset);
+                       reg &= ~OMAP343X_PBIASLITEVMODE1;
+                       omap_ctrl_writel(reg, control_pbias_offset);
+               }
        } else {
                control_pbias_offset =
                        OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_PBIASLITE;
@@ -505,7 +493,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
                        OMAP4_SDMMC1_PUSTRENGTH_GRP1_MASK);
                reg &= ~(OMAP4_SDMMC1_PUSTRENGTH_GRP2_MASK |
                        OMAP4_SDMMC1_PUSTRENGTH_GRP3_MASK);
-               reg |= (OMAP4_USBC1_DR0_SPEEDCTRL_MASK|
+               reg |= (OMAP4_SDMMC1_DR0_SPEEDCTRL_MASK |
                        OMAP4_SDMMC1_DR1_SPEEDCTRL_MASK |
                        OMAP4_SDMMC1_DR2_SPEEDCTRL_MASK);
                omap4_ctrl_pad_writel(reg, control_mmc1);