Commit 1d8cd065 authored by Sowjanya Komatineni's avatar Sowjanya Komatineni Committed by Ulf Hansson

mmc: sdhci: allow host to specify maximum tuning loops

As per the Host Controller Standard Specification Version 4.20,
limitation of tuning iteration count is removed as PLL locking
time can be longer than UHS-1 tuning due to larger PVT fluctuation
and it will result in increase of tuning iteration to complete the
tuning.

This patch creates sdhci_host member tuning_loop_count to allow
hosts to specify maximum tuning iterations and also updates
execute_tuning to use this specified maximum tuning iteration count.

Default tuning_loop_count is set to same as existing loop count of
MAX_TUNING_LOOP which is 40 iterations.
Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarSowjanya Komatineni <skomatineni@nvidia.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 92cd1667
...@@ -2369,9 +2369,9 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) ...@@ -2369,9 +2369,9 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
/* /*
* Issue opcode repeatedly till Execute Tuning is set to 0 or the number * Issue opcode repeatedly till Execute Tuning is set to 0 or the number
* of loops reaches 40 times. * of loops reaches tuning loop count.
*/ */
for (i = 0; i < MAX_TUNING_LOOP; i++) { for (i = 0; i < host->tuning_loop_count; i++) {
u16 ctrl; u16 ctrl;
sdhci_send_tuning(host, opcode); sdhci_send_tuning(host, opcode);
...@@ -3494,6 +3494,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, ...@@ -3494,6 +3494,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
host->cqe_err_ier = SDHCI_CQE_INT_ERR_MASK; host->cqe_err_ier = SDHCI_CQE_INT_ERR_MASK;
host->tuning_delay = -1; host->tuning_delay = -1;
host->tuning_loop_count = MAX_TUNING_LOOP;
host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG; host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG;
......
...@@ -596,6 +596,7 @@ struct sdhci_host { ...@@ -596,6 +596,7 @@ struct sdhci_host {
#define SDHCI_TUNING_MODE_3 2 #define SDHCI_TUNING_MODE_3 2
/* Delay (ms) between tuning commands */ /* Delay (ms) between tuning commands */
int tuning_delay; int tuning_delay;
int tuning_loop_count;
/* Host SDMA buffer boundary. */ /* Host SDMA buffer boundary. */
u32 sdma_boundary; u32 sdma_boundary;
......
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