Configure the pins as GPIOs prior to using gpio_get_value

Cc: Marek Vasut <marek.va...@gmail.com>
Signed-off-by: Fabio Estevam <fabio.este...@freescale.com>
---
 board/efikamx/efikamx.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c
index 3d2cc1a..b911891 100644
--- a/board/efikamx/efikamx.c
+++ b/board/efikamx/efikamx.c
@@ -308,10 +308,14 @@ struct fsl_esdhc_cfg esdhc_cfg[2] = {
 
 static inline uint32_t efika_mmc_cd(void)
 {
-       if (machine_is_efikamx())
+       if (machine_is_efikamx()) {
+               mxc_request_iomux(MX51_PIN_GPIO1_0, IOMUX_CONFIG_ALT1);
                return MX51_PIN_GPIO1_0;
-       else
+
+       } else {
+               mxc_request_iomux(MX51_PIN_EIM_CS2, IOMUX_CONFIG_ALT1);
                return MX51_PIN_EIM_CS2;
+       }
 }
 
 int board_mmc_getcd(u8 *absent, struct mmc *mmc)
@@ -321,9 +325,10 @@ int board_mmc_getcd(u8 *absent, struct mmc *mmc)
 
        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
                *absent = gpio_get_value(IOMUX_TO_GPIO(cd));
-       else
+       else {
+               mxc_request_iomux(MX51_PIN_GPIO1_8, IOMUX_CONFIG_ALT0);
                *absent = gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_8));
-
+       }
        return 0;
 }
 
-- 
1.6.0.4


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to