summaryrefslogtreecommitdiff
path: root/drivers/mmc/sdhci.c
diff options
context:
space:
mode:
authorSiva Durga Prasad Paladugu <sivadur@xilinx.com>2018-04-19 12:37:07 +0530
committerMichal Simek <michal.simek@xilinx.com>2018-05-11 09:38:27 +0200
commitca992e82e4e3428db0809303ebb9b696a77fa189 (patch)
tree14c6b99739accc61f1a11518c78af6ceaf0e8598 /drivers/mmc/sdhci.c
parent2fc3ed5d06121ab47e45127fc534881ed3be235d (diff)
mmc: sdhci: Invoke platform specific tuning and delay routines
This patch adds support to invoke any platform specific tuning and delay routines if available. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r--drivers/mmc/sdhci.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index d92f6db374..efc5a62e61 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -305,6 +305,24 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
return -ECOMM;
}
+#if defined(CONFIG_DM_MMC) && defined(MMC_SUPPORTS_TUNING)
+static int sdhci_execute_tuning(struct udevice *dev, uint opcode)
+{
+ int err;
+ struct mmc *mmc = mmc_get_mmc_dev(dev);
+ struct sdhci_host *host = mmc->priv;
+
+ debug("%s\n", __func__);
+
+ if (host->ops->platform_execute_tuning) {
+ err = host->ops->platform_execute_tuning(mmc, opcode);
+ if (err)
+ return err;
+ return 0;
+ }
+ return 0;
+}
+#endif
static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
{
struct sdhci_host *host = mmc->priv;
@@ -329,6 +347,9 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
if (clock == 0)
return 0;
+ if (host->ops->set_delay)
+ host->ops->set_delay(host);
+
if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
/*
* Check if the Host Controller supports Programmable Clock
@@ -521,6 +542,9 @@ int sdhci_probe(struct udevice *dev)
const struct dm_mmc_ops sdhci_ops = {
.send_cmd = sdhci_send_command,
.set_ios = sdhci_set_ios,
+#ifdef MMC_SUPPORTS_TUNING
+ .execute_tuning = sdhci_execute_tuning,
+#endif
};
#else
static const struct mmc_ops sdhci_ops = {