ARM: OMAP: hsmmc: Add support for non-OMAP pins
authorThomas Weber <weber@corscience.de>
Thu, 17 Nov 2011 21:39:40 +0000 (22:39 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Fri, 3 Jul 2015 22:19:02 +0000 (01:19 +0300)
The Devkit8000 uses a TWL4030 pin for card detection.
Thats why the error:
_omap_mux_init_gpio: Could not set gpio192
occurs.

This patch checks that the pin is on OMAP before
calling omap_mux_init_gpio.

Signed-off-by: Thomas Weber <weber@corscience.de>
[tony@atomide.com: updated comments]
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/hsmmc.c

index 606a8cd..a7035a5 100644 (file)
@@ -201,10 +201,12 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
 static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
                        int controller_nr)
 {
-       if (gpio_is_valid(mmc_controller->slots[0].switch_pin))
+       if (gpio_is_valid(mmc_controller->slots[0].switch_pin) &&
+               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
                omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
                                        OMAP_PIN_INPUT_PULLUP);
-       if (gpio_is_valid(mmc_controller->slots[0].gpio_wp))
+       if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) &&
+               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
                omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
                                        OMAP_PIN_INPUT_PULLUP);
        if (cpu_is_omap34xx()) {