diff mbox series

mmc: sdhci-esdhc-imx: clear ESDHC_STD_TUNING_EN for manual tuning method

Message ID 1545307511-15362-1-git-send-email-haibo.chen@nxp.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci-esdhc-imx: clear ESDHC_STD_TUNING_EN for manual tuning method | expand

Commit Message

Bough Chen Dec. 20, 2018, 11:57 a.m. UTC
The bit ESDHC_STD_TUNING_EN may be configed by bootloader code if it
choose to use standard tuning method. So on linux side, if choose to
use manual tuning method, need to clear the bit ESDHC_STD_TUNING_EN,
remove the impact of bootloader code.

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

Comments

Adrian Hunter Dec. 27, 2018, 8:09 a.m. UTC | #1
On 20/12/18 1:57 PM, BOUGH CHEN wrote:
> The bit ESDHC_STD_TUNING_EN may be configed by bootloader code if it
> choose to use standard tuning method. So on linux side, if choose to
> use manual tuning method, need to clear the bit ESDHC_STD_TUNING_EN,
> remove the impact of bootloader code.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

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

> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 75a2484..4b7bf07 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1137,6 +1137,15 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
>  					<< ESDHC_TUNING_STEP_SHIFT;
>  			}
>  			writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
> +		} else if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) {
> +			/*
> +			 * ESDHC_STD_TUNING_EN may be configed in bootloader
> +			 * or ROM code, so clear this bit here to make sure
> +			 * the manual tuning can work.
> +			 */
> +			tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL);
> +			tmp &= ~ESDHC_STD_TUNING_EN;
> +			writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
>  		}
>  	}
>  }
>
Ulf Hansson Jan. 14, 2019, 11:43 a.m. UTC | #2
On Thu, 20 Dec 2018 at 12:57, BOUGH CHEN <haibo.chen@nxp.com> wrote:
>
> The bit ESDHC_STD_TUNING_EN may be configed by bootloader code if it
> choose to use standard tuning method. So on linux side, if choose to
> use manual tuning method, need to clear the bit ESDHC_STD_TUNING_EN,
> remove the impact of bootloader code.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 75a2484..4b7bf07 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1137,6 +1137,15 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
>                                         << ESDHC_TUNING_STEP_SHIFT;
>                         }
>                         writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
> +               } else if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) {
> +                       /*
> +                        * ESDHC_STD_TUNING_EN may be configed in bootloader
> +                        * or ROM code, so clear this bit here to make sure
> +                        * the manual tuning can work.
> +                        */
> +                       tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL);
> +                       tmp &= ~ESDHC_STD_TUNING_EN;
> +                       writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
>                 }
>         }
>  }
> --
> 1.9.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 75a2484..4b7bf07 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1137,6 +1137,15 @@  static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
 					<< ESDHC_TUNING_STEP_SHIFT;
 			}
 			writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
+		} else if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) {
+			/*
+			 * ESDHC_STD_TUNING_EN may be configed in bootloader
+			 * or ROM code, so clear this bit here to make sure
+			 * the manual tuning can work.
+			 */
+			tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL);
+			tmp &= ~ESDHC_STD_TUNING_EN;
+			writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
 		}
 	}
 }