Skip to content

Commit b007c4c

Browse files
linuswstorulf
authored andcommitted
mmc: sdhci: spear: Use the slot GPIO descriptor
This driver is complicating things for no reason: the "cd" GPIO can easily be retrieved from the device tree if present using just mmc_gpiod_request_cd(), which will fetch the descriptor from the device tree using the standard binding just fine. Cc: Viresh Kumar <vireshk@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 9ef986a commit b007c4c

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

drivers/mmc/host/sdhci-spear.c

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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,18 +40,6 @@ static const struct sdhci_ops sdhci_pltfm_ops = {
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;
@@ -109,21 +94,13 @@ static int sdhci_probe(struct platform_device *pdev)
10994
dev_dbg(&pdev->dev, "Error setting desired clk, clk=%lu\n",
11095
clk_get_rate(sdhci->clk));
11196

112-
sdhci_probe_config_dt(pdev->dev.of_node, sdhci);
11397
/*
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.
98+
* It is optional to use GPIOs for sdhci card detection. If we
99+
* find a descriptor using slot GPIO, we use it.
117100
*/
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-
}
101+
ret = mmc_gpiod_request_cd(host->mmc, "cd", 0, false, 0, NULL);
102+
if (ret == -EPROBE_DEFER)
103+
goto disable_clk;
127104

128105
ret = sdhci_add_host(host);
129106
if (ret)

0 commit comments

Comments
 (0)