[U-Boot] [UBOOT v2 13/15] mmc: sdhci: Update execute tuning and set clock for HS200

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


Update execute tuning and set clock to support for
HS200 mode.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
---
Changes from v1:
- Split the patch with only sdhci related changes
---
 drivers/mmc/sdhci.c | 18 +++++++++++++-----
 include/mmc.h       |  1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index c5538ab..e8d76ba 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -157,7 +157,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 	/* We shouldn't wait for data inihibit for stop commands, even
 	   though they might use busy signaling */
 	if ((cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION) ||
-	    (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK))
+	    (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK) ||
+	    (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK_HS200))
 		mask &= ~SDHCI_DATA_INHIBIT;
 
 	while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
@@ -179,7 +180,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 	mask = SDHCI_INT_RESPONSE;
 
 	/* only buffer read ready interrupt whil tuning */
-	if (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK)
+	if ((cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK) ||
+	    (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK_HS200))
 		mask = SDHCI_INT_DATA_AVAIL;
 
 	if (!(cmd->resp_type & MMC_RSP_PRESENT))
@@ -197,7 +199,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 		flags |= SDHCI_CMD_CRC;
 	if (cmd->resp_type & MMC_RSP_OPCODE)
 		flags |= SDHCI_CMD_INDEX;
-	if (data || (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK))
+	if (data || (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK) ||
+	    (cmd->cmdidx ==  MMC_CMD_SEND_TUNING_BLOCK_HS200))
 		flags |= SDHCI_CMD_DATA;
 
 	/* Set Transfer mode regarding to data flag */
@@ -405,8 +408,13 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 	if (clock == 0)
 		return 0;
 
-	if (mmc->is_uhs && host->ops->set_delay)
-		host->ops->set_delay(host, mmc->uhsmode);
+	if (((mmc->card_caps & MMC_MODE_HS200) || mmc->is_uhs) &&
+	    host->ops->set_delay) {
+		if (mmc->is_uhs)
+			host->ops->set_delay(host, mmc->uhsmode);
+		else
+			host->ops->set_delay(host, MMC_TIMING_HS200);
+	}
 
 	if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
 		/*
diff --git a/include/mmc.h b/include/mmc.h
index 90e1dcc..e0b5510 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -300,6 +300,7 @@
 #define MMC_TIMING_UHS_SDR50	2
 #define MMC_TIMING_UHS_SDR104	3
 #define MMC_TIMING_UHS_DDR50	4
+#define MMC_TIMING_HS200	5
 #define MMC_TIMING_HS		1
 
 /* Driver model support */
-- 
2.7.4



More information about the U-Boot mailing list