hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/mmc/host/sdhci-sirf.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * SDHCI support for SiRF primaII and marco SoCs
34 *
45 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5
- *
6
- * Licensed under GPLv2 or later.
76 */
87
98 #include <linux/delay.h>
....@@ -11,17 +10,12 @@
1110 #include <linux/mmc/host.h>
1211 #include <linux/module.h>
1312 #include <linux/of.h>
14
-#include <linux/of_gpio.h>
1513 #include <linux/mmc/slot-gpio.h>
1614 #include "sdhci-pltfm.h"
1715
1816 #define SDHCI_CLK_DELAY_SETTING 0x4C
1917 #define SDHCI_SIRF_8BITBUS BIT(3)
2018 #define SIRF_TUNING_COUNT 16384
21
-
22
-struct sdhci_sirf_priv {
23
- int gpio_cd;
24
-};
2519
2620 static void sdhci_sirf_set_bus_width(struct sdhci_host *host, int width)
2721 {
....@@ -170,9 +164,7 @@
170164 {
171165 struct sdhci_host *host;
172166 struct sdhci_pltfm_host *pltfm_host;
173
- struct sdhci_sirf_priv *priv;
174167 struct clk *clk;
175
- int gpio_cd;
176168 int ret;
177169
178170 clk = devm_clk_get(&pdev->dev, NULL);
....@@ -181,19 +173,12 @@
181173 return PTR_ERR(clk);
182174 }
183175
184
- if (pdev->dev.of_node)
185
- gpio_cd = of_get_named_gpio(pdev->dev.of_node, "cd-gpios", 0);
186
- else
187
- gpio_cd = -EINVAL;
188
-
189
- host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, sizeof(struct sdhci_sirf_priv));
176
+ host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, 0);
190177 if (IS_ERR(host))
191178 return PTR_ERR(host);
192179
193180 pltfm_host = sdhci_priv(host);
194181 pltfm_host->clk = clk;
195
- priv = sdhci_pltfm_priv(pltfm_host);
196
- priv->gpio_cd = gpio_cd;
197182
198183 sdhci_get_of_property(pdev);
199184
....@@ -209,15 +194,11 @@
209194 * We must request the IRQ after sdhci_add_host(), as the tasklet only
210195 * gets setup in sdhci_add_host() and we oops.
211196 */
212
- if (gpio_is_valid(priv->gpio_cd)) {
213
- ret = mmc_gpio_request_cd(host->mmc, priv->gpio_cd, 0);
214
- if (ret) {
215
- dev_err(&pdev->dev, "card detect irq request failed: %d\n",
216
- ret);
217
- goto err_request_cd;
218
- }
197
+ ret = mmc_gpiod_request_cd(host->mmc, "cd", 0, false, 0);
198
+ if (ret == -EPROBE_DEFER)
199
+ goto err_request_cd;
200
+ if (!ret)
219201 mmc_gpiod_request_cd_irq(host->mmc);
220
- }
221202
222203 return 0;
223204