[2/2] mmc: sdhci: add delay after the last tuning command
diff mbox series

Message ID 20181228084327.9664-2-haibo.chen@nxp.com
State New
Headers show
Series
  • [1/2] mmc: sdhci-esdhc-imx: add delay between tuning cycles
Related show

Commit Message

BOUGH CHEN Dec. 28, 2018, 8:35 a.m. UTC
When host set the host->tuning_delay, even the last tuning
command need a delay, otherwise the first command after the
tuning will meet issue.

Take i.MX7D as an example, there will be the following log:
  mmc2: switch to high-speed from hs200 failed, err:-110
  mmc2: error -110 whilst initialising MMC card

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/mmc/host/sdhci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Adrian Hunter Dec. 28, 2018, 9:17 a.m. UTC | #1
On 28/12/18 10:35 AM, BOUGH CHEN wrote:
> When host set the host->tuning_delay, even the last tuning
> command need a delay, otherwise the first command after the
> tuning will meet issue.
> 
> Take i.MX7D as an example, there will be the following log:
>   mmc2: switch to high-speed from hs200 failed, err:-110
>   mmc2: error -110 whilst initialising MMC card
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a22e11a65658..6af09740ca59 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2376,6 +2376,10 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
>  			return -ETIMEDOUT;
>  		}
>  
> +		/* Spec does not require a delay between tuning cycles */
> +		if (host->tuning_delay > 0)
> +			mdelay(host->tuning_delay);
> +
>  		ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
>  		if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) {
>  			if (ctrl & SDHCI_CTRL_TUNED_CLK)
> @@ -2383,9 +2387,6 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
>  			break;
>  		}
>  
> -		/* Spec does not require a delay between tuning cycles */
> -		if (host->tuning_delay > 0)
> -			mdelay(host->tuning_delay);
>  	}
>  
>  	pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",
>
Ulf Hansson Jan. 14, 2019, 11:44 a.m. UTC | #2
On Fri, 28 Dec 2018 at 09:35, BOUGH CHEN <haibo.chen@nxp.com> wrote:
>
> When host set the host->tuning_delay, even the last tuning
> command need a delay, otherwise the first command after the
> tuning will meet issue.
>
> Take i.MX7D as an example, there will be the following log:
>   mmc2: switch to high-speed from hs200 failed, err:-110
>   mmc2: error -110 whilst initialising MMC card
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a22e11a65658..6af09740ca59 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2376,6 +2376,10 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
>                         return -ETIMEDOUT;
>                 }
>
> +               /* Spec does not require a delay between tuning cycles */
> +               if (host->tuning_delay > 0)
> +                       mdelay(host->tuning_delay);
> +
>                 ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
>                 if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) {
>                         if (ctrl & SDHCI_CTRL_TUNED_CLK)
> @@ -2383,9 +2387,6 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
>                         break;
>                 }
>
> -               /* Spec does not require a delay between tuning cycles */
> -               if (host->tuning_delay > 0)
> -                       mdelay(host->tuning_delay);
>         }
>
>         pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",
> --
> 2.17.1
>

Patch
diff mbox series

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a22e11a65658..6af09740ca59 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2376,6 +2376,10 @@  static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
 			return -ETIMEDOUT;
 		}
 
+		/* Spec does not require a delay between tuning cycles */
+		if (host->tuning_delay > 0)
+			mdelay(host->tuning_delay);
+
 		ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 		if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) {
 			if (ctrl & SDHCI_CTRL_TUNED_CLK)
@@ -2383,9 +2387,6 @@  static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
 			break;
 		}
 
-		/* Spec does not require a delay between tuning cycles */
-		if (host->tuning_delay > 0)
-			mdelay(host->tuning_delay);
 	}
 
 	pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",