From: Grazvydas Ignotas Date: Sun, 22 May 2016 22:41:02 +0000 (+0300) Subject: omap_hsmmc: try to avoid reading the card too early X-Git-Tag: sz_175~15 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=commitdiff_plain;h=ff4ec2e4369969233274410391e27d719db3d7e2 omap_hsmmc: try to avoid reading the card too early Pandora's SD sockets have card detect that triggers way before the card is fully inserted, so sometimes the commands start before card has finished moving and got locked in it's place. Try to delay more to deal with it. --- diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 6a960c15d76b..2844e01d656e 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -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;