Skip to contentSkip to conversation

mmc: core: enable CMD19 tuning for DDR50 mode

PATCH Superseded Barry Song 2 participants 3 messages Sep 28, 2015 – Sep 29, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v2 1/2 mmc: core: enable CMD19 tuning for DDR50 mode

From: Weijun Yang <[email protected]>

As SD Specifications Part1 Physical Layer Specification Version 3.01 says, CMD19 tuning is available for unlocked cards in transfer state of 1.8V signaling mode. The small difference between v3.00 and 3.01 spec means that CMD19 tuning is also available for DDR50 mode.

---
 drivers/mmc/core/sd.c    | 19 +++++++++++++++++--
 drivers/mmc/host/sdhci.c |  1 +
 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/mmc/core/sd.c +17 -2
index 4e7366a..eaf8cb3 100644
@@ -628,9 +628,24 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
 	 * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
 	 */
 	if (!mmc_host_is_spi(card->host) &&
-	    (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
-	     card->sd_bus_speed == UHS_SDR104_BUS_SPEED))
+		(card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
+		 card->sd_bus_speed == UHS_DDR50_BUS_SPEED ||
+		 card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
 		err = mmc_execute_tuning(card);
+
+		/*
+		 * As SD Specifications Part1 Physical Layer Specification Version
+		 * 3.01 says, CMD19 tuning is available for unlocked cards in transfer
+		 * state of 1.8V signaling mode. The small difference between v3.00
+		 * and 3.01 spec means that CMD19 tuning is also available for DDR50
+		 * mode.
+		 */
+		if (err && (card->sd_bus_speed == UHS_DDR50_BUS_SPEED)) {
+			pr_warn("%s: ddr50 tuning failed\n", mmc_hostname(card->host));
+			err = 0;
+		}
+	}
+
 out:
 	kfree(status);
 
drivers/mmc/host/sdhci.c +1 -0
index 64b7fdb..382810d 100644
@@ -1915,6 +1915,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		break;
 
 	case MMC_TIMING_UHS_SDR104:
+	case MMC_TIMING_UHS_DDR50:
 		break;
 
 	case MMC_TIMING_UHS_SDR50:
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v2 2/2 mmc: sirf: fix the capbility to support DDR50

From: Weijun Yang <[email protected]>

According to hardware spec, validate DDR50 mode
for SDXC.

---
 drivers/mmc/host/sdhci-sirf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-sirf.c +2 -1
index 8842945..f5488c4 100644
@@ -50,7 +50,8 @@ static u32 sdhci_sirf_readl_le(struct sdhci_host *host, int reg)
 	if (unlikely((reg == SDHCI_CAPABILITIES_1) &&
 			(host->mmc->caps & MMC_CAP_UHS_SDR50))) {
 		/* fake CAP_1 register */
-		val = SDHCI_SUPPORT_SDR50 | SDHCI_USE_SDR50_TUNING;
+		val = SDHCI_SUPPORT_DDR50 |
+			SDHCI_SUPPORT_SDR50 | SDHCI_USE_SDR50_TUNING;
 	}
 
 	if (unlikely(reg == SDHCI_SLOT_INT_STATUS)) {
Signature · 1 line
1.9.1
#2 lore raw
In reply to Barry Song
Quoted 8 lines · Barry Song

From: Weijun Yang <[email protected]>

As SD Specifications Part1 Physical Layer Specification Version 3.01 says, CMD19 tuning is available for unlocked cards in transfer state of 1.8V signaling mode. The small difference between v3.00 and 3.01 spec means that CMD19 tuning is also available for DDR50 mode.

Quoted 5 lines
---
 drivers/mmc/core/sd.c    | 19 +++++++++++++++++--
 drivers/mmc/host/sdhci.c |  1 +

Sorry for not pointing out this is the first round, but I would rather split @subject patch into two parts.
One for core and one for sdhci, as it then becomes obvious that sdhci will start using the option to do tuning for DDR50 mode.

Quoted 46 lines
 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/mmc/core/sd.c +17 -2
index 4e7366a..eaf8cb3 100644
@@ -628,9 +628,24 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
         * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
         */
        if (!mmc_host_is_spi(card->host) &&
-           (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
-            card->sd_bus_speed == UHS_SDR104_BUS_SPEED))
+               (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
+                card->sd_bus_speed == UHS_DDR50_BUS_SPEED ||
+                card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
                err = mmc_execute_tuning(card);
+
+               /*
+                * As SD Specifications Part1 Physical Layer Specification Version
+                * 3.01 says, CMD19 tuning is available for unlocked cards in transfer
+                * state of 1.8V signaling mode. The small difference between v3.00
+                * and 3.01 spec means that CMD19 tuning is also available for DDR50
+                * mode.
+                */
+               if (err && (card->sd_bus_speed == UHS_DDR50_BUS_SPEED)) {
+                       pr_warn("%s: ddr50 tuning failed\n", mmc_hostname(card->host));
+                       err = 0;
+               }
+       }
+
 out:
        kfree(status);
 
drivers/mmc/host/sdhci.c +1 -1
index 64b7fdb..382810d 100644
@@ -1915,6 +1915,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
                break;
 
        case MMC_TIMING_UHS_SDR104:
+       case MMC_TIMING_UHS_DDR50:
                break;
 
        case MMC_TIMING_UHS_SDR50:
--
Quoted 2 lines

1.9.1

Kind regards
Uffe