From patchwork Fri Sep 7 03:28:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot] mpc85xx: make gpio_direction_output respect value From: Chris Packham X-Patchwork-Id: 182307 Message-Id: <1346988515-16849-1-git-send-email-judge.packham@gmail.com> To: u-boot@lists.denx.de Cc: Peter Tyser , Andy Fleming , Chris Packham , Kumar Gala , Kyle Moffett Date: Fri, 7 Sep 2012 15:28:35 +1200 From: Chris Packham 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 Cc: Kyle Moffett Cc: Andy Fleming Cc: Peter Tyser Cc: Kumar Gala --- arch/powerpc/include/asm/mpc85xx_gpio.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h b/arch/powerpc/include/asm/mpc85xx_gpio.h index 5a608a5..2aed514 100644 --- a/arch/powerpc/include/asm/mpc85xx_gpio.h +++ b/arch/powerpc/include/asm/mpc85xx_gpio.h @@ -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; }