]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
set data register before direction register to prevent glitches when switching GPIO...
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 14 Jun 2012 09:17:24 +0000 (11:17 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 14 Jun 2012 09:17:24 +0000 (11:17 +0200)
drivers/gpio/mxc_gpio.c

index 661553552e6875d40cad956a82bcef9ac7057b57..8a92fec6fc47319d253832a1d2dd9417489d8a9d 100644 (file)
@@ -34,7 +34,7 @@ enum mxc_gpio_direction {
        MXC_GPIO_DIRECTION_OUT,
 };
 
-#define GPIO_TO_PORT(n)                (n / 32)
+#define GPIO_TO_PORT(n)                ((n) / 32)
 
 /* GPIO port description */
 static unsigned long gpio_ports[] = {
@@ -141,10 +141,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);
 }