[U-Boot] [PATCH v2 5/5] Fix timeout in Marvell SDIO MMC driver

DrEagle dreagle at doukki.net
Sat Sep 22 09:18:46 CEST 2012


Fix an issue with most SDHC cards because of timeout delay

Signed-off-by: drEagle <dreagle at doukki.net>
---
 drivers/mmc/mrvl_mmc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mrvl_mmc.c b/drivers/mmc/mrvl_mmc.c
index 8127961..bdafbc7 100644
--- a/drivers/mmc/mrvl_mmc.c
+++ b/drivers/mmc/mrvl_mmc.c
@@ -4,6 +4,7 @@
  * (C) Copyright 2012
  * Marvell Semiconductor <www.marvell.com>
  * Written-by: Lior Amsalem <alior at marvell.com>
+ * Written-by: Gérald Kerma <uboot at doukki.net>
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -127,10 +128,9 @@ static int mrvl_mmc_send_cmd (struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_d
 	SDIO_REG_WRITE16(SDIO_CMD, MRVL_MMC_MAKE_CMD(cmd->cmdidx, resptype));
 
 	/* Waiting for completion */
-	timeout = 1000000;
+	timeout = 10000;
 
 	while (!((SDIO_REG_READ16(SDIO_NOR_INTR_STATUS)) & waittype)) {
-		udelay(1);
 		if (SDIO_REG_READ16(SDIO_NOR_INTR_STATUS) & SDIO_NOR_ERROR) {
 #ifdef DEBUG
 			printf("mrvl_mmc_send_cmd: error! cmd : %d, err reg: %04x\n", cmd->cmdidx, SDIO_REG_READ16(SDIO_ERR_INTR_STATUS));
@@ -139,6 +139,7 @@ static int mrvl_mmc_send_cmd (struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_d
 				return TIMEOUT;
 			return COMM_ERR;
 		}
+		udelay(1000);
 		timeout--;
 		if (timeout <= 0) {
 			printf("MRVL MMC: command timed out\n");
-- 
1.7.10.4



More information about the U-Boot mailing list