summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorLei Wen <leiwen@marvell.com>2011-10-08 04:14:57 +0000
committerAndy Fleming <afleming@freescale.com>2011-11-03 02:14:59 -0500
commita004abde88e509443a45cc309f310db128cec5f2 (patch)
treeae106b6cf64a39bee6e190935af137eef411406b /drivers/mmc
parent6cf1b17cd0af756bab5ec07cbf9f8ed13c229220 (diff)
downloadu-boot-imx-a004abde88e509443a45cc309f310db128cec5f2.zip
u-boot-imx-a004abde88e509443a45cc309f310db128cec5f2.tar.gz
u-boot-imx-a004abde88e509443a45cc309f310db128cec5f2.tar.bz2
mmc: sdhci: add timeout for data transfer
Signed-off-by: Lei Wen <leiwen@marvell.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/sdhci.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 31c738e..77a9e70 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -81,8 +81,9 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)
static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
unsigned int start_addr)
{
- unsigned int stat, rdy, mask, block = 0;
+ unsigned int stat, rdy, mask, timeout, block = 0;
+ timeout = 10000;
rdy = SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_AVAIL;
mask = SDHCI_DATA_AVAILABLE | SDHCI_SPACE_AVAILABLE;
do {
@@ -108,6 +109,12 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS);
}
#endif
+ if (timeout-- > 0)
+ udelay(10);
+ else {
+ printf("Transfer data timeout\n");
+ return -1;
+ }
} while (!(stat & SDHCI_INT_DATA_END));
return 0;
}