aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMylene JOSSERAND <josserand.mylene@gmail.com>2015-03-30 17:39:25 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2015-04-01 06:56:07 -0400
commit2391b340ca5b7dd041a2bf86afe12bc004acb583 (patch)
treedcb6725c4792cc48afb2f47cccdcc8ff0c85166a
parente03de74516ec434aea77cfcf276df9c87fc7285a (diff)
mmc: sdhci-tegra: convert to use GPIO descriptors
Modify the driver to handle GPIOs using the descriptor API. Signed-off-by: Mylene JOSSERAND <josserand.mylene@gmail.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Tested-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/sdhci-tegra.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 93834ab6c3a3..ad28b49f0203 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -20,11 +20,10 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_device.h> 22#include <linux/of_device.h>
23#include <linux/of_gpio.h>
24#include <linux/gpio.h>
25#include <linux/mmc/card.h> 23#include <linux/mmc/card.h>
26#include <linux/mmc/host.h> 24#include <linux/mmc/host.h>
27#include <linux/mmc/slot-gpio.h> 25#include <linux/mmc/slot-gpio.h>
26#include <linux/gpio/consumer.h>
28 27
29#include "sdhci-pltfm.h" 28#include "sdhci-pltfm.h"
30 29
@@ -49,7 +48,7 @@ struct sdhci_tegra_soc_data {
49 48
50struct sdhci_tegra { 49struct sdhci_tegra {
51 const struct sdhci_tegra_soc_data *soc_data; 50 const struct sdhci_tegra_soc_data *soc_data;
52 int power_gpio; 51 struct gpio_desc *power_gpio;
53}; 52};
54 53
55static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) 54static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg)
@@ -246,17 +245,6 @@ static const struct of_device_id sdhci_tegra_dt_match[] = {
246}; 245};
247MODULE_DEVICE_TABLE(of, sdhci_tegra_dt_match); 246MODULE_DEVICE_TABLE(of, sdhci_tegra_dt_match);
248 247
249static int sdhci_tegra_parse_dt(struct device *dev)
250{
251 struct device_node *np = dev->of_node;
252 struct sdhci_host *host = dev_get_drvdata(dev);
253 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
254 struct sdhci_tegra *tegra_host = pltfm_host->priv;
255
256 tegra_host->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
257 return mmc_of_parse(host->mmc);
258}
259
260static int sdhci_tegra_probe(struct platform_device *pdev) 248static int sdhci_tegra_probe(struct platform_device *pdev)
261{ 249{
262 const struct of_device_id *match; 250 const struct of_device_id *match;
@@ -286,19 +274,15 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
286 tegra_host->soc_data = soc_data; 274 tegra_host->soc_data = soc_data;
287 pltfm_host->priv = tegra_host; 275 pltfm_host->priv = tegra_host;
288 276
289 rc = sdhci_tegra_parse_dt(&pdev->dev); 277 rc = mmc_of_parse(host->mmc);
290 if (rc) 278 if (rc)
291 goto err_parse_dt; 279 goto err_parse_dt;
292 280
293 if (gpio_is_valid(tegra_host->power_gpio)) { 281 tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
294 rc = devm_gpio_request(&pdev->dev, tegra_host->power_gpio, 282 GPIOD_OUT_HIGH);
295 "sdhci_power"); 283 if (IS_ERR(tegra_host->power_gpio)) {
296 if (rc) { 284 rc = PTR_ERR(tegra_host->power_gpio);
297 dev_err(mmc_dev(host->mmc), 285 goto err_power_req;
298 "failed to allocate power gpio\n");
299 goto err_power_req;
300 }
301 gpio_direction_output(tegra_host->power_gpio, 1);
302 } 286 }
303 287
304 clk = devm_clk_get(mmc_dev(host->mmc), NULL); 288 clk = devm_clk_get(mmc_dev(host->mmc), NULL);