Skip to content

Commit fb3bbc4

Browse files
erickshepherdNIUlf Hansson
authored andcommitted
mmc: sdhci: Disable SD card clock before changing parameters
Per the SD Host Controller Simplified Specification v4.20 §3.2.3, change the SD card clock parameters only after first disabling the external card clock. Doing this fixes a spurious clock pulse on Baytrail and Apollo Lake SD controllers which otherwise breaks voltage switching with a specific Swissbit SD card. Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com> Signed-off-by: Brad Mouring <brad.mouring@ni.com> Signed-off-by: Erick Shepherd <erick.shepherd@ni.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20250211214645.469279-1-erick.shepherd@ni.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 4e35c61 commit fb3bbc4

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/mmc/host/sdhci.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,10 +2065,15 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
20652065

20662066
host->mmc->actual_clock = 0;
20672067

2068-
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
2068+
clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
2069+
if (clk & SDHCI_CLOCK_CARD_EN)
2070+
sdhci_writew(host, clk & ~SDHCI_CLOCK_CARD_EN,
2071+
SDHCI_CLOCK_CONTROL);
20692072

2070-
if (clock == 0)
2073+
if (clock == 0) {
2074+
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
20712075
return;
2076+
}
20722077

20732078
clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
20742079
sdhci_enable_clk(host, clk);

0 commit comments

Comments
 (0)