diff mbox series

[v2,05/11] mmc: add a hs400_tuning flag

Message ID 20200717085024.19385-6-yangbo.lu@nxp.com
State Superseded
Delegated to: Peng Fan
Headers show
Series mmc: fsl_esdhc: support eMMC HS200/HS400 modes | expand

Commit Message

Yangbo Lu July 17, 2020, 8:50 a.m. UTC
Add a hs400_tuning flag to identify the tuning for HS400 mode.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
	- None.
---
 drivers/mmc/mmc.c | 2 ++
 include/mmc.h     | 1 +
 2 files changed, 3 insertions(+)

Comments

Peng Fan July 20, 2020, 1:36 a.m. UTC | #1
> Subject: [v2, 05/11] mmc: add a hs400_tuning flag
> 
> Add a hs400_tuning flag to identify the tuning for HS400 mode.

Why? Please explain a bit more.

Thanks,
Peng.

> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
> Changes for v2:
> 	- None.
> ---
>  drivers/mmc/mmc.c | 2 ++
>  include/mmc.h     | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
> a53f93a..a18e75d 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1976,7 +1976,9 @@ static int mmc_select_hs400(struct mmc *mmc)
>  	mmc_set_clock(mmc, mmc->tran_speed, false);
> 
>  	/* execute tuning if needed */
> +	mmc->hs400_tuning = 1;
>  	err = mmc_execute_tuning(mmc,
> MMC_CMD_SEND_TUNING_BLOCK_HS200);
> +	mmc->hs400_tuning = 0;
>  	if (err) {
>  		debug("tuning failed\n");
>  		return err;
> diff --git a/include/mmc.h b/include/mmc.h index 161b8bc..2399cc2 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -707,6 +707,7 @@ struct mmc {
>  				  * accessing the boot partitions
>  				  */
>  	u32 quirks;
> +	u8 hs400_tuning;
>  };
> 
>  struct mmc_hwpart_conf {
> --
> 2.7.4
Yangbo Lu July 20, 2020, 7:30 a.m. UTC | #2
Hi Peng,

> -----Original Message-----
> From: Peng Fan <peng.fan@nxp.com>
> Sent: Monday, July 20, 2020 9:37 AM
> To: Y.b. Lu <yangbo.lu@nxp.com>; u-boot@lists.denx.de; Priyanka Jain
> <priyanka.jain@nxp.com>; 'Jaehoon Chung' <jh80.chung@samsung.com>
> Cc: Y.b. Lu <yangbo.lu@nxp.com>
> Subject: RE: [v2, 05/11] mmc: add a hs400_tuning flag
> 
> > Subject: [v2, 05/11] mmc: add a hs400_tuning flag
> >
> > Add a hs400_tuning flag to identify the tuning for HS400 mode.
> 
> Why? Please explain a bit more.

Some specific controllers may have difference between HS400 tuning and HS200 tuning.
For eSDHC, as you saw in my patch #7, and there are also some eSDHC errata related to HS400 tuning which I will upstream patches in the future.
In kernel drivers/mmc/host/sdhci.c, there is a flag SDHCI_HS400_TUNING used by sdhci-msm.c and sdhci-of-esdhc.c for specific handling.
I will explain more in commit message.

> 
> Thanks,
> Peng.
> 
> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> > Changes for v2:
> > 	- None.
> > ---
> >  drivers/mmc/mmc.c | 2 ++
> >  include/mmc.h     | 1 +
> >  2 files changed, 3 insertions(+)
> >
> > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
> > a53f93a..a18e75d 100644
> > --- a/drivers/mmc/mmc.c
> > +++ b/drivers/mmc/mmc.c
> > @@ -1976,7 +1976,9 @@ static int mmc_select_hs400(struct mmc *mmc)
> >  	mmc_set_clock(mmc, mmc->tran_speed, false);
> >
> >  	/* execute tuning if needed */
> > +	mmc->hs400_tuning = 1;
> >  	err = mmc_execute_tuning(mmc,
> > MMC_CMD_SEND_TUNING_BLOCK_HS200);
> > +	mmc->hs400_tuning = 0;
> >  	if (err) {
> >  		debug("tuning failed\n");
> >  		return err;
> > diff --git a/include/mmc.h b/include/mmc.h index 161b8bc..2399cc2 100644
> > --- a/include/mmc.h
> > +++ b/include/mmc.h
> > @@ -707,6 +707,7 @@ struct mmc {
> >  				  * accessing the boot partitions
> >  				  */
> >  	u32 quirks;
> > +	u8 hs400_tuning;
> >  };
> >
> >  struct mmc_hwpart_conf {
> > --
> > 2.7.4
diff mbox series

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index a53f93a..a18e75d 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1976,7 +1976,9 @@  static int mmc_select_hs400(struct mmc *mmc)
 	mmc_set_clock(mmc, mmc->tran_speed, false);
 
 	/* execute tuning if needed */
+	mmc->hs400_tuning = 1;
 	err = mmc_execute_tuning(mmc, MMC_CMD_SEND_TUNING_BLOCK_HS200);
+	mmc->hs400_tuning = 0;
 	if (err) {
 		debug("tuning failed\n");
 		return err;
diff --git a/include/mmc.h b/include/mmc.h
index 161b8bc..2399cc2 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -707,6 +707,7 @@  struct mmc {
 				  * accessing the boot partitions
 				  */
 	u32 quirks;
+	u8 hs400_tuning;
 };
 
 struct mmc_hwpart_conf {