diff mbox

[RFC,3/7] mmc: sdhci: Add callback to set bus mode

Message ID 20170807160142.12134-4-kishon@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kishon Vijay Abraham I Aug. 7, 2017, 4:01 p.m. UTC
Add callback to set bus mode in sdhci library so that the
controller driver can perform any bus mode specific configurations
in the callback function.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 4 insertions(+)

Comments

Adrian Hunter Aug. 15, 2017, 7:38 a.m. UTC | #1
On 07/08/17 19:01, Kishon Vijay Abraham I wrote:
> Add callback to set bus mode in sdhci library so that the
> controller driver can perform any bus mode specific configurations
> in the callback function.

A quirk isn't needed.  Just hook ->set_ios() e.g.

	host->mmc_host_ops.set_ios = sdhci_omap_set_ios;

Then sdhci_omap_set_ios() can call sdhci_set_ios() and then do the bus mode
setting.

> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.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 fff0baadbc3e..d5050ec42481 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1747,6 +1747,9 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  	if (host->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
>  		sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
>  
> +	if (host->ops->set_bus_mode)
> +		host->ops->set_bus_mode(host, ios->bus_mode);
> +
>  	mmiowb();
>  }
>  EXPORT_SYMBOL_GPL(sdhci_set_ios);
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index d778034e324d..39c7a2723906 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -583,6 +583,7 @@ struct sdhci_ops {
>  	void    (*adma_workaround)(struct sdhci_host *host, u32 intmask);
>  	void    (*card_event)(struct sdhci_host *host);
>  	void	(*voltage_switch)(struct sdhci_host *host);
> +	void	(*set_bus_mode)(struct sdhci_host *host, unsigned int mode);
>  };
>  
>  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kishon Vijay Abraham I Aug. 17, 2017, 5:31 a.m. UTC | #2
Adrian,

On Tuesday 15 August 2017 01:08 PM, Adrian Hunter wrote:
> On 07/08/17 19:01, Kishon Vijay Abraham I wrote:
>> Add callback to set bus mode in sdhci library so that the
>> controller driver can perform any bus mode specific configurations
>> in the callback function.
> 
> A quirk isn't needed.  Just hook ->set_ios() e.g.
> 
> 	host->mmc_host_ops.set_ios = sdhci_omap_set_ios;
> 
> Then sdhci_omap_set_ios() can call sdhci_set_ios() and then do the bus mode
> setting.

I'm not adding a quirk here.. but I got your point.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" 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 fff0baadbc3e..d5050ec42481 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1747,6 +1747,9 @@  void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	if (host->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
 		sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
 
+	if (host->ops->set_bus_mode)
+		host->ops->set_bus_mode(host, ios->bus_mode);
+
 	mmiowb();
 }
 EXPORT_SYMBOL_GPL(sdhci_set_ios);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d778034e324d..39c7a2723906 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -583,6 +583,7 @@  struct sdhci_ops {
 	void    (*adma_workaround)(struct sdhci_host *host, u32 intmask);
 	void    (*card_event)(struct sdhci_host *host);
 	void	(*voltage_switch)(struct sdhci_host *host);
+	void	(*set_bus_mode)(struct sdhci_host *host, unsigned int mode);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS