[U-Boot] [PATCH 03/12] mmc: sdhci: Add support for platform/board specific tuning

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Wed Jan 18 10:04:22 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>
---
 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 5ae56e0..7b968d5 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 4d877eb..ae19be6 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -249,6 +249,7 @@ struct sdhci_ops {
 	int	(*get_cd)(struct sdhci_host *host);
 	void	(*set_control_reg)(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