From: Michael Heimpold Date: Sun, 3 Nov 2013 21:59:26 +0000 (+0100) Subject: mxs_gpio: fix the handling in gpio_direction_output() X-Git-Tag: v2014.01-rc3~9^2~47^2~50 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=ac135f66992f65959fcf8245f2ea8a9109a4a913 mxs_gpio: fix the handling in gpio_direction_output() 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 Acked-by: Stefano Babic --- diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index d9a7a3aaf6..da0199b168 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_set); - gpio_set_value(gpio, value); + writel(1 << PAD_PIN(gpio), ®->reg_set); + return 0; }