Skip to content

Commit 3c8ae99

Browse files
committed
mmc: sdhci-of-at91: do not advertise SDR104 mode support
There are several issues with SDR104 mode and tuning so remove it from the capabilities of the host controller. Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
1 parent 60629fb commit 3c8ae99

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 13 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);

0 commit comments

Comments
 (0)