Skip to content

Commit 53dd0a7

Browse files
osctobestorulf
authored andcommitted
mmc: sdhci-of-at91: fix cd-gpios for SAMA5D2
SAMA5D2x doesn't drive CMD line if GPIO is used as CD line (at least SAMA5D27 doesn't). Fix this by forcing card-detect in the module if module-controlled CD is not used. Fixed commit addresses the problem only for non-removable cards. This amends it to also cover gpio-cd case. Cc: [email protected] Fixes: 7a1e3f1 ("mmc: sdhci-of-at91: force card detect value for non removable devices") Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/8d10950d9940468577daef4772b82a071b204716.1584290561.git.mirq-linux@rere.qmqm.pl Signed-off-by: Ulf Hansson <[email protected]>
1 parent 18b587b commit 53dd0a7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
132132

133133
sdhci_reset(host, mask);
134134

135-
if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
135+
if ((host->mmc->caps & MMC_CAP_NONREMOVABLE)
136+
|| mmc_gpio_get_cd(host->mmc) >= 0)
136137
sdhci_at91_set_force_card_detect(host);
137138

138139
if (priv->cal_always_on && (mask & SDHCI_RESET_ALL))
@@ -427,8 +428,11 @@ static int sdhci_at91_probe(struct platform_device *pdev)
427428
* detection procedure using the SDMCC_CD signal is bypassed.
428429
* This bit is reset when a software reset for all command is performed
429430
* so we need to implement our own reset function to set back this bit.
431+
*
432+
* WA: SAMA5D2 doesn't drive CMD if using CD GPIO line.
430433
*/
431-
if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
434+
if ((host->mmc->caps & MMC_CAP_NONREMOVABLE)
435+
|| mmc_gpio_get_cd(host->mmc) >= 0)
432436
sdhci_at91_set_force_card_detect(host);
433437

434438
pm_runtime_put_autosuspend(&pdev->dev);

0 commit comments

Comments
 (0)