aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/sdhci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r--drivers/mmc/sdhci.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 302dd5bde751..5324eae6d720 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -465,6 +465,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
465static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) 465static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
466{ 466{
467 int flags; 467 int flags;
468 u32 mask;
468 unsigned long timeout; 469 unsigned long timeout;
469 470
470 WARN_ON(host->cmd); 471 WARN_ON(host->cmd);
@@ -473,11 +474,20 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
473 474
474 /* Wait max 10 ms */ 475 /* Wait max 10 ms */
475 timeout = 10; 476 timeout = 10;
476 while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & 477
477 (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT)) { 478 mask = SDHCI_CMD_INHIBIT;
479 if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY))
480 mask |= SDHCI_DATA_INHIBIT;
481
482 /* We shouldn't wait for data inihibit for stop commands, even
483 though they might use busy signaling */
484 if (host->mrq->data && (cmd == host->mrq->data->stop))
485 mask &= ~SDHCI_DATA_INHIBIT;
486
487 while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
478 if (timeout == 0) { 488 if (timeout == 0) {
479 printk(KERN_ERR "%s: Controller never released " 489 printk(KERN_ERR "%s: Controller never released "
480 "inhibit bits. Please report this to " 490 "inhibit bit(s). Please report this to "
481 BUGMAIL ".\n", mmc_hostname(host->mmc)); 491 BUGMAIL ".\n", mmc_hostname(host->mmc));
482 sdhci_dumpregs(host); 492 sdhci_dumpregs(host);
483 cmd->error = MMC_ERR_FAILED; 493 cmd->error = MMC_ERR_FAILED;