|
@@ -26,14 +26,13 @@
|
|
|
#include <linux/pm.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/mmc/host.h>
|
|
|
-#include <linux/mmc/sdhci-spear.h>
|
|
|
#include <linux/mmc/slot-gpio.h>
|
|
|
#include <linux/io.h>
|
|
|
#include "sdhci.h"
|
|
|
|
|
|
struct spear_sdhci {
|
|
|
struct clk *clk;
|
|
|
- struct sdhci_plat_data *data;
|
|
|
+ int card_int_gpio;
|
|
|
};
|
|
|
|
|
|
/* sdhci ops */
|
|
@@ -44,26 +43,16 @@ static const struct sdhci_ops sdhci_pltfm_ops = {
|
|
|
.set_uhs_signaling = sdhci_set_uhs_signaling,
|
|
|
};
|
|
|
|
|
|
-static struct sdhci_plat_data *sdhci_probe_config_dt(struct platform_device *pdev)
|
|
|
+static void sdhci_probe_config_dt(struct device_node *np,
|
|
|
+ struct spear_sdhci *host)
|
|
|
{
|
|
|
- struct device_node *np = pdev->dev.of_node;
|
|
|
- struct sdhci_plat_data *pdata = NULL;
|
|
|
int cd_gpio;
|
|
|
|
|
|
cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
|
|
|
if (!gpio_is_valid(cd_gpio))
|
|
|
cd_gpio = -1;
|
|
|
|
|
|
- /* If pdata is required */
|
|
|
- if (cd_gpio != -1) {
|
|
|
- pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
|
|
- if (!pdata)
|
|
|
- dev_err(&pdev->dev, "DT: kzalloc failed\n");
|
|
|
- else
|
|
|
- pdata->card_int_gpio = cd_gpio;
|
|
|
- }
|
|
|
-
|
|
|
- return pdata;
|
|
|
+ host->card_int_gpio = cd_gpio;
|
|
|
}
|
|
|
|
|
|
static int sdhci_probe(struct platform_device *pdev)
|
|
@@ -116,24 +105,18 @@ static int sdhci_probe(struct platform_device *pdev)
|
|
|
dev_dbg(&pdev->dev, "Error setting desired clk, clk=%lu\n",
|
|
|
clk_get_rate(sdhci->clk));
|
|
|
|
|
|
- sdhci->data = sdhci_probe_config_dt(pdev);
|
|
|
- if (IS_ERR(sdhci->data)) {
|
|
|
- dev_err(&pdev->dev, "DT: Failed to get pdata\n");
|
|
|
- goto disable_clk;
|
|
|
- }
|
|
|
-
|
|
|
+ sdhci_probe_config_dt(pdev->dev.of_node, sdhci);
|
|
|
/*
|
|
|
* It is optional to use GPIOs for sdhci card detection. If
|
|
|
- * sdhci->data is NULL, then use original sdhci lines otherwise
|
|
|
+ * sdhci->card_int_gpio < 0, then use original sdhci lines otherwise
|
|
|
* GPIO lines. We use the built-in GPIO support for this.
|
|
|
*/
|
|
|
- if (sdhci->data && sdhci->data->card_int_gpio >= 0) {
|
|
|
- ret = mmc_gpio_request_cd(host->mmc,
|
|
|
- sdhci->data->card_int_gpio, 0);
|
|
|
+ if (sdhci->card_int_gpio >= 0) {
|
|
|
+ ret = mmc_gpio_request_cd(host->mmc, sdhci->card_int_gpio, 0);
|
|
|
if (ret < 0) {
|
|
|
dev_dbg(&pdev->dev,
|
|
|
"failed to request card-detect gpio%d\n",
|
|
|
- sdhci->data->card_int_gpio);
|
|
|
+ sdhci->card_int_gpio);
|
|
|
goto disable_clk;
|
|
|
}
|
|
|
}
|