diff mbox series

mmc: sdhci: make DDR50 tuning optionally

Message ID 1545306356-15126-1-git-send-email-haibo.chen@nxp.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci: make DDR50 tuning optionally | expand

Commit Message

Bough Chen Dec. 20, 2018, 11:38 a.m. UTC
DDR50 tuning is optinally defined in sd 3.0 spec. For example,
i.MX uSDHC internally already uses a fixed optimized timing for
DDR50, normally does not require tuning for DDR50 mode.

So this patch make DDR50 tuning optionally and platform can claim
SDHCI_DDR50_NEEDS_TUNING to support if it wants tuning.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/mmc/host/sdhci.c | 6 +++++-
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Adrian Hunter Dec. 20, 2018, 2:01 p.m. UTC | #1
On 20/12/18 1:38 PM, BOUGH CHEN wrote:
> DDR50 tuning is optinally defined in sd 3.0 spec. For example,
> i.MX uSDHC internally already uses a fixed optimized timing for
> DDR50, normally does not require tuning for DDR50 mode.
> 
> So this patch make DDR50 tuning optionally and platform can claim
> SDHCI_DDR50_NEEDS_TUNING to support if it wants tuning.

It is optional to call sdhci_execute_tuning().  Consider
xenon_execute_tuning() for example.

> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/mmc/host/sdhci.c | 6 +++++-
>  drivers/mmc/host/sdhci.h | 1 +
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 67e43ec..144418e 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2429,9 +2429,13 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  		break;
>  
>  	case MMC_TIMING_UHS_SDR104:
> -	case MMC_TIMING_UHS_DDR50:
>  		break;
>  
> +	case MMC_TIMING_UHS_DDR50:
> +		if (host->flags & SDHCI_DDR50_NEEDS_TUNING)
> +			break;
> +		/* FALLTHROUGH */
> +
>  	case MMC_TIMING_UHS_SDR50:
>  		if (host->flags & SDHCI_SDR50_NEEDS_TUNING)
>  			break;
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 6cc9a3c..58b363b 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -506,6 +506,7 @@ struct sdhci_host {
>  #define SDHCI_REQ_USE_DMA	(1<<2)	/* Use DMA for this req. */
>  #define SDHCI_DEVICE_DEAD	(1<<3)	/* Device unresponsive */
>  #define SDHCI_SDR50_NEEDS_TUNING (1<<4)	/* SDR50 needs tuning */
> +#define SDHCI_DDR50_NEEDS_TUNING (1<<5) /* DDR50 needs tuning */
>  #define SDHCI_AUTO_CMD12	(1<<6)	/* Auto CMD12 support */
>  #define SDHCI_AUTO_CMD23	(1<<7)	/* Auto CMD23 support */
>  #define SDHCI_PV_ENABLED	(1<<8)	/* Preset value enabled */
>
Bough Chen Dec. 21, 2018, 3:15 a.m. UTC | #2
> -----Original Message-----
> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
> Sent: 2018年12月20日 22:01
> To: BOUGH CHEN <haibo.chen@nxp.com>; ulf.hansson@linaro.org
> Cc: linux-mmc@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH] mmc: sdhci: make DDR50 tuning optionally
> 
> On 20/12/18 1:38 PM, BOUGH CHEN wrote:
> > DDR50 tuning is optinally defined in sd 3.0 spec. For example, i.MX
> > uSDHC internally already uses a fixed optimized timing for DDR50,
> > normally does not require tuning for DDR50 mode.
> >
> > So this patch make DDR50 tuning optionally and platform can claim
> > SDHCI_DDR50_NEEDS_TUNING to support if it wants tuning.
> 
> It is optional to call sdhci_execute_tuning().  Consider
> xenon_execute_tuning() for example.
> 
Replace the sdhci_execute_tuning(), this seems to be reasonable, I will use this method and send a new patch.

Thanks!
Bough Chen

> >
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> >  drivers/mmc/host/sdhci.c | 6 +++++-
> >  drivers/mmc/host/sdhci.h | 1 +
> >  2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
> > 67e43ec..144418e 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -2429,9 +2429,13 @@ int sdhci_execute_tuning(struct mmc_host
> *mmc, u32 opcode)
> >  		break;
> >
> >  	case MMC_TIMING_UHS_SDR104:
> > -	case MMC_TIMING_UHS_DDR50:
> >  		break;
> >
> > +	case MMC_TIMING_UHS_DDR50:
> > +		if (host->flags & SDHCI_DDR50_NEEDS_TUNING)
> > +			break;
> > +		/* FALLTHROUGH */
> > +
> >  	case MMC_TIMING_UHS_SDR50:
> >  		if (host->flags & SDHCI_SDR50_NEEDS_TUNING)
> >  			break;
> > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index
> > 6cc9a3c..58b363b 100644
> > --- a/drivers/mmc/host/sdhci.h
> > +++ b/drivers/mmc/host/sdhci.h
> > @@ -506,6 +506,7 @@ struct sdhci_host {
> >  #define SDHCI_REQ_USE_DMA	(1<<2)	/* Use DMA for this req. */
> >  #define SDHCI_DEVICE_DEAD	(1<<3)	/* Device unresponsive */
> >  #define SDHCI_SDR50_NEEDS_TUNING (1<<4)	/* SDR50 needs tuning
> */
> > +#define SDHCI_DDR50_NEEDS_TUNING (1<<5) /* DDR50 needs tuning */
> >  #define SDHCI_AUTO_CMD12	(1<<6)	/* Auto CMD12 support */
> >  #define SDHCI_AUTO_CMD23	(1<<7)	/* Auto CMD23 support */
> >  #define SDHCI_PV_ENABLED	(1<<8)	/* Preset value enabled */
> >
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 67e43ec..144418e 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2429,9 +2429,13 @@  int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		break;
 
 	case MMC_TIMING_UHS_SDR104:
-	case MMC_TIMING_UHS_DDR50:
 		break;
 
+	case MMC_TIMING_UHS_DDR50:
+		if (host->flags & SDHCI_DDR50_NEEDS_TUNING)
+			break;
+		/* FALLTHROUGH */
+
 	case MMC_TIMING_UHS_SDR50:
 		if (host->flags & SDHCI_SDR50_NEEDS_TUNING)
 			break;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 6cc9a3c..58b363b 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -506,6 +506,7 @@  struct sdhci_host {
 #define SDHCI_REQ_USE_DMA	(1<<2)	/* Use DMA for this req. */
 #define SDHCI_DEVICE_DEAD	(1<<3)	/* Device unresponsive */
 #define SDHCI_SDR50_NEEDS_TUNING (1<<4)	/* SDR50 needs tuning */
+#define SDHCI_DDR50_NEEDS_TUNING (1<<5) /* DDR50 needs tuning */
 #define SDHCI_AUTO_CMD12	(1<<6)	/* Auto CMD12 support */
 #define SDHCI_AUTO_CMD23	(1<<7)	/* Auto CMD23 support */
 #define SDHCI_PV_ENABLED	(1<<8)	/* Preset value enabled */