]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: sdhci: execute tuning when device is not busy
authorYi Sun <yi.y.sun@intel.com>
Tue, 9 Sep 2014 02:13:59 +0000 (02:13 +0000)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 24 Sep 2014 09:03:17 +0000 (11:03 +0200)
We find tuning timeout because of the secure erase operation lasts too
long, so don't do tuning when device is busy.

Signed-off-by: Yi Sun <yi.y.sun@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h

index db113aba35d0dfd89d2de33a6c6c909a2728396d..cbd433712756b1704e7cba3d68228e96a231bad1 100644 (file)
@@ -1366,11 +1366,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
                /*
                 * Check if the re-tuning timer has already expired and there
-                * is no on-going data transfer. If so, we need to execute
-                * tuning procedure before sending command.
+                * is no on-going data transfer and DAT0 is not busy. If so,
+                * we need to execute tuning procedure before sending command.
                 */
                if ((host->flags & SDHCI_NEEDS_RETUNING) &&
-                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
+                   !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ)) &&
+                   (present_state & SDHCI_DATA_0_LVL_MASK)) {
                        if (mmc->card) {
                                /* eMMC uses cmd21 but sd and sdio use cmd19 */
                                tuning_opcode =
index 9828ff83d84c028602d24f72d5b20d0413f959a9..31896a779d4ed07834026743ac9d87ad917bebb8 100644 (file)
@@ -72,6 +72,7 @@
 #define  SDHCI_WRITE_PROTECT   0x00080000
 #define  SDHCI_DATA_LVL_MASK   0x00F00000
 #define   SDHCI_DATA_LVL_SHIFT 20
+#define   SDHCI_DATA_0_LVL_MASK        0x00100000
 
 #define SDHCI_HOST_CONTROL     0x28
 #define  SDHCI_CTRL_LED                0x01