.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * SDHCI support for SiRF primaII and marco SoCs |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. |
---|
5 | | - * |
---|
6 | | - * Licensed under GPLv2 or later. |
---|
7 | 6 | */ |
---|
8 | 7 | |
---|
9 | 8 | #include <linux/delay.h> |
---|
.. | .. |
---|
11 | 10 | #include <linux/mmc/host.h> |
---|
12 | 11 | #include <linux/module.h> |
---|
13 | 12 | #include <linux/of.h> |
---|
14 | | -#include <linux/of_gpio.h> |
---|
15 | 13 | #include <linux/mmc/slot-gpio.h> |
---|
16 | 14 | #include "sdhci-pltfm.h" |
---|
17 | 15 | |
---|
18 | 16 | #define SDHCI_CLK_DELAY_SETTING 0x4C |
---|
19 | 17 | #define SDHCI_SIRF_8BITBUS BIT(3) |
---|
20 | 18 | #define SIRF_TUNING_COUNT 16384 |
---|
21 | | - |
---|
22 | | -struct sdhci_sirf_priv { |
---|
23 | | - int gpio_cd; |
---|
24 | | -}; |
---|
25 | 19 | |
---|
26 | 20 | static void sdhci_sirf_set_bus_width(struct sdhci_host *host, int width) |
---|
27 | 21 | { |
---|
.. | .. |
---|
170 | 164 | { |
---|
171 | 165 | struct sdhci_host *host; |
---|
172 | 166 | struct sdhci_pltfm_host *pltfm_host; |
---|
173 | | - struct sdhci_sirf_priv *priv; |
---|
174 | 167 | struct clk *clk; |
---|
175 | | - int gpio_cd; |
---|
176 | 168 | int ret; |
---|
177 | 169 | |
---|
178 | 170 | clk = devm_clk_get(&pdev->dev, NULL); |
---|
.. | .. |
---|
181 | 173 | return PTR_ERR(clk); |
---|
182 | 174 | } |
---|
183 | 175 | |
---|
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); |
---|
190 | 177 | if (IS_ERR(host)) |
---|
191 | 178 | return PTR_ERR(host); |
---|
192 | 179 | |
---|
193 | 180 | pltfm_host = sdhci_priv(host); |
---|
194 | 181 | pltfm_host->clk = clk; |
---|
195 | | - priv = sdhci_pltfm_priv(pltfm_host); |
---|
196 | | - priv->gpio_cd = gpio_cd; |
---|
197 | 182 | |
---|
198 | 183 | sdhci_get_of_property(pdev); |
---|
199 | 184 | |
---|
.. | .. |
---|
209 | 194 | * We must request the IRQ after sdhci_add_host(), as the tasklet only |
---|
210 | 195 | * gets setup in sdhci_add_host() and we oops. |
---|
211 | 196 | */ |
---|
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) |
---|
219 | 201 | mmc_gpiod_request_cd_irq(host->mmc); |
---|
220 | | - } |
---|
221 | 202 | |
---|
222 | 203 | return 0; |
---|
223 | 204 | |
---|
.. | .. |
---|
239 | 220 | static struct platform_driver sdhci_sirf_driver = { |
---|
240 | 221 | .driver = { |
---|
241 | 222 | .name = "sdhci-sirf", |
---|
| 223 | + .probe_type = PROBE_PREFER_ASYNCHRONOUS, |
---|
242 | 224 | .of_match_table = sdhci_sirf_of_match, |
---|
243 | 225 | .pm = &sdhci_pltfm_pmops, |
---|
244 | 226 | }, |
---|