]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mxs_gpio: fix the handling in gpio_direction_output()
authorMichael Heimpold <mhei@heimpold.de>
Sun, 3 Nov 2013 21:59:26 +0000 (22:59 +0100)
committerStefano Babic <sbabic@denx.de>
Wed, 13 Nov 2013 09:09:09 +0000 (10:09 +0100)
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>
Acked-by: Stefano Babic <sbabic@denx.de>
drivers/gpio/mxs_gpio.c

index d9a7a3aaf663e971b4b28b96801e4f402a6ced51..da0199b168ad68c8c69307e829c8fa715e3a86e4 100644 (file)
@@ -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;
 }