diff mbox series

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

Message ID 20200723043016.6497-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 23, 2020, 4:30 a.m. UTC
Some controllers may have difference between HS200 tuning
and HS400 tuning, such as different registers setting,
different procedure, or different errata.

This patch is to 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.
Changes for v3:
	- Explained more in commit messages.
---
 drivers/mmc/mmc.c | 2 ++
 include/mmc.h     | 1 +
 2 files changed, 3 insertions(+)

Comments

Jaehoon Chung Aug. 24, 2020, 10:54 p.m. UTC | #1
On 7/23/20 1:30 PM, Yangbo Lu wrote:
> Some controllers may have difference between HS200 tuning
> and HS400 tuning, such as different registers setting,
> different procedure, or different errata.
> 
> This patch is to 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.
> Changes for v3:
> 	- Explained more in commit messages.
> ---
>  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 a4c6153..f020a8e 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1981,7 +1981,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;

It seems that it's fsl_esdhc specific flag. Is it need to set to 0?

Best Regards,
Jaehoon Chung

>  	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 {
>
Yangbo Lu Aug. 25, 2020, 3:59 a.m. UTC | #2
Hi Jaehoon,

> -----Original Message-----
> From: Jaehoon Chung <jh80.chung@samsung.com>
> Sent: Tuesday, August 25, 2020 6:54 AM
> To: Y.b. Lu <yangbo.lu@nxp.com>; u-boot@lists.denx.de; Peng Fan
> <peng.fan@nxp.com>; Priyanka Jain <priyanka.jain@nxp.com>
> Subject: Re: [v3, 05/11] mmc: add a hs400_tuning flag
> 
> On 7/23/20 1:30 PM, Yangbo Lu wrote:
> > Some controllers may have difference between HS200 tuning
> > and HS400 tuning, such as different registers setting,
> > different procedure, or different errata.
> >
> > This patch is to 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.
> > Changes for v3:
> > 	- Explained more in commit messages.
> > ---
> >  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 a4c6153..f020a8e 100644
> > --- a/drivers/mmc/mmc.c
> > +++ b/drivers/mmc/mmc.c
> > @@ -1981,7 +1981,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;
> 
> It seems that it's fsl_esdhc specific flag. Is it need to set to 0?

From mmc driver, both HS200 and HS400 tuning are through mmc_execute_tuning(mmc, MMC_CMD_SEND_TUNING_BLOCK_HS200).
But as I commented in commit message,
    "Some controllers may have difference between HS200 tuning
    and HS400 tuning, such as different registers setting,
    different procedure, or different errata."
So we could use such flag to indicate the tuning in progress is for HS400. Set it before tuning and clean after tuning.
By now, only fsl_esdhc is using it. I can't predict whether there will be other controllers use it, but at least we need a method to identify HS400 tuning to support eSDHC HS400 currently.
There are also errata for eSDHC HS400 tuning. I will send patches in the future.
Thanks.

> 
> Best Regards,
> Jaehoon Chung
> 
> >  	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 {
> >
diff mbox series

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index a4c6153..f020a8e 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1981,7 +1981,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 {