public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] mmc: fsl_esdhc: Fix i.MX53 eSDHCv3 clock
@ 2018-01-16 21:44 ` Benoît Thébaudeau
  2018-01-22  5:17   ` Jaehoon Chung
  0 siblings, 1 reply; 2+ messages in thread
From: Benoît Thébaudeau @ 2018-01-16 21:44 UTC (permalink / raw)
  To: u-boot

Commit 4f425280fa71 ("mmc: fsl_esdhc: Allow all supported prescaler
values") made it possible to set SYSCTL.SDCLKFS to 0 in SDR mode on
i.MX, thus bypassing the SD clock frequency prescaler, in order to be
able to get higher SD clock frequencies in some contexts. However, that
commit missed the fact that this value is illegal on the eSDHCv3
instance of the i.MX53. This seems to be the only exception on i.MX,
this value being legal even for the eSDHCv2 instances of the i.MX53.

Fix this issue by changing the minimum prescaler value for the single
instance of the i.MX53 eSDHCv3 controller.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes for v2:
 - Surround == with parentheses for clarity (suggested by Stefano).
---
 drivers/mmc/fsl_esdhc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 499d622c6d..5b6042c22c 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -528,14 +528,19 @@ out:
 
 static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
 {
+	struct fsl_esdhc *regs = priv->esdhc_regs;
 	int div = 1;
 #ifdef ARCH_MXC
+#ifdef CONFIG_MX53
+	/* For i.MX53 eSDHCv3, SYSCTL.SDCLKFS may not be set to 0. */
+	int pre_div = (regs == (struct fsl_esdhc *)MMC_SDHC3_BASE_ADDR) ? 2 : 1;
+#else
 	int pre_div = 1;
+#endif
 #else
 	int pre_div = 2;
 #endif
 	int ddr_pre_div = mmc->ddr_mode ? 2 : 1;
-	struct fsl_esdhc *regs = priv->esdhc_regs;
 	int sdhc_clk = priv->sdhc_clk;
 	uint clk;
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH v2] mmc: fsl_esdhc: Fix i.MX53 eSDHCv3 clock
  2018-01-16 21:44 ` [U-Boot] [PATCH v2] mmc: fsl_esdhc: Fix i.MX53 eSDHCv3 clock Benoît Thébaudeau
@ 2018-01-22  5:17   ` Jaehoon Chung
  0 siblings, 0 replies; 2+ messages in thread
From: Jaehoon Chung @ 2018-01-22  5:17 UTC (permalink / raw)
  To: u-boot

On 01/17/2018 06:44 AM, Benoît Thébaudeau wrote:
> Commit 4f425280fa71 ("mmc: fsl_esdhc: Allow all supported prescaler
> values") made it possible to set SYSCTL.SDCLKFS to 0 in SDR mode on
> i.MX, thus bypassing the SD clock frequency prescaler, in order to be
> able to get higher SD clock frequencies in some contexts. However, that
> commit missed the fact that this value is illegal on the eSDHCv3
> instance of the i.MX53. This seems to be the only exception on i.MX,
> this value being legal even for the eSDHCv2 instances of the i.MX53.
> 
> Fix this issue by changing the minimum prescaler value for the single
> instance of the i.MX53 eSDHCv3 controller.
> 
> Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

> ---
> Changes for v2:
>  - Surround == with parentheses for clarity (suggested by Stefano).
> ---
>  drivers/mmc/fsl_esdhc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index 499d622c6d..5b6042c22c 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -528,14 +528,19 @@ out:
>  
>  static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
>  {
> +	struct fsl_esdhc *regs = priv->esdhc_regs;
>  	int div = 1;
>  #ifdef ARCH_MXC
> +#ifdef CONFIG_MX53
> +	/* For i.MX53 eSDHCv3, SYSCTL.SDCLKFS may not be set to 0. */
> +	int pre_div = (regs == (struct fsl_esdhc *)MMC_SDHC3_BASE_ADDR) ? 2 : 1;
> +#else
>  	int pre_div = 1;
> +#endif
>  #else
>  	int pre_div = 2;
>  #endif
>  	int ddr_pre_div = mmc->ddr_mode ? 2 : 1;
> -	struct fsl_esdhc *regs = priv->esdhc_regs;
>  	int sdhc_clk = priv->sdhc_clk;
>  	uint clk;
>  
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-22  5:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20180116214437epcas3p356209ca2bd194c315da76a3711c6341a@epcas3p3.samsung.com>
2018-01-16 21:44 ` [U-Boot] [PATCH v2] mmc: fsl_esdhc: Fix i.MX53 eSDHCv3 clock Benoît Thébaudeau
2018-01-22  5:17   ` Jaehoon Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox