From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleksandr G Zhadan Date: Fri, 27 Mar 2015 10:51:32 -0400 Subject: [U-Boot] [PATCH 1/2] mpc85xx gpio related header files changes to compile common cmd_gpio.c In-Reply-To: <1427415986.13051.48.camel@transmode.se> References: <55147741.80406@arcturusnetworks.com> <1427415986.13051.48.camel@transmode.se> Message-ID: <55156E74.7080405@arcturusnetworks.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Extra gpio bank argument at low level may be discussable, but IMPO we should not brake standard int gpio_set_value(unsigned gpio, int value) definition. And the reason of this patch is to fix: 1. Incompatibility in functions gpio_free() and gpio_set_value() definitions between and (void vs int) 2. Compilation error when build common/cmd_gpio.c for mpc85xx (p1020) On 03/26/2015 08:26 PM, Joakim Tjernlund wrote: > On Thu, 2015-03-26 at 17:16 -0400, Oleksandr G Zhadan wrote: >> From: Oleksandr Zhadan >> >> Signed-off-by: Oleksandr Zhadan >> Signed-off-by: Michael Durrant >> --- >> >> arch/powerpc/include/asm/arch-mpc85xx/gpio.h | 2 ++ >> arch/powerpc/include/asm/mpc85xx_gpio.h | 6 ++++-- >> 2 files changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h >> b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h >> index 8beed30..71794a8 100644 >> --- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h >> +++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h >> @@ -12,4 +12,6 @@ >> #ifndef __ASM_ARCH_MX85XX_GPIO_H >> #define __ASM_ARCH_MX85XX_GPIO_H >> >> +#include >> + >> #endif >> diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h >> b/arch/powerpc/include/asm/mpc85xx_gpio.h >> index 87bb4a0..1d0dad4 100644 >> --- a/arch/powerpc/include/asm/mpc85xx_gpio.h >> +++ b/arch/powerpc/include/asm/mpc85xx_gpio.h >> @@ -72,9 +72,10 @@ static inline int gpio_request(unsigned gpio, const >> char *label) >> return 0; >> } >> >> -static inline void gpio_free(unsigned gpio) >> +static inline int gpio_free(unsigned gpio) >> { >> /* Compatibility shim */ >> + return 0; >> } >> >> static inline int gpio_direction_input(unsigned gpio) >> @@ -97,12 +98,13 @@ static inline int gpio_get_value(unsigned gpio) >> return !!mpc85xx_gpio_get(1U << gpio); >> } >> >> -static inline void gpio_set_value(unsigned gpio, int value) >> +static inline int gpio_set_value(unsigned gpio, int value) >> { >> if (value) >> mpc85xx_gpio_set_high(1U << gpio); >> else >> mpc85xx_gpio_set_low(1U << gpio); >> + return 0; >> } > > mpc85xx_gpio_xxx really needs an extra bank argument such as: > static inline void my_mpc85xx_gpio_set(unsigned int bank, unsigned int mask, > unsigned int dir, unsigned int val) > { > ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + > bank * 0x1000); > .... > > so one can choose which GPIO bank to use > > Jocke > > -- Oleksandr Zhadan Arcturus Networks T 416 621-0125 x235 F 416 621-0190