[PORT FROM R2]mmc: core: increase eMMC card write timeout response time
authorChuanxiao Dong <chuanxiao.dong@intel.com>
Mon, 6 Feb 2012 07:52:37 +0000 (15:52 +0800)
committerbuildbot <buildbot@intel.com>
Wed, 15 Feb 2012 09:30:53 +0000 (01:30 -0800)
BZ: 23202

original commit:
BZ: 22383

Medfiled boards has observed MMC card -110 errors, but card status
is still in 0xc00. So seems some MMC card cannot meet its CSD
guaranteed write response timeout value. Increase this timeout value
from host driver side. If the increasing cannot workaround the timeout
error totally, the increasing can be tuned.

This increase won't impact performance. Host controller only use
this value to decide how long to wait before generate a data timeout
interrupt.

Change-Id: Ib1ddbb98c52649778d0a071acdeef91d2b3f63d9

Change-Id: Iddae9353fd7708cfbac0cb599433757036adc71f
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Reviewed-on: http://android.intel.com:8080/35375
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/mmc/core/core.c

index f96f03a..af4b5d9 100644 (file)
@@ -571,6 +571,23 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
        data->timeout_clks = card->csd.tacc_clks * mult;
 
        /*
+        * Some MMC card also cannot meet their CSD guaranteed write response
+        * time. Some Medfield boards has been observed -110 timeout issue and
+        * MMC card status is 0xc00 when timeout error happens. This error is
+        * only observed with write command.
+        * Increase MMC card timeout value to workaround this.
+        * This change should not impact performance.
+        */
+       if ((data->flags & MMC_DATA_WRITE) && mmc_card_mmc(card)) {
+               /*
+                * This is a expirence value, and can be tuninged if this
+                * timeout value is still not encough
+                */
+               data->timeout_ns *= 4;
+               data->timeout_clks *= 4;
+       }
+
+       /*
         * SD cards also have an upper limit on the timeout.
         */
        if (mmc_card_sd(card)) {