Skip to content

Commit c9bd505

Browse files
neuschaeferstorulf
authored andcommitted
mmc: spi: Fix card detection during probe
When using the mmc_spi driver with a card-detect pin, I noticed that the card was not detected immediately after probe, but only after it was unplugged and plugged back in (and the CD IRQ fired). The call tree looks something like this: mmc_spi_probe mmc_add_host mmc_start_host _mmc_detect_change mmc_schedule_delayed_work(&host->detect, 0) mmc_rescan host->bus_ops->detect(host) mmc_detect _mmc_detect_card_removed host->ops->get_cd(host) mmc_gpio_get_cd -> -ENOSYS (ctx->cd_gpio not set) mmc_gpiod_request_cd ctx->cd_gpio = desc To fix this issue, call mmc_detect_change after the card-detect GPIO/IRQ is registered. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 5908e6b commit c9bd505

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mmc/host/mmc_spi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ static int mmc_spi_probe(struct spi_device *spi)
14501450
mmc->caps &= ~MMC_CAP_NEEDS_POLL;
14511451
mmc_gpiod_request_cd_irq(mmc);
14521452
}
1453+
mmc_detect_change(mmc, 0);
14531454

14541455
/* Index 1 is write protect/read only */
14551456
status = mmc_gpiod_request_ro(mmc, NULL, 1, false, 0, NULL);

0 commit comments

Comments
 (0)