Skip to content

Commit fc419fd

Browse files
committed
Merge remote-tracking branch 'remotes/origin/at91-4.14-trunk/mmc' into linux-4.14-at91
2 parents f51d8fb + d7d1aa6 commit fc419fd

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

drivers/mmc/host/sdhci-of-at91.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ static int sdhci_at91_set_clks_presets(struct device *dev)
166166
clk_prepare_enable(priv->hclock);
167167
caps0 = readl(host->ioaddr + SDHCI_CAPABILITIES);
168168
caps1 = readl(host->ioaddr + SDHCI_CAPABILITIES_1);
169+
170+
/*
171+
* We experience some issues with SDR104. If the SD clock is higher
172+
* than 100 MHz, we can get data corruption. With a 100 MHz clock,
173+
* the tuning procedure may fail. For those reasons, it is useless to
174+
* advertise that we can use SDR104 mode, so remove it from
175+
* the capabilities.
176+
*/
177+
writel(SDMMC_CACR_KEY | SDMMC_CACR_CAPWREN, host->ioaddr + SDMMC_CACR);
178+
caps1 &= (~SDHCI_SUPPORT_SDR104);
179+
writel(caps1, host->ioaddr + SDHCI_CAPABILITIES_1);
180+
writel(0, host->ioaddr + SDMMC_CACR);
181+
169182
clk_base = (caps0 & SDHCI_CLOCK_V3_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT;
170183
clk_mul = (caps1 & SDHCI_CLOCK_MUL_MASK) >> SDHCI_CLOCK_MUL_SHIFT;
171184
gck_rate = clk_base * 1000000 * (clk_mul + 1);
@@ -402,6 +415,8 @@ static int sdhci_at91_probe(struct platform_device *pdev)
402415
if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
403416
sdhci_at91_set_force_card_detect(host);
404417

418+
device_init_wakeup(&pdev->dev, true);
419+
405420
pm_runtime_put_autosuspend(&pdev->dev);
406421

407422
return 0;

drivers/mmc/host/sdhci.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,8 +2151,17 @@ static void __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
21512151
sdhci_send_tuning(host, opcode);
21522152

21532153
if (!host->tuning_done) {
2154-
pr_info("%s: Tuning timeout, falling back to fixed sampling clock\n",
2155-
mmc_hostname(host->mmc));
2154+
/*
2155+
* Tuning for DDR50 mode appeared in the SD 3.0.1
2156+
* specification. If the card is only compliant with
2157+
* SD 3.0 and not SD 3.0.1 (as most of the SD cards),
2158+
* CMD19 will fail. In this case, the failure is not
2159+
* an error. It's useless to display that we fall back
2160+
* to fixed sampling clock at each tuning procedure.
2161+
*/
2162+
if (host->timing != MMC_TIMING_UHS_DDR50)
2163+
pr_info("%s: Tuning timeout, falling back to fixed sampling clock\n",
2164+
mmc_hostname(host->mmc));
21562165
sdhci_abort_tuning(host, opcode);
21572166
return;
21582167
}

0 commit comments

Comments
 (0)