Skip to content

Commit a5e3e8a

Browse files
committed
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 b6f5370 commit a5e3e8a

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
@@ -26,6 +26,7 @@
2626
#include <linux/debugfs.h>
2727
#include <linux/acpi.h>
2828
#include <linux/dmi.h>
29+
#include <linux/of.h>
2930

3031
#include <linux/mmc/host.h>
3132
#include <linux/mmc/mmc.h>
@@ -2122,6 +2123,15 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
21222123
dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
21232124
slot->cd_idx = -1;
21242125
}
2126+
} else if (is_of_node(pdev->dev.fwnode)) {
2127+
/* Allow all OF systems to use a CD GPIO if provided */
2128+
2129+
ret = mmc_gpiod_request_cd(host->mmc, "cd", 0,
2130+
slot->cd_override_level, 0);
2131+
if (ret == -EPROBE_DEFER)
2132+
goto remove;
2133+
else if (ret == 0)
2134+
slot->cd_idx = 0;
21252135
}
21262136

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

0 commit comments

Comments
 (0)