diff mbox

[U-Boot,1/5] mx53loco: Use gpio_direction_input prior to gpio_get_value

Message ID 1328704485-1505-1-git-send-email-festevam@gmail.com
State Accepted
Commit a091be766dc9d2ed16b8307668e13ec3182655e4
Delegated to: Stefano Babic
Headers show

Commit Message

Fabio Estevam Feb. 8, 2012, 12:34 p.m. UTC
Use gpio_direction_input prior to gpio_get_value.

Cc: Jason Liu <r64343@freescale.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 board/freescale/mx53loco/mx53loco.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Stefano Babic Feb. 8, 2012, 1:08 p.m. UTC | #1
On 08/02/2012 13:34, Fabio Estevam wrote:
> Use gpio_direction_input prior to gpio_get_value.
> 
> Cc: Jason Liu <r64343@freescale.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  board/freescale/mx53loco/mx53loco.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 

Hi Fabio,

> diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
> index e6345e7..c2c26f0 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -153,7 +153,9 @@ int board_mmc_getcd(struct mmc *mmc)
>  	int ret;
>  
>  	mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
> +	gpio_direction_input(75);
>  	mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
> +	gpio_direction_input(77);
>  

The patch makes clear that the GPIO is configured as input. However,
after a reset all GPIOs in the MX53 are configured as input. Do we need
such changes ?

Stefano
Fabio Estevam Feb. 8, 2012, 1:14 p.m. UTC | #2
On Wed, Feb 8, 2012 at 11:08 AM, Stefano Babic <sbabic@denx.de> wrote:

> The patch makes clear that the GPIO is configured as input. However,
> after a reset all GPIOs in the MX53 are configured as input. Do we need
> such changes ?

I would prefer to explicitly set gpio_direction_input rather than
depending on the reset value and I think it aligns with the GPIO API
mechanism used in the kernel as well.

Regards,

Fabio Estevam
Stefano Babic Feb. 8, 2012, 1:17 p.m. UTC | #3
On 08/02/2012 14:14, Fabio Estevam wrote:
> On Wed, Feb 8, 2012 at 11:08 AM, Stefano Babic <sbabic@denx.de> wrote:
> 
>> The patch makes clear that the GPIO is configured as input. However,
>> after a reset all GPIOs in the MX53 are configured as input. Do we need
>> such changes ?
> 
> I would prefer to explicitly set gpio_direction_input rather than
> depending on the reset value and I think it aligns with the GPIO API
> mechanism used in the kernel as well.

Ok, good reasons.

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Jason Liu Feb. 9, 2012, 2:30 a.m. UTC | #4
2012/2/8 Fabio Estevam <festevam@gmail.com>:
> Use gpio_direction_input prior to gpio_get_value.
>
> Cc: Jason Liu <r64343@freescale.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Acked-by: Jason Liu <r64343@freescale.com>

> ---
>  board/freescale/mx53loco/mx53loco.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
> index e6345e7..c2c26f0 100644
> --- a/board/freescale/mx53loco/mx53loco.c
> +++ b/board/freescale/mx53loco/mx53loco.c
> @@ -153,7 +153,9 @@ int board_mmc_getcd(struct mmc *mmc)
>        int ret;
>
>        mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
> +       gpio_direction_input(75);
>        mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
> +       gpio_direction_input(77);
>
>        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
>                ret = !gpio_get_value(77); /* GPIO3_13 */
> --
> 1.7.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Stefano Babic Feb. 9, 2012, 4:58 p.m. UTC | #5
On 08/02/2012 13:34, Fabio Estevam wrote:
> Use gpio_direction_input prior to gpio_get_value.
> 
> Cc: Jason Liu <r64343@freescale.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index e6345e7..c2c26f0 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -153,7 +153,9 @@  int board_mmc_getcd(struct mmc *mmc)
 	int ret;
 
 	mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
+	gpio_direction_input(75);
 	mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
+	gpio_direction_input(77);
 
 	if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
 		ret = !gpio_get_value(77); /* GPIO3_13 */