Commit 2391b340 authored by Mylene JOSSERAND's avatar Mylene JOSSERAND Committed by Ulf Hansson

mmc: sdhci-tegra: convert to use GPIO descriptors

Modify the driver to handle GPIOs using the descriptor API.
Signed-off-by: default avatarMylene JOSSERAND <josserand.mylene@gmail.com>
Reviewed-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Tested-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent e03de745
...@@ -20,11 +20,10 @@ ...@@ -20,11 +20,10 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/gpio.h>
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/mmc/slot-gpio.h> #include <linux/mmc/slot-gpio.h>
#include <linux/gpio/consumer.h>
#include "sdhci-pltfm.h" #include "sdhci-pltfm.h"
...@@ -49,7 +48,7 @@ struct sdhci_tegra_soc_data { ...@@ -49,7 +48,7 @@ struct sdhci_tegra_soc_data {
struct sdhci_tegra { struct sdhci_tegra {
const struct sdhci_tegra_soc_data *soc_data; const struct sdhci_tegra_soc_data *soc_data;
int power_gpio; struct gpio_desc *power_gpio;
}; };
static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) static 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,17 +245,6 @@ static const struct of_device_id sdhci_tegra_dt_match[] = {
}; };
MODULE_DEVICE_TABLE(of, sdhci_tegra_dt_match); MODULE_DEVICE_TABLE(of, sdhci_tegra_dt_match);
static int sdhci_tegra_parse_dt(struct device *dev)
{
struct device_node *np = dev->of_node;
struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_tegra *tegra_host = pltfm_host->priv;
tegra_host->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
return mmc_of_parse(host->mmc);
}
static int sdhci_tegra_probe(struct platform_device *pdev) static int sdhci_tegra_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match; const struct of_device_id *match;
...@@ -286,20 +274,16 @@ static int sdhci_tegra_probe(struct platform_device *pdev) ...@@ -286,20 +274,16 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
tegra_host->soc_data = soc_data; tegra_host->soc_data = soc_data;
pltfm_host->priv = tegra_host; pltfm_host->priv = tegra_host;
rc = sdhci_tegra_parse_dt(&pdev->dev); rc = mmc_of_parse(host->mmc);
if (rc) if (rc)
goto err_parse_dt; goto err_parse_dt;
if (gpio_is_valid(tegra_host->power_gpio)) { tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
rc = devm_gpio_request(&pdev->dev, tegra_host->power_gpio, GPIOD_OUT_HIGH);
"sdhci_power"); if (IS_ERR(tegra_host->power_gpio)) {
if (rc) { rc = PTR_ERR(tegra_host->power_gpio);
dev_err(mmc_dev(host->mmc),
"failed to allocate power gpio\n");
goto err_power_req; goto err_power_req;
} }
gpio_direction_output(tegra_host->power_gpio, 1);
}
clk = devm_clk_get(mmc_dev(host->mmc), NULL); clk = devm_clk_get(mmc_dev(host->mmc), NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment