Skip to content

Commit eec9b04

Browse files
marcanjannau
authored andcommitted
mmc: sdhci-pci: Support external CD GPIO on all OF systems
Allow OF systems to specify an external CD GPIO on all devices, even if they have an internal CD feature. Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent a19d54e commit eec9b04

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/debugfs.h>
2828
#include <linux/acpi.h>
2929
#include <linux/dmi.h>
30+
#include <linux/of.h>
3031

3132
#include <linux/mmc/host.h>
3233
#include <linux/mmc/mmc.h>
@@ -2210,6 +2211,15 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
22102211
dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
22112212
slot->cd_idx = -1;
22122213
}
2214+
} else if (is_of_node(pdev->dev.fwnode)) {
2215+
/* Allow all OF systems to use a CD GPIO if provided */
2216+
2217+
ret = mmc_gpiod_request_cd(host->mmc, "cd", 0,
2218+
slot->cd_override_level, 0);
2219+
if (ret == -EPROBE_DEFER)
2220+
goto remove;
2221+
else if (ret == 0)
2222+
slot->cd_idx = 0;
22132223
}
22142224

22152225
if (chip->fixes && chip->fixes->add_host)

0 commit comments

Comments
 (0)