mmc2 global hacks
authorGrazvydas Ignotas <notasas@gmail.com>
Fri, 31 Oct 2008 17:29:20 +0000 (19:29 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Fri, 31 Oct 2008 20:23:45 +0000 (22:23 +0200)
drivers/mmc/core/sd.c
drivers/mmc/host/omap_hsmmc.c

index 26fc098..7919765 100644 (file)
@@ -663,6 +663,9 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
         * Can we support the voltage(s) of the card(s)?
         */
        if (!host->ocr) {
+               printk(KERN_WARNING "%s: SD card needs voltage range "
+                      "not supported by host (ocr=%08x).\n",
+                      mmc_hostname(host), ocr);
                err = -EINVAL;
                goto err;
        }
index 00b1b68..90815e8 100644 (file)
@@ -506,6 +506,7 @@ static void mmc_omap_detect(struct work_struct *work)
 
        sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");
        if (host->carddetect) {
+#if 0 /* this code kills mmc host on Pandora! */
                if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
                        /*
                         * Set the VDD back to 3V when the card is removed
@@ -515,6 +516,10 @@ static void mmc_omap_detect(struct work_struct *work)
                        if (omap_mmc_switch_opcond(host, vdd) != 0)
                                host->mmc->ios.vdd = vdd;
                }
+#else
+               vdd = fls(host->mmc->ocr_avail) - 1;
+               host->mmc->ios.vdd = vdd;
+#endif
                mmc_detect_change(host->mmc, (HZ * 200) / 1000);
        } else {
                OMAP_HSMMC_WRITE(host->base, SYSCTL,
@@ -744,6 +749,12 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                                                "Switch operation failed\n");
                }
        }
+       else if (host->id == OMAP_MMC2_DEVID && ios->vdd == DUAL_VOLT_OCR_BIT &&
+               ios->power_mode != MMC_POWER_OFF &&
+               ios->power_mode != MMC_POWER_ON) {
+                       /* see above comment.. */
+                       omap_mmc_switch_opcond(host, ios->vdd);
+       }
 
        if (ios->clock) {
                dsor = OMAP_MMC_MASTER_CLOCK / ios->clock;