Commit 83b600b8 authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: sdhci: Control the delay between tuning commands

The delay between tuning commands for SD cards is not part of the
specification. A driver that needs it probably needs it for eMMC
too, whereas most drivers would probably like to set it to 0. Make
it a host member (host->tuning_delay) that defaults to the existing
behaviour. Drivers can set it to zero to eliminate the delay, or
set it to a positive value to always have a delay.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ba49cbd0
...@@ -2108,9 +2108,9 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) ...@@ -2108,9 +2108,9 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
break; break;
} }
/* eMMC spec does not require a delay between tuning cycles */ /* Spec does not require a delay between tuning cycles */
if (opcode == MMC_SEND_TUNING_BLOCK) if (host->tuning_delay > 0)
mdelay(1); mdelay(host->tuning_delay);
} }
pr_info("%s: Tuning failed, falling back to fixed sampling clock\n", pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",
...@@ -2172,6 +2172,9 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) ...@@ -2172,6 +2172,9 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
host->mmc->retune_period = tuning_count; host->mmc->retune_period = tuning_count;
if (host->tuning_delay < 0)
host->tuning_delay = opcode == MMC_SEND_TUNING_BLOCK;
sdhci_start_tuning(host); sdhci_start_tuning(host);
__sdhci_execute_tuning(host, opcode); __sdhci_execute_tuning(host, opcode);
...@@ -3114,6 +3117,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, ...@@ -3114,6 +3117,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
host->cqe_ier = SDHCI_CQE_INT_MASK; host->cqe_ier = SDHCI_CQE_INT_MASK;
host->cqe_err_ier = SDHCI_CQE_INT_ERR_MASK; host->cqe_err_ier = SDHCI_CQE_INT_ERR_MASK;
host->tuning_delay = -1;
return host; return host;
} }
......
...@@ -538,6 +538,8 @@ struct sdhci_host { ...@@ -538,6 +538,8 @@ struct sdhci_host {
#define SDHCI_TUNING_MODE_1 0 #define SDHCI_TUNING_MODE_1 0
#define SDHCI_TUNING_MODE_2 1 #define SDHCI_TUNING_MODE_2 1
#define SDHCI_TUNING_MODE_3 2 #define SDHCI_TUNING_MODE_3 2
/* Delay (ms) between tuning commands */
int tuning_delay;
unsigned long private[0] ____cacheline_aligned; unsigned long private[0] ____cacheline_aligned;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment