summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahaslam@baylibre.com <ahaslam@baylibre.com>2016-11-15 17:28:22 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2016-11-29 09:04:53 +0100
commit6e628dad6553cf00634edff9b63d167e2304115e (patch)
tree9a1c93aef8c7f6d89b19c9a30cc10406af235dbc
parentc8301e798fc83ec79543b3c79c3f89d3e497f2f7 (diff)
downloadop-kernel-dev-6e628dad6553cf00634edff9b63d167e2304115e.zip
op-kernel-dev-6e628dad6553cf00634edff9b63d167e2304115e.tar.gz
mmc: davinci: request gpios using gpio descriptors
Request card detect and write protect gpios using the provided API by mmc core. If a gpio is provided for card detect, we don't need to poll. So only use polling when a gpio is not provided. Once all pdata users register the gpios using gpio descriptors, we could remove the platform callbacks. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: David Lechner <david@lechnology.com>
-rw-r--r--drivers/mmc/host/davinci_mmc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 619e50e..36b5af8 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1167,6 +1167,7 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
struct platform_device *pdev = to_platform_device(mmc->parent);
struct davinci_mmc_config *pdata = pdev->dev.platform_data;
struct mmc_davinci_host *host;
+ int ret;
if (!pdata)
return -EINVAL;
@@ -1184,7 +1185,6 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
if (pdata && (pdata->wires == 8))
mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
- mmc->caps |= MMC_CAP_NEEDS_POLL;
mmc->f_min = 312500;
mmc->f_max = 25000000;
if (pdata && pdata->max_freq)
@@ -1192,6 +1192,17 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
if (pdata && pdata->caps)
mmc->caps |= pdata->caps;
+ /* Register a cd gpio, if there is not one, enable polling */
+ ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0, NULL);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+ else if (ret)
+ mmc->caps |= MMC_CAP_NEEDS_POLL;
+
+ ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+
return 0;
}
OpenPOWER on IntegriCloud