lede/target/linux/silicon/patches-5.19/0060-mmc-sdhci-pci-Support-external-CD-GPIO-on-all-OF-sys.patch

38 lines
1.2 KiB
Diff

From 2c80db171f88a2c7384cfefbd20ba4b2ed570e5c Mon Sep 17 00:00:00 2001
From: Hector Martin <marcan@marcan.st>
Date: Thu, 5 May 2022 01:40:31 +0900
Subject: [PATCH 060/171] 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>
---
drivers/mmc/host/sdhci-pci-core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index ed53276f6ad9..a711b4be3867 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -2096,6 +2096,15 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
slot->cd_idx = -1;
}
+ } else if (is_of_node(pdev->dev.fwnode)) {
+ /* Allow all OF systems to use a CD GPIO if provided */
+
+ ret = mmc_gpiod_request_cd(host->mmc, "cd", 0,
+ slot->cd_override_level, 0);
+ if (ret == -EPROBE_DEFER)
+ goto remove;
+ else if (ret == 0)
+ slot->cd_idx = 0;
}
if (chip->fixes && chip->fixes->add_host)
--
2.34.1