-commit 872a8ff772ded51403bd8a46f80b1bf9706b76cd
-Author: Paul Walmsley <paul@pwsan.com>
-Date: Mon Mar 12 10:58:00 2012 -0600
-
- mmc: use really long write timeout to deal with crappy cards
-
- 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>
-
-diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
-index d637982..a14ddf96 100644
---- a/drivers/mmc/core/core.c
-+++ b/drivers/mmc/core/core.c
-@@ -396,10 +396,14 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
-
- if (data->flags & MMC_DATA_WRITE)
- /*
-- * The limit is really 250 ms, but that is
-- * insufficient for some crappy cards.
-+ * The MMC spec "It is strongly recommended
-+ * for hosts to implement more than 500ms
-+ * timeout value even if the card indicates
-+ * the 250ms maximum busy length." Even the
-+ * previous value of 300ms is known to be
-+ * insufficient for some cards.
- */
-- limit_us = 300000;
-+ limit_us = 3000000;
- else
- limit_us = 100000;
-
-The folowing sdhci fixes rebased from rasperry pi github tree to kernel 3.2 to use
-actial firmware that run emmc slot at 50Mhz.
-Author: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
-
-diff -Naur linux-3.2.20.org/drivers/mmc/host/sdhci-bcm2708.c linux-3.2.20/drivers/mmc/host/sdhci-bcm2708.c
---- linux-3.2.20.org/drivers/mmc/host/sdhci-bcm2708.c 2012-06-12 00:18:23.000000000 +0200
-+++ linux-3.2.20/drivers/mmc/host/sdhci-bcm2708.c 2012-06-14 09:33:42.448194435 +0200
-@@ -328,12 +328,7 @@
-
- static unsigned int sdhci_bcm2708_get_max_clock(struct sdhci_host *host)
- {
-- return 100000000; // this value is in Hz (100MHz/4)
--}
--
--static unsigned int sdhci_bcm2708_get_timeout_clock(struct sdhci_host *host)
--{
-- return 100000; // this value is in kHz (100MHz/4)
-+ return BCM2708_EMMC_CLOCK_FREQ;
- }
-
- /*****************************************************************************\
-@@ -1222,12 +1217,7 @@
- #else
- #error The BCM2708 SDHCI driver needs CONFIG_MMC_SDHCI_IO_ACCESSORS to be set
- #endif
-- //.enable_dma = NULL,
-- //.set_clock = NULL,
- .get_max_clock = sdhci_bcm2708_get_max_clock,
-- //.get_min_clock = NULL,
-- .get_timeout_clock = sdhci_bcm2708_get_timeout_clock,
--
- .enable = sdhci_bcm2708_enable,
- .disable = sdhci_bcm2708_disable,
- .set_plat_power = sdhci_bcm2708_set_plat_power,
-diff -Naur linux-3.2.20.org/drivers/mmc/host/sdhci-bcm2708.c linux-3.2.20/drivers/mmc/host/sdhci-bcm2708.c
---- linux-3.2.20.org/drivers/mmc/host/sdhci-bcm2708.c 2012-06-14 09:33:42.000000000 +0200
-+++ linux-3.2.20/drivers/mmc/host/sdhci-bcm2708.c 2012-06-14 09:47:20.635695042 +0200
-@@ -1277,7 +1277,10 @@
- host->irq = platform_get_irq(pdev, 0);
-
- host->quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
-- SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK;
-+ SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
-+ SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
-+ SDHCI_QUIRK_MISSING_CAPS |
-+ SDHCI_QUIRK_NO_HISPD_BIT;
- #ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
- host->flags = SDHCI_USE_PLATDMA;
- #endif
-diff -Naur linux-3.2.20.org/drivers/mmc/host/sdhci-bcm2708.c linux-3.2.20/drivers/mmc/host/sdhci-bcm2708.c
---- linux-3.2.20.org/drivers/mmc/host/sdhci-bcm2708.c 2012-06-14 10:03:31.000000000 +0200
-+++ linux-3.2.20/drivers/mmc/host/sdhci-bcm2708.c 2012-06-14 10:15:44.909133194 +0200
-@@ -71,6 +71,8 @@
-
- #define BCM2708_SDHCI_SLEEP_TIMEOUT 1000 /* msecs */
-
-+#define BCM2708_EMMC_CLOCK_FREQ 50000000
-+
- #define POWER_OFF 0
- #define POWER_LAZY_OFF 1
- #define POWER_ON 2
-
-With the last revert Chris Boot has removed the UHS block at 3.3V
-so it is needed to readd it to use some cards (eg. Verbatim 8GB Class10)
-Author: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
-
-diff -Naur linux-3.2.20.org/drivers/mmc/host/sdhci.c linux-3.2.20/drivers/mmc/host/sdhci.c
---- linux-3.2.20.org/drivers/mmc/host/sdhci.c 2012-06-12 00:18:24.000000000 +0200
-+++ linux-3.2.20/drivers/mmc/host/sdhci.c 2012-06-14 12:47:25.435538000 +0200
-@@ -2930,6 +2930,10 @@
- if(host->ops->voltage_broken)
- ocr_avail |= MMC_VDD_29_30 | MMC_VDD_30_31;
-
-+ /* No UHS Modes at 3.3V */
-+ mmc->caps &= ~(MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR104 |
-+ MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 );
-+
- mmc->ocr_avail = ocr_avail;
- mmc->ocr_avail_sdio = ocr_avail;
- if (host->ocr_avail_sdio)