aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mmc_spi.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2018-12-02 09:43:18 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2018-12-17 08:26:24 +0100
commit5716fb9bd9c6d3e56da07d6ed219dfcfce7d7006 (patch)
tree6e9b2496a59427fb423fab35e87bacce07df0a7d /drivers/mmc/host/mmc_spi.c
parentmmc: meson-mx-sdio: check devm_kasprintf for failure (diff)
downloadlinux-dev-5716fb9bd9c6d3e56da07d6ed219dfcfce7d7006.tar.xz
linux-dev-5716fb9bd9c6d3e56da07d6ed219dfcfce7d7006.zip
mmc: spi: Convert to use GPIO descriptors
Switch the SPI MMC driver to use GPIO descriptors internally and just look those up using the standard slot GPIO functions mmc_gpiod_request_cd() and mmc_gpiod_request_ro(). Make sure to request index 0 and 1 in accordance with the SPI MMC DT binding, and add the same GPIOs in machine descriptor tables on all boards that use SPI MMC in board files. The lines are flagged as GPIO_ACTIVE_[LOW|HIGH] as that is what they are, and since we can now rely on the descriptors to have the right polarity, we set the "override_active_level" to false in mmc_gpiod_request_cd() and mmc_gpiod_request_ro(). Cc: Hartley Sweeten <hsweeten@visionengravers.com> # Vision EP9307 Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/mmc_spi.c')
-rw-r--r--drivers/mmc/host/mmc_spi.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 476e53d30128..10ba46b728e8 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1434,13 +1434,16 @@ static int mmc_spi_probe(struct spi_device *spi)
if (status != 0)
goto fail_add_host;
- if (host->pdata && host->pdata->flags & MMC_SPI_USE_CD_GPIO) {
- status = mmc_gpio_request_cd(mmc, host->pdata->cd_gpio,
- host->pdata->cd_debounce);
- if (status != 0)
- goto fail_add_host;
-
- /* The platform has a CD GPIO signal that may support
+ /*
+ * Index 0 is card detect
+ * Old boardfiles were specifying 1 ms as debounce
+ */
+ status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1, NULL);
+ if (status == -EPROBE_DEFER)
+ goto fail_add_host;
+ if (!status) {
+ /*
+ * The platform has a CD GPIO signal that may support
* interrupts, so let mmc_gpiod_request_cd_irq() decide
* if polling is needed or not.
*/
@@ -1448,12 +1451,12 @@ static int mmc_spi_probe(struct spi_device *spi)
mmc_gpiod_request_cd_irq(mmc);
}
- if (host->pdata && host->pdata->flags & MMC_SPI_USE_RO_GPIO) {
+ /* Index 1 is write protect/read only */
+ status = mmc_gpiod_request_ro(mmc, NULL, 1, false, 0, NULL);
+ if (status == -EPROBE_DEFER)
+ goto fail_add_host;
+ if (!status)
has_ro = true;
- status = mmc_gpio_request_ro(mmc, host->pdata->ro_gpio);
- if (status != 0)
- goto fail_add_host;
- }
dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n",
dev_name(&mmc->class_dev),