omap_hsmmc: try to avoid reading the card too early
[pandora-kernel.git] / drivers / mmc / host / omap_hsmmc.c
index 6a960c1..2844e01 100644 (file)
@@ -195,9 +195,16 @@ struct omap_hsmmc_host {
 static int omap_hsmmc_card_detect(struct device *dev, int slot)
 {
        struct omap_mmc_platform_data *mmc = dev->platform_data;
+       int val1, val2;
 
        /* NOTE: assumes card detect signal is active-low */
-       return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+       do {
+               val1 = gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+               val2 = gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+       }
+       while (val1 != val2);
+
+       return !val1;
 }
 
 static int omap_hsmmc_get_wp(struct device *dev, int slot)
@@ -1358,7 +1365,7 @@ static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)
        }
 
        if (carddetect)
-               mmc_detect_change(host->mmc, (HZ * 200) / 1000);
+               mmc_detect_change(host->mmc, (HZ * 500) / 1000);
        else
                mmc_detect_change(host->mmc, (HZ * 50) / 1000);
        return IRQ_HANDLED;