hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/mmc/host/sdhci-spear.c
....@@ -15,13 +15,11 @@
1515
1616 #include <linux/clk.h>
1717 #include <linux/delay.h>
18
-#include <linux/gpio.h>
1918 #include <linux/highmem.h>
2019 #include <linux/module.h>
2120 #include <linux/interrupt.h>
2221 #include <linux/irq.h>
2322 #include <linux/of.h>
24
-#include <linux/of_gpio.h>
2523 #include <linux/platform_device.h>
2624 #include <linux/pm.h>
2725 #include <linux/slab.h>
....@@ -32,7 +30,6 @@
3230
3331 struct spear_sdhci {
3432 struct clk *clk;
35
- int card_int_gpio;
3633 };
3734
3835 /* sdhci ops */
....@@ -43,22 +40,9 @@
4340 .set_uhs_signaling = sdhci_set_uhs_signaling,
4441 };
4542
46
-static void sdhci_probe_config_dt(struct device_node *np,
47
- struct spear_sdhci *host)
48
-{
49
- int cd_gpio;
50
-
51
- cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
52
- if (!gpio_is_valid(cd_gpio))
53
- cd_gpio = -1;
54
-
55
- host->card_int_gpio = cd_gpio;
56
-}
57
-
5843 static int sdhci_probe(struct platform_device *pdev)
5944 {
6045 struct sdhci_host *host;
61
- struct resource *iomem;
6246 struct spear_sdhci *sdhci;
6347 struct device *dev;
6448 int ret;
....@@ -71,8 +55,7 @@
7155 goto err;
7256 }
7357
74
- iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
75
- host->ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
58
+ host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
7659 if (IS_ERR(host->ioaddr)) {
7760 ret = PTR_ERR(host->ioaddr);
7861 dev_dbg(&pdev->dev, "unable to map iomem: %d\n", ret);
....@@ -109,21 +92,13 @@
10992 dev_dbg(&pdev->dev, "Error setting desired clk, clk=%lu\n",
11093 clk_get_rate(sdhci->clk));
11194
112
- sdhci_probe_config_dt(pdev->dev.of_node, sdhci);
11395 /*
114
- * It is optional to use GPIOs for sdhci card detection. If
115
- * sdhci->card_int_gpio < 0, then use original sdhci lines otherwise
116
- * GPIO lines. We use the built-in GPIO support for this.
96
+ * It is optional to use GPIOs for sdhci card detection. If we
97
+ * find a descriptor using slot GPIO, we use it.
11798 */
118
- if (sdhci->card_int_gpio >= 0) {
119
- ret = mmc_gpio_request_cd(host->mmc, sdhci->card_int_gpio, 0);
120
- if (ret < 0) {
121
- dev_dbg(&pdev->dev,
122
- "failed to request card-detect gpio%d\n",
123
- sdhci->card_int_gpio);
124
- goto disable_clk;
125
- }
126
- }
99
+ ret = mmc_gpiod_request_cd(host->mmc, "cd", 0, false, 0);
100
+ if (ret == -EPROBE_DEFER)
101
+ goto disable_clk;
127102
128103 ret = sdhci_add_host(host);
129104 if (ret)
....@@ -206,6 +181,7 @@
206181 static struct platform_driver sdhci_driver = {
207182 .driver = {
208183 .name = "sdhci",
184
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
209185 .pm = &sdhci_pm_ops,
210186 .of_match_table = of_match_ptr(sdhci_spear_id_table),
211187 },