summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorScott Branden <sbranden@broadcom.com>2015-03-10 14:35:10 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2015-03-23 09:13:46 -0400
commit04e079cf6b24c794bbc52b04b370f84cb728540e (patch)
treeb72f48d1ccec2b14b313f1ef2a3fb51611139b61 /drivers/mmc
parent03a6d291047da60d56514c28fa1314235bdf2037 (diff)
mmc: sdhci: fix card presence logic in sdhci_request function
The sdhci_request function should consider a non-removable device always present. Call the correct logic already available in sdhci_do_get_cd function. This fixes some logic paths where MMC requests are being made to non-removable devices that do not have the card detect pin connected on the hardware as it is non-removable. Signed-off-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3d7ebbb82318..c80287a02735 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -57,6 +57,7 @@ static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);
57static int sdhci_pre_dma_transfer(struct sdhci_host *host, 57static int sdhci_pre_dma_transfer(struct sdhci_host *host,
58 struct mmc_data *data, 58 struct mmc_data *data,
59 struct sdhci_host_next *next); 59 struct sdhci_host_next *next);
60static int sdhci_do_get_cd(struct sdhci_host *host);
60 61
61#ifdef CONFIG_PM 62#ifdef CONFIG_PM
62static int sdhci_runtime_pm_get(struct sdhci_host *host); 63static int sdhci_runtime_pm_get(struct sdhci_host *host);
@@ -1358,7 +1359,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
1358 1359
1359 sdhci_runtime_pm_get(host); 1360 sdhci_runtime_pm_get(host);
1360 1361
1361 present = mmc_gpio_get_cd(host->mmc); 1362 /* Firstly check card presence */
1363 present = sdhci_do_get_cd(host);
1362 1364
1363 spin_lock_irqsave(&host->lock, flags); 1365 spin_lock_irqsave(&host->lock, flags);
1364 1366
@@ -1381,22 +1383,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
1381 1383
1382 host->mrq = mrq; 1384 host->mrq = mrq;
1383 1385
1384 /*
1385 * Firstly check card presence from cd-gpio. The return could
1386 * be one of the following possibilities:
1387 * negative: cd-gpio is not available
1388 * zero: cd-gpio is used, and card is removed
1389 * one: cd-gpio is used, and card is present
1390 */
1391 if (present < 0) {
1392 /* If polling, assume that the card is always present. */
1393 if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
1394 present = 1;
1395 else
1396 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
1397 SDHCI_CARD_PRESENT;
1398 }
1399
1400 if (!present || host->flags & SDHCI_DEVICE_DEAD) { 1386 if (!present || host->flags & SDHCI_DEVICE_DEAD) {
1401 host->mrq->cmd->error = -ENOMEDIUM; 1387 host->mrq->cmd->error = -ENOMEDIUM;
1402 tasklet_schedule(&host->finish_tasklet); 1388 tasklet_schedule(&host->finish_tasklet);