]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/mmc/omap_hsmmc.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / drivers / mmc / omap_hsmmc.c
index 17cbb0983db37f0e976b7fbd12bc208a70eabfbc..ffb5284a00ea4446747a93706542de9d2cba23f1 100644 (file)
@@ -67,14 +67,19 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 #ifdef OMAP_HSMMC_USE_GPIO
 static int omap_mmc_setup_gpio_in(int gpio, const char *label)
 {
-       if (!gpio_is_valid(gpio))
-               return -1;
+       int ret;
 
-       if (gpio_request(gpio, label) < 0)
+#ifndef CONFIG_DM_GPIO
+       if (!gpio_is_valid(gpio))
                return -1;
+#endif
+       ret = gpio_request(gpio, label);
+       if (ret)
+               return ret;
 
-       if (gpio_direction_input(gpio) < 0)
-               return -1;
+       ret = gpio_direction_input(gpio);
+       if (ret)
+               return ret;
 
        return gpio;
 }
@@ -120,7 +125,7 @@ static void omap5_pbias_config(struct mmc *mmc)
 }
 #endif
 
-unsigned char mmc_board_init(struct mmc *mmc)
+static unsigned char mmc_board_init(struct mmc *mmc)
 {
 #if defined(CONFIG_OMAP34XX)
        t2_t *t2_base = (t2_t *)T2_BASE;
@@ -606,7 +611,8 @@ static int omap_hsmmc_getcd(struct mmc *mmc)
        if (cd_gpio < 0)
                return 1;
 
-       return gpio_get_value(cd_gpio);
+       /* NOTE: assumes card detect signal is active-low */
+       return !gpio_get_value(cd_gpio);
 }
 
 static int omap_hsmmc_getwp(struct mmc *mmc)
@@ -619,6 +625,7 @@ static int omap_hsmmc_getwp(struct mmc *mmc)
        if (wp_gpio < 0)
                return 0;
 
+       /* NOTE: assumes write protect signal is active-high */
        return gpio_get_value(wp_gpio);
 }
 #endif