[U-Boot] [UBOOT v2 04/15] mmc: sdhci: Add support for platform/board specific tuning

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Mon Jan 30 11:38:21 CET 2017


Add support to execute platform/board specific tuning needed
for SDR104 and SDR50 UHS modes.This patch adds hook routine
to support specific tuning requirements.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
---
Changes from v1:
- None
---
 drivers/mmc/sdhci.c | 8 ++++++++
 include/sdhci.h     | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index bba2c30..a24cc15 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -309,11 +309,19 @@ static int sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
 	struct mmc_cmd cmd;
 	struct mmc_data data;
 	u32 ctrl;
+	int err;
 	u8 tuning_loop_counter = 40;
 	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;
+	}
+
 	ctrl = sdhci_readw(host, SDHCI_HOST_CTRL2);
 	ctrl |= SDHCI_CTRL_EXEC_TUNING;
 	sdhci_writew(host, ctrl, SDHCI_HOST_CTRL2);
diff --git a/include/sdhci.h b/include/sdhci.h
index fc0708c..dbe3836 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -250,6 +250,7 @@ struct sdhci_ops {
 	void	(*set_control_reg)(struct sdhci_host *host);
 	void	(*set_ios_post)(struct sdhci_host *host);
 	void	(*set_clock)(struct sdhci_host *host, u32 div);
+	int	(*platform_execute_tuning)(struct mmc *host, u8 opcode);
 };
 
 struct sdhci_host {
-- 
2.7.4



More information about the U-Boot mailing list