public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc:sdhci: Fix card ready status timeout.
@ 2013-09-03 12:50 Przemyslaw Marczak
  2013-09-06 13:24 ` Pantelis Antoniou
  0 siblings, 1 reply; 10+ messages in thread
From: Przemyslaw Marczak @ 2013-09-03 12:50 UTC (permalink / raw)
  To: u-boot

According to JEDEC eMMC specification, after data transfer
(multiple or single block) host must wait for card ready
status. This is done by waiting for command and data lines
to be at idle state after transfer. JEDEC does not specify
maximum timeout.

Before this change max timeout was 10 ms but in case of UMS
- when system does multiple read/write operations on random
card blocks - timeout causes I/O errors.
The timeout has been increased to 200ms after data transfer.
For other transfers it stays unchanged.

Tested on Goni and Trats.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 drivers/mmc/sdhci.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 4261991..c495482 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -121,8 +121,18 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 	unsigned int timeout, start_addr = 0;
 	unsigned int retry = 10000;
 
-	/* Wait max 10 ms */
-	timeout = 10;
+	/*
+	 * For some commands this function is called with NULL mmc_data
+	 * pointer. One of those is CMD13 - send card status.
+	 * After read/write data transfer or block erase commands - host sends
+	 * CMD13 and is waiting for card ready status with some timeout.
+	 * According to some internal cards operations after those commands
+	 * this time must be increased.
+	 */
+	if (data)
+		timeout = 10; /* ms */
+	else
+		timeout = 200;
 
 	sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS);
 	mask = SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] mmc:sdhci: Fix card ready status timeout.
@ 2013-08-28 16:49 Przemyslaw Marczak
  2013-08-29  3:16 ` Jaehoon Chung
  0 siblings, 1 reply; 10+ messages in thread
From: Przemyslaw Marczak @ 2013-08-28 16:49 UTC (permalink / raw)
  To: u-boot

According to JEDEC eMMC specification, after data transfer
(multiple or single block) host must wait for card ready
status. This is done by waiting for command and data lines
to be at idle state after transfer. JEDEC does not specify
maximum timeout.

Before this change max timeout was 10 ms but in case of UMS
- when system do multiple read/write operations on random
card blocks - timeout causes I/O errors.
The timeout has been increased to 200ms after data transfer.
For other transfers it stays unchanged.

Tested on Goni and Trats.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 drivers/mmc/sdhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 4261991..22c18d1 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -121,8 +121,10 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 	unsigned int timeout, start_addr = 0;
 	unsigned int retry = 10000;
 
-	/* Wait max 10 ms */
-	timeout = 10;
+	if (!data)
+		timeout = 200;
+	else
+		timeout = 10;
 
 	sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS);
 	mask = SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-16 16:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 12:50 [U-Boot] [PATCH] mmc:sdhci: Fix card ready status timeout Przemyslaw Marczak
2013-09-06 13:24 ` Pantelis Antoniou
2013-09-06 15:23   ` Przemyslaw Marczak
2013-09-06 15:27     ` Pantelis Antoniou
2013-09-09 12:58     ` Przemyslaw Marczak
2013-09-13 12:59       ` Przemyslaw Marczak
2013-09-16 16:34         ` Pantelis Antoniou
  -- strict thread matches above, loose matches on Subject: below --
2013-08-28 16:49 Przemyslaw Marczak
2013-08-29  3:16 ` Jaehoon Chung
2013-09-02 14:16   ` Przemyslaw Marczak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox