]> Pileus Git - ~andy/linux/commitdiff
ARM: 7427/1: mmc: mmci: Defer probe() in case of yet uninitialized GPIOs
authorRoland Stigge <stigge@antcom.de>
Sun, 17 Jun 2012 20:14:27 +0000 (21:14 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 17 Jun 2012 21:24:36 +0000 (22:24 +0100)
If the GPIOs used by the MMCI driver are not registered yet when the driver is
probe()d, they can't be used. This happens if the mmci driver is probed before
the respective GPIO controller (e.g. on the LPC32xx EA3250 board, the PCA9532
GPIO controller would be initialized via DT after mmci). Therefore, we defer
mmci in this case.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/mmc/host/mmci.c

index 78d3e484599752fa02e18a741ef47dca22a17d35..50ff19a6236829b3143174b1372e141b86fb58fa 100644 (file)
@@ -1425,6 +1425,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
        writel(0, host->base + MMCIMASK1);
        writel(0xfff, host->base + MMCICLEAR);
 
+       if (plat->gpio_cd == -EPROBE_DEFER) {
+               ret = -EPROBE_DEFER;
+               goto err_gpio_cd;
+       }
        if (gpio_is_valid(plat->gpio_cd)) {
                ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)");
                if (ret == 0)
@@ -1448,6 +1452,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
                if (ret >= 0)
                        host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd);
        }
+       if (plat->gpio_wp == -EPROBE_DEFER) {
+               ret = -EPROBE_DEFER;
+               goto err_gpio_wp;
+       }
        if (gpio_is_valid(plat->gpio_wp)) {
                ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)");
                if (ret == 0)