diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2006-06-30 05:22:24 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-07-02 11:02:03 -0400 |
commit | e16514d8d86ecbde18a2a7495cf028861b34c157 (patch) | |
tree | 9bef8f5f095d8fb4088ec1344369ada10c106d00 /drivers/mmc/sdhci.c | |
parent | 7cb2c76fa2251474e42d55b75163c9d7ed11741e (diff) |
[MMC] sdhci: fix sdhci reset timeout
The reset register is automatically cleared when the reset has completed.
Hence, we should busy wait and not have a fixed delay.
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>
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r-- | drivers/mmc/sdhci.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 007e825dcb93..77b7db27b555 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -94,12 +94,27 @@ static void sdhci_dumpregs(struct sdhci_host *host) | |||
94 | 94 | ||
95 | static void sdhci_reset(struct sdhci_host *host, u8 mask) | 95 | static void sdhci_reset(struct sdhci_host *host, u8 mask) |
96 | { | 96 | { |
97 | unsigned long timeout; | ||
98 | |||
97 | writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); | 99 | writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); |
98 | 100 | ||
99 | if (mask & SDHCI_RESET_ALL) { | 101 | if (mask & SDHCI_RESET_ALL) |
100 | host->clock = 0; | 102 | host->clock = 0; |
101 | 103 | ||
102 | mdelay(50); | 104 | /* Wait max 100 ms */ |
105 | timeout = 100; | ||
106 | |||
107 | /* hw clears the bit when it's done */ | ||
108 | while (readb(host->ioaddr + SDHCI_SOFTWARE_RESET) & mask) { | ||
109 | if (timeout == 0) { | ||
110 | printk(KERN_ERR "%s: Reset 0x%x never completed. " | ||
111 | "Please report this to " BUGMAIL ".\n", | ||
112 | mmc_hostname(host->mmc), (int)mask); | ||
113 | sdhci_dumpregs(host); | ||
114 | return; | ||
115 | } | ||
116 | timeout--; | ||
117 | mdelay(1); | ||
103 | } | 118 | } |
104 | } | 119 | } |
105 | 120 | ||
@@ -619,9 +634,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
619 | */ | 634 | */ |
620 | if (ios->power_mode == MMC_POWER_OFF) { | 635 | if (ios->power_mode == MMC_POWER_OFF) { |
621 | writel(0, host->ioaddr + SDHCI_SIGNAL_ENABLE); | 636 | writel(0, host->ioaddr + SDHCI_SIGNAL_ENABLE); |
622 | spin_unlock_irqrestore(&host->lock, flags); | ||
623 | sdhci_init(host); | 637 | sdhci_init(host); |
624 | spin_lock_irqsave(&host->lock, flags); | ||
625 | } | 638 | } |
626 | 639 | ||
627 | sdhci_set_clock(host, ios->clock); | 640 | sdhci_set_clock(host, ios->clock); |