Skip to content

Commit 08b68ca

Browse files
Sarthak GargUlf Hansson
authored andcommitted
mmc: sdhci-msm: Enable tuning for SDR50 mode for SD card
For Qualcomm SoCs which needs level shifter for SD card, extra delay is seen on receiver data path. To compensate this delay enable tuning for SDR50 mode for targets which has level shifter. SDHCI_SDR50_NEEDS_TUNING caps will be set for targets with level shifter on Qualcomm SOC's. Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent ce55f63 commit 08b68ca

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/mmc/host/sdhci-msm.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define CORE_IO_PAD_PWR_SWITCH_EN BIT(15)
8282
#define CORE_IO_PAD_PWR_SWITCH BIT(16)
8383
#define CORE_HC_SELECT_IN_EN BIT(18)
84+
#define CORE_HC_SELECT_IN_SDR50 (4 << 19)
8485
#define CORE_HC_SELECT_IN_HS400 (6 << 19)
8586
#define CORE_HC_SELECT_IN_MASK (7 << 19)
8687

@@ -1133,6 +1134,10 @@ static bool sdhci_msm_is_tuning_needed(struct sdhci_host *host)
11331134
{
11341135
struct mmc_ios *ios = &host->mmc->ios;
11351136

1137+
if (ios->timing == MMC_TIMING_UHS_SDR50 &&
1138+
host->flags & SDHCI_SDR50_NEEDS_TUNING)
1139+
return true;
1140+
11361141
/*
11371142
* Tuning is required for SDR104, HS200 and HS400 cards and
11381143
* if clock frequency is greater than 100MHz in these modes.
@@ -1201,6 +1206,8 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
12011206
struct mmc_ios ios = host->mmc->ios;
12021207
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
12031208
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
1209+
const struct sdhci_msm_offset *msm_offset = msm_host->offset;
1210+
u32 config;
12041211

12051212
if (!sdhci_msm_is_tuning_needed(host)) {
12061213
msm_host->use_cdr = false;
@@ -1217,6 +1224,14 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
12171224
*/
12181225
msm_host->tuning_done = 0;
12191226

1227+
if (ios.timing == MMC_TIMING_UHS_SDR50 &&
1228+
host->flags & SDHCI_SDR50_NEEDS_TUNING) {
1229+
config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec);
1230+
config &= ~CORE_HC_SELECT_IN_MASK;
1231+
config |= CORE_HC_SELECT_IN_EN | CORE_HC_SELECT_IN_SDR50;
1232+
writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec);
1233+
}
1234+
12201235
/*
12211236
* For HS400 tuning in HS200 timing requires:
12221237
* - select MCLK/2 in VENDOR_SPEC

0 commit comments

Comments
 (0)