diff mbox

[4/9] mmc: sdhci: add a callback for using tuning block

Message ID 1488448050-7574-5-git-send-email-yangbo.lu@nxp.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Yangbo Lu March 2, 2017, 9:47 a.m. UTC
Some non-standard SD host controllers may use tuning block
for executing tuning procedure.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 4 insertions(+)

Comments

Adrian Hunter March 2, 2017, 2:25 p.m. UTC | #1
On 02/03/17 11:47, Yangbo Lu wrote:
> Some non-standard SD host controllers may use tuning block
> for executing tuning procedure.

If you need to set something up before tuning, you should be able to do that
by hooking the host operation, for example see xenon_execute_tuning() in
sdhci-xenon.c

> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
>  drivers/mmc/host/sdhci.c | 3 +++
>  drivers/mmc/host/sdhci.h | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3c9a924..051b192 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2166,6 +2166,9 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  		goto out_unlock;
>  	}
>  
> +	if (host->ops->set_tuning_block)
> +		host->ops->set_tuning_block(host);
> +
>  	host->mmc->retune_period = tuning_count;
>  
>  	sdhci_start_tuning(host);
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 04af687..d43519b 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -568,6 +568,7 @@ struct sdhci_ops {
>  					 int card_drv, int *drv_type);
>  	int	(*start_signal_voltage_switch)(struct sdhci_host *host,
>  					       unsigned char signal_voltage);
> +	void	(*set_tuning_block)(struct sdhci_host *host);
>  };
>  
>  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yangbo Lu March 3, 2017, 7:39 a.m. UTC | #2
> -----Original Message-----
> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
> Sent: Thursday, March 02, 2017 10:26 PM
> To: Y.B. Lu; linux-mmc@vger.kernel.org; ulf.hansson@linaro.org; Rob
> Herring; Mark Rutland; Catalin Marinas; Will Deacon
> Cc: devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> Xiaobo Xie
> Subject: Re: [PATCH 4/9] mmc: sdhci: add a callback for using tuning
> block
> 
> On 02/03/17 11:47, Yangbo Lu wrote:
> > Some non-standard SD host controllers may use tuning block for
> > executing tuning procedure.
> 
> If you need to set something up before tuning, you should be able to do
> that by hooking the host operation, for example see xenon_execute_tuning()
> in sdhci-xenon.c
> 

[Lu Yangbo-B47093] Hi Adrian, this is very helpful. I will generate the v2 patchset with this method.
Thanks you very much!

> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> >  drivers/mmc/host/sdhci.c | 3 +++
> >  drivers/mmc/host/sdhci.h | 1 +
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
> > 3c9a924..051b192 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -2166,6 +2166,9 @@ int sdhci_execute_tuning(struct mmc_host *mmc,
> u32 opcode)
> >  		goto out_unlock;
> >  	}
> >
> > +	if (host->ops->set_tuning_block)
> > +		host->ops->set_tuning_block(host);
> > +
> >  	host->mmc->retune_period = tuning_count;
> >
> >  	sdhci_start_tuning(host);
> > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index
> > 04af687..d43519b 100644
> > --- a/drivers/mmc/host/sdhci.h
> > +++ b/drivers/mmc/host/sdhci.h
> > @@ -568,6 +568,7 @@ struct sdhci_ops {
> >  					 int card_drv, int *drv_type);
> >  	int	(*start_signal_voltage_switch)(struct sdhci_host *host,
> >  					       unsigned char signal_voltage);
> > +	void	(*set_tuning_block)(struct sdhci_host *host);
> >  };
> >
> >  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> >

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3c9a924..051b192 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2166,6 +2166,9 @@  int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		goto out_unlock;
 	}
 
+	if (host->ops->set_tuning_block)
+		host->ops->set_tuning_block(host);
+
 	host->mmc->retune_period = tuning_count;
 
 	sdhci_start_tuning(host);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 04af687..d43519b 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -568,6 +568,7 @@  struct sdhci_ops {
 					 int card_drv, int *drv_type);
 	int	(*start_signal_voltage_switch)(struct sdhci_host *host,
 					       unsigned char signal_voltage);
+	void	(*set_tuning_block)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS