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>
This commit is contained in:

committed by
Ulf Hansson

parent
b0d06f1cb0
commit
5716fb9bd9
@@ -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),
|
||||
|
Reference in New Issue
Block a user