public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mxs_gpio: fix the handling in gpio_direction_output()
@ 2013-11-03 21:59 Michael Heimpold
  2013-11-04  9:08 ` Stefano Babic
  2013-11-13  9:13 ` Stefano Babic
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Heimpold @ 2013-11-03 21:59 UTC (permalink / raw)
  To: u-boot

Setting the direction and an output value should be done by
1) set the desired output value,
2) switch to output.

If this is done in the inverse order, there can be a glitch on
the GPIO line.

This patch fixes this by using the order as described above.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
---
 drivers/gpio/mxs_gpio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
index d9a7a3a..da0199b 100644
--- a/drivers/gpio/mxs_gpio.c
+++ b/drivers/gpio/mxs_gpio.c
@@ -95,10 +95,10 @@ int gpio_direction_output(unsigned gpio, int value)
 	struct mxs_register_32 *reg =
 		(struct mxs_register_32 *)(MXS_PINCTRL_BASE + offset);
 
-	writel(1 << PAD_PIN(gpio), &reg->reg_set);
-
 	gpio_set_value(gpio, value);
 
+	writel(1 << PAD_PIN(gpio), &reg->reg_set);
+
 	return 0;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] mxs_gpio: fix the handling in gpio_direction_output()
  2013-11-03 21:59 [U-Boot] [PATCH] mxs_gpio: fix the handling in gpio_direction_output() Michael Heimpold
@ 2013-11-04  9:08 ` Stefano Babic
  2013-11-13  9:13 ` Stefano Babic
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2013-11-04  9:08 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On 03/11/2013 22:59, Michael Heimpold wrote:
> Setting the direction and an output value should be done by
> 1) set the desired output value,
> 2) switch to output.
> 
> If this is done in the inverse order, there can be a glitch on
> the GPIO line.
> 
> This patch fixes this by using the order as described above.
> 
> Signed-off-by: Michael Heimpold <mhei@heimpold.de>
> ---
>  drivers/gpio/mxs_gpio.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
> index d9a7a3a..da0199b 100644
> --- a/drivers/gpio/mxs_gpio.c
> +++ b/drivers/gpio/mxs_gpio.c
> @@ -95,10 +95,10 @@ int gpio_direction_output(unsigned gpio, int value)
>  	struct mxs_register_32 *reg =
>  		(struct mxs_register_32 *)(MXS_PINCTRL_BASE + offset);
>  
> -	writel(1 << PAD_PIN(gpio), &reg->reg_set);
> -
>  	gpio_set_value(gpio, value);
>  
> +	writel(1 << PAD_PIN(gpio), &reg->reg_set);
> +

Yes, we had the same fix for mxc (commit
04c79cbd5f8f773aa7823feec6e77862e7e6426f)

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

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] mxs_gpio: fix the handling in gpio_direction_output()
  2013-11-03 21:59 [U-Boot] [PATCH] mxs_gpio: fix the handling in gpio_direction_output() Michael Heimpold
  2013-11-04  9:08 ` Stefano Babic
@ 2013-11-13  9:13 ` Stefano Babic
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2013-11-13  9:13 UTC (permalink / raw)
  To: u-boot

On 03/11/2013 22:59, Michael Heimpold wrote:
> Setting the direction and an output value should be done by
> 1) set the desired output value,
> 2) switch to output.
> 
> If this is done in the inverse order, there can be a glitch on
> the GPIO line.
> 
> This patch fixes this by using the order as described above.
> 
> Signed-off-by: Michael Heimpold <mhei@heimpold.de>
> ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-13  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-03 21:59 [U-Boot] [PATCH] mxs_gpio: fix the handling in gpio_direction_output() Michael Heimpold
2013-11-04  9:08 ` Stefano Babic
2013-11-13  9:13 ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox