mxc_gpio: Correct the GPIO handling in gpio_direction_output()
Subsystems (2)
PATCH 1/1 mxc_gpio: Correct the GPIO handling in gpio_direction_output()
Setting the direction and an output value should be done by
First, set the desired output value.
Then, switch to output.
If this is done in the inverse order, like at the moment, there can be a glitch on the GPIO line while switching first the old output value and aftwards the new one.
Fix this by inverting the order of the direction/set_value calls.
--- drivers/gpio/mxc_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/mxc_gpio.c +2 -2
@@ -143,10 +143,10 @@ int gpio_direction_input(unsigned gpio)int gpio_direction_output (unsigned gpio,int value) { -int ret =mxc_gpio_direction (gpio,MXC_GPIO_DIRECTION_OUT ); +int ret =gpio_set_value (gpio, value);if (ret <0 )return ret; -return gpio_set_value (gpio, value); +return mxc_gpio_direction (gpio,MXC_GPIO_DIRECTION_OUT ); }
Signature · 1 line
1.8.2
PATCH 1/1 mxc_gpio: Correct the GPIO handling in gpio_direction_output()
Quoted 4 lines · Dirk Behme
Setting the direction and an output value should be done by
First, set the desired output value.
Quoted 8 lines
Then, switch to output.
If this is done in the inverse order, like at the moment, there can be a glitch on the GPIO line while switching first the old output value and aftwards the new one.
Fix this by inverting the order of the direction/set_value calls.
Right, thanks to fix this !
Quoted 14 lines
Signed-off-by Dirk Behme <[email protected]>--- drivers/gpio/mxc_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/mxc_gpio.c +0
-0@@ -143,10 +143,10 @@ int gpio_direction_input(unsigned gpio)int gpio_direction_output (unsigned gpio,int value)
drivers/gpio/mxc_gpio.c int gpio_direction_input(unsigned gpio) · line 152
Quoted 10 lines
drivers/gpio/mxc_gpio.c +2
-2{ -int ret =mxc_gpio_direction (gpio,MXC_GPIO_DIRECTION_OUT ); +int ret =gpio_set_value (gpio, value);if (ret <0 )return ret; -return gpio_set_value (gpio, value); +return mxc_gpio_direction (gpio,MXC_GPIO_DIRECTION_OUT ); }
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/1 mxc_gpio: Correct the GPIO handling in gpio_direction_output()
In reply to Dirk BehmeQuoted 10 lines · Dirk Behme
Setting the direction and an output value should be done by
First, set the desired output value.
Then, switch to output.
If this is done in the inverse order, like at the moment, there can be a glitch on the GPIO line while switching first the old output value and aftwards the new one.
Quoted 5 lines
Fix this by inverting the order of the direction/set_value calls.
Signed-off-by Dirk Behme <[email protected]>---
Applied to u-boot-imx, thanks !
Best regards,
SWtefano Babic
Signature · 5 lines
===================================================================== 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 =====================================================================