aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-03-12 06:58:00 -0400
committerChris Ball <cjb@laptop.org>2012-04-05 20:32:34 -0400
commit3bdc9ba892d6a294d16e9e6e0c4041926aa3d58c (patch)
tree2b1ed75a8b3b5a40c01e8f80bc45242a3c2b35f0
parent8c2fc8e413ecc2c96b696e28d4eb1bc6cee8dc84 (diff)
mmc: use really long write timeout to deal with crappy cards
Several people have noticed that crappy SD cards take much longer to complete multiple block writes than the 300ms that Linux specifies. Try to work around this by using a three second write timeout instead. This is a generalized version of a patch from Chase Maupin <Chase.Maupin@ti.com>, whose patch description said: * With certain SD cards timeouts like the following have been seen due to an improper calculation of the dto value: mmcblk0: error -110 transferring data, sector 4126233, nr 8, card status 0xc00 * By removing the dto calculation and setting the timeout value to the maximum specified by the SD card specification part A2 section 2.2.15 these timeouts can be avoided. * This change has been used by beagleboard users as well as the Texas Instruments SDK without a negative impact. * There are multiple discussion threads about this but the most relevant ones are: * http://talk.maemo.org/showthread.php?p=1000707#post1000707 * http://www.mail-archive.com/linux-omap@vger.kernel.org/msg42213.html * Original proposal for this fix was done by Sukumar Ghoral of Texas Instruments * Tested using a Texas Instruments AM335x EVM Signed-off-by: Paul Walmsley <paul@pwsan.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/core/core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 14f262e9246d..7474c47b9c08 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -527,10 +527,14 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
527 527
528 if (data->flags & MMC_DATA_WRITE) 528 if (data->flags & MMC_DATA_WRITE)
529 /* 529 /*
530 * The limit is really 250 ms, but that is 530 * The MMC spec "It is strongly recommended
531 * insufficient for some crappy cards. 531 * for hosts to implement more than 500ms
532 * timeout value even if the card indicates
533 * the 250ms maximum busy length." Even the
534 * previous value of 300ms is known to be
535 * insufficient for some cards.
532 */ 536 */
533 limit_us = 300000; 537 limit_us = 3000000;
534 else 538 else
535 limit_us = 100000; 539 limit_us = 100000;
536 540