[PATCH 05/12] mmc: sdhci: add a pre voltage switch callback function
From: Gregory CLEMENT <hidden>
Date: 2016-06-14 07:59:52
Also in:
linux-devicetree, linux-mmc
Hi Adrian, On lun., juin 13 2016, Adrian Hunter [off-list ref] wrote:
On 09/06/16 10:10, Gregory CLEMENT wrote:quoted
From: Victor Gu <redacted> Some host controller such as Xenon needs additional setting when switching signal voltage in eMMC mode. They also need to re-enable internal clock before a voltage switch. This commit adds a callback routine "voltage_switch_pre" in the struct sdhci_ops, which is used by some host controllers which need re-enable the internal clock before a voltage switch.Don't want to add sdhci host ops for the "do something before a mmc host op" case. Instead, export sdhci_start_signal_voltage_switch() and hook host->mmc_host_ops.start_signal_voltage_switch. Then in sdhci-xenon.c: int xenon__start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) { blah blah return sdhci_start_signal_voltage_switch(mmc, ios); }
OK I see your point. Thanks, Gregory
quoted
[gregory.clement at free-electrons.com: split the initial commit and reformulate the log] Signed-off-by: Victor Gu <redacted> Signed-off-by: Marcin Wojtas <redacted> Signed-off-by: Gregory CLEMENT <redacted> --- drivers/mmc/host/sdhci.c | 4 ++++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 5 insertions(+)diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index b07219426d39..cad03ffa9d9b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c@@ -1729,6 +1729,10 @@ static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, if (host->version < SDHCI_SPEC_300) return 0; + /* Some controller need to do more before switching */ + if (host->ops->voltage_switch_pre) + host->ops->voltage_switch_pre(host); + ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); switch (ios->signal_voltage) {diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 49c6c5b0e33b..6bec1b0368d2 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h@@ -550,6 +550,7 @@ struct sdhci_ops { unsigned int max_dtr, int host_drv, int card_drv, int *drv_type); void (*init_card)(struct sdhci_host *host, struct mmc_card *card); + void (*voltage_switch_pre)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
-- Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com