mmc: sdhci-of-esdhc: set timeout to max before tuning
[linux-2.6-microblaze.git] / drivers / mmc / host / sdhci-of-esdhc.c
index 0b45eff..baf7801 100644 (file)
@@ -1052,6 +1052,17 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
        esdhc_tuning_block_enable(host, true);
 
+       /*
+        * The eSDHC controller takes the data timeout value into account
+        * during tuning. If the SD card is too slow sending the response, the
+        * timer will expire and a "Buffer Read Ready" interrupt without data
+        * is triggered. This leads to tuning errors.
+        *
+        * Just set the timeout to the maximum value because the core will
+        * already take care of it in sdhci_send_tuning().
+        */
+       sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
+
        hs400_tuning = host->flags & SDHCI_HS400_TUNING;
 
        do {