Commit 7d8bb1f4 authored by Yinbo Zhu's avatar Yinbo Zhu Committed by Ulf Hansson

mmc: sdhci: add tuning error codes

This patch is to add tuning error codes to
judge tuning state
Signed-off-by: default avatarYinbo Zhu <yinbo.zhu@nxp.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 3fd784f7
...@@ -2219,7 +2219,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) ...@@ -2219,7 +2219,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode)
} }
EXPORT_SYMBOL_GPL(sdhci_send_tuning); EXPORT_SYMBOL_GPL(sdhci_send_tuning);
static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
{ {
int i; int i;
...@@ -2236,13 +2236,13 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) ...@@ -2236,13 +2236,13 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
pr_info("%s: Tuning timeout, falling back to fixed sampling clock\n", pr_info("%s: Tuning timeout, falling back to fixed sampling clock\n",
mmc_hostname(host->mmc)); mmc_hostname(host->mmc));
sdhci_abort_tuning(host, opcode); sdhci_abort_tuning(host, opcode);
return; return -ETIMEDOUT;
} }
ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) { if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) {
if (ctrl & SDHCI_CTRL_TUNED_CLK) if (ctrl & SDHCI_CTRL_TUNED_CLK)
return; /* Success! */ return 0; /* Success! */
break; break;
} }
...@@ -2254,6 +2254,7 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) ...@@ -2254,6 +2254,7 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
pr_info("%s: Tuning failed, falling back to fixed sampling clock\n", pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",
mmc_hostname(host->mmc)); mmc_hostname(host->mmc));
sdhci_reset_tuning(host); sdhci_reset_tuning(host);
return -EAGAIN;
} }
int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
...@@ -2315,7 +2316,7 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) ...@@ -2315,7 +2316,7 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
sdhci_start_tuning(host); sdhci_start_tuning(host);
__sdhci_execute_tuning(host, opcode); host->tuning_err = __sdhci_execute_tuning(host, opcode);
sdhci_end_tuning(host); sdhci_end_tuning(host);
out: out:
......
...@@ -554,6 +554,7 @@ struct sdhci_host { ...@@ -554,6 +554,7 @@ struct sdhci_host {
unsigned int tuning_count; /* Timer count for re-tuning */ unsigned int tuning_count; /* Timer count for re-tuning */
unsigned int tuning_mode; /* Re-tuning mode supported by host */ unsigned int tuning_mode; /* Re-tuning mode supported by host */
unsigned int tuning_err; /* Error code for re-tuning */
#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
......
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