aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-08-27 09:13:54 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2014-09-09 08:25:14 -0400
commitce437aa4519c46a0f12455c320b6f65dde16c26e (patch)
treea1bb1a55d565c1454d2d36519db910a7d16d0506
parent98e90de99a0c43bd434da814c882c4332441871e (diff)
mmc: mmci: augment driver to handle gpio descriptors
Currently the MMCI driver will only handle GPIO descriptors implicitly through the device tree probe glue in mmc_of_init(), but devices instatiated other ways such as through board files and passing descriptors using the GPIO descriptor table will not be able to exploit descriptors. Augment the driver to look for a GPIO descriptor if device tree is not used for the device, and if that doesn't work, fall back to platform data GPIO assignment using the old API. The end goal is to get rid of the platform data integer GPIO assingments from the kernel. This enable the MMCI-embedding platforms to be converted to GPIO descritor tables. Cc: Alexandre Courbot <gnurou@gmail.com> Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/mmci.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index a7b3af9e9a2a..c85b0d8ee727 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1674,16 +1674,35 @@ static int mmci_probe(struct amba_device *dev,
1674 writel(0, host->base + MMCIMASK1); 1674 writel(0, host->base + MMCIMASK1);
1675 writel(0xfff, host->base + MMCICLEAR); 1675 writel(0xfff, host->base + MMCICLEAR);
1676 1676
1677 /* If DT, cd/wp gpios must be supplied through it. */ 1677 /*
1678 if (!np && gpio_is_valid(plat->gpio_cd)) { 1678 * If:
1679 ret = mmc_gpio_request_cd(mmc, plat->gpio_cd, 0); 1679 * - not using DT but using a descriptor table, or
1680 if (ret) 1680 * - using a table of descriptors ALONGSIDE DT, or
1681 goto clk_disable; 1681 * look up these descriptors named "cd" and "wp" right here, fail
1682 } 1682 * silently of these do not exist and proceed to try platform data
1683 if (!np && gpio_is_valid(plat->gpio_wp)) { 1683 */
1684 ret = mmc_gpio_request_ro(mmc, plat->gpio_wp); 1684 if (!np) {
1685 if (ret) 1685 ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0);
1686 goto clk_disable; 1686 if (ret < 0) {
1687 if (ret == -EPROBE_DEFER)
1688 goto clk_disable;
1689 else if (gpio_is_valid(plat->gpio_cd)) {
1690 ret = mmc_gpio_request_cd(mmc, plat->gpio_cd, 0);
1691 if (ret)
1692 goto clk_disable;
1693 }
1694 }
1695
1696 ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0);
1697 if (ret < 0) {
1698 if (ret == -EPROBE_DEFER)
1699 goto clk_disable;
1700 else if (gpio_is_valid(plat->gpio_wp)) {
1701 ret = mmc_gpio_request_ro(mmc, plat->gpio_wp);
1702 if (ret)
1703 goto clk_disable;
1704 }
1705 }
1687 } 1706 }
1688 1707
1689 ret = devm_request_irq(&dev->dev, dev->irq[0], mmci_irq, IRQF_SHARED, 1708 ret = devm_request_irq(&dev->dev, dev->irq[0], mmci_irq, IRQF_SHARED,