Skip to content

Commit 156e14b

Browse files
cavagiucjb
authored andcommitted
mmc: sdhci: fix caps2 for HS200
Although the HC supports HS200 (eMMC) the caps2 are always zero; this means there's no way to use the super speed mode (when init the card). If the HC support SDR104, for SD3.0, so it also supports HS200 for eMMC and this patch just sets the MMC_CAP2_HS200 in the host caps2 field. Reported-by: Youssef Triki <youssef.triki@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Philip Rakity <prakity@nvidia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 0dcaa24 commit 156e14b

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎drivers/mmc/host/sdhci.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
18631863
*/
18641864
if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR50) &&
18651865
(host->flags & SDHCI_SDR50_NEEDS_TUNING ||
1866-
host->flags & SDHCI_HS200_NEEDS_TUNING))
1866+
host->flags & SDHCI_SDR104_NEEDS_TUNING))
18671867
requires_tuning_nonuhs = true;
18681868

18691869
if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR104) ||
@@ -2994,9 +2994,13 @@ int sdhci_add_host(struct sdhci_host *host)
29942994
mmc->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
29952995

29962996
/* SDR104 supports also implies SDR50 support */
2997-
if (caps[1] & SDHCI_SUPPORT_SDR104)
2997+
if (caps[1] & SDHCI_SUPPORT_SDR104) {
29982998
mmc->caps |= MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50;
2999-
else if (caps[1] & SDHCI_SUPPORT_SDR50)
2999+
/* SD3.0: SDR104 is supported so (for eMMC) the caps2
3000+
* field can be promoted to support HS200.
3001+
*/
3002+
mmc->caps2 |= MMC_CAP2_HS200;
3003+
} else if (caps[1] & SDHCI_SUPPORT_SDR50)
30003004
mmc->caps |= MMC_CAP_UHS_SDR50;
30013005

30023006
if (caps[1] & SDHCI_SUPPORT_DDR50)
@@ -3006,9 +3010,9 @@ int sdhci_add_host(struct sdhci_host *host)
30063010
if (caps[1] & SDHCI_USE_SDR50_TUNING)
30073011
host->flags |= SDHCI_SDR50_NEEDS_TUNING;
30083012

3009-
/* Does the host need tuning for HS200? */
3013+
/* Does the host need tuning for SDR104 / HS200? */
30103014
if (mmc->caps2 & MMC_CAP2_HS200)
3011-
host->flags |= SDHCI_HS200_NEEDS_TUNING;
3015+
host->flags |= SDHCI_SDR104_NEEDS_TUNING;
30123016

30133017
/* Driver Type(s) (A, C, D) supported by the host */
30143018
if (caps[1] & SDHCI_DRIVER_TYPE_A)

‎include/linux/mmc/sdhci.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ struct sdhci_host {
127127
#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
128128
#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
129129
#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
130-
#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */
130+
#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
131131
#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
132132

133133
unsigned int version; /* SDHCI spec. version */

0 commit comments

Comments
 (0)