Skip to content

Commit a1382d1

Browse files
ConchuODUlf Hansson
authored andcommitted
mmc: mmc_spi: allow for spi controllers incapable of getting as low as 400k
Some controllers may not be able to reach a bus clock as low as 400 KHz due to a lack of sufficient divisors. In these cases, the SD card slot becomes non-functional as Linux continuously attempts to set the bus clock to 400 KHz. If the controller is incapable of getting that low, set its minimum frequency instead. While this may eliminate some SD cards, it allows those capable of operating at the controller's minimum frequency to be used. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20240625-gigantic-frown-1ef4afa3e6fa@wendy Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent d0f4592 commit a1382d1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/mmc/host/mmc_spi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,10 @@ static int mmc_spi_probe(struct spi_device *spi)
12081208
* that's the only reason not to use a few MHz for f_min (until
12091209
* the upper layer reads the target frequency from the CSD).
12101210
*/
1211-
mmc->f_min = 400000;
1211+
if (spi->controller->min_speed_hz > 400000)
1212+
dev_warn(&spi->dev,"Controller unable to reduce bus clock to 400 KHz\n");
1213+
1214+
mmc->f_min = max(spi->controller->min_speed_hz, 400000);
12121215
mmc->f_max = spi->max_speed_hz;
12131216

12141217
host = mmc_priv(mmc);

0 commit comments

Comments
 (0)