diff options
-rw-r--r-- | drivers/mmc/host/mmci.c | 39 |
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, |