mpc85xx: make gpio_direction_output respect value
authorChris Packham <chris.packham@alliedtelesis.co.nz>
Thu, 6 Sep 2012 17:28:35 +0000 (17:28 +0000)
committerAndy Fleming <afleming@freescale.com>
Mon, 22 Oct 2012 08:03:16 +0000 (03:03 -0500)
Users of familiar with the Linux gpiolib API expect that value parameter
to gpio_direction_output reflects the initial state of the output pin.
gpio_direction_output was always driving the output low, now it drives
it high or low according to the value provided.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Andy Fleming <afleming@freescale.com>
arch/powerpc/include/asm/mpc85xx_gpio.h

index 5a608a5d0f836c781c1e4dcc45ba5e9d4def19eb..2aed5148ef5407f2bed158e053af397731ef23ad 100644 (file)
@@ -98,7 +98,10 @@ static inline int gpio_direction_input(unsigned gpio)
 
 static inline int gpio_direction_output(unsigned gpio, int value)
 {
-       mpc85xx_gpio_set_low(1U << gpio);
+       if (value)
+               mpc85xx_gpio_set_high(1U << gpio);
+       else
+               mpc85xx_gpio_set_low(1U << gpio);
        return 0;
 }