diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2006-06-30 05:22:28 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-07-02 11:54:50 -0400 |
commit | fd2208d7c72ef5995b730f1e23b082261499e334 (patch) | |
tree | 45ae8cd310437e2688bf78a53a194bc655a940b7 | |
parent | 1d676e02970d9e511c9b96101501da90954ee265 (diff) |
[MMC] sdhci: check only relevant inhibit bits
Conform to the sdhci specification as to which inhibit bits should be checked
at different times.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/mmc/sdhci.c | 16 |
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) | |||
465 | static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | 465 | static 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; |