[U-Boot] [PATCH 1/2] efikamx: Configure the pins as GPIOs prior to using gpio_get_value.

Marek Vasut marek.vasut at gmail.com
Mon Nov 21 15:20:49 CET 2011


> Configure the pins as GPIOs prior to using gpio_get_value
> 
> Cc: Marek Vasut <marek.vasut at gmail.com>
> Signed-off-by: Fabio Estevam <fabio.estevam at 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;
>  }

NAK. There should be some common function for setting up iomux of those pins. 
You souldn't set it in repeatedly called functions.

M


More information about the U-Boot mailing list