diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-06 12:43:42 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-07 09:21:04 +0200 |
commit | 74fe5182a816dab999fb6efa7fbb570a557c5026 (patch) | |
tree | 22e04e241996555267c729e43057298dc50326a2 /arch/arm/mach-pxa | |
parent | 3086fd8bb43ae6350d057e8a1534cfcc2f7f7558 (diff) | |
download | barebox-74fe5182a816dab999fb6efa7fbb570a557c5026.tar.gz barebox-74fe5182a816dab999fb6efa7fbb570a557c5026.tar.xz |
ARM: PXA: use generic gpio prototypes
PXA is the only architecture that uses its own prototypes for
the gpio functions because it uses static inline variants of
these functions. For the sake of streamlining with other architectures
move them to a C file and use the generic gpio prototypes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/gpio.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/mach/gpio.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/include/plat/gpio.h | 32 |
3 files changed, 33 insertions, 32 deletions
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c index 4e98493e73..7dd6ac0648 100644 --- a/arch/arm/mach-pxa/gpio.c +++ b/arch/arm/mach-pxa/gpio.c @@ -66,3 +66,35 @@ int __init pxa_init_gpio(int start, int end) return 0; } + +int gpio_get_value(unsigned gpio) +{ + return GPLR(gpio) & GPIO_bit(gpio); +} + +void gpio_set_value(unsigned gpio, int value) +{ + if (value) + GPSR(gpio) = GPIO_bit(gpio); + else + GPCR(gpio) = GPIO_bit(gpio); +} + +int gpio_direction_input(unsigned gpio) +{ + if (__gpio_is_inverted(gpio)) + GPDR(gpio) |= GPIO_bit(gpio); + else + GPDR(gpio) &= ~GPIO_bit(gpio); + return 0; +} + +int gpio_direction_output(unsigned gpio, int value) +{ + gpio_set_value(gpio, value); + if (__gpio_is_inverted(gpio)) + GPDR(gpio) &= ~GPIO_bit(gpio); + else + GPDR(gpio) |= GPIO_bit(gpio); + return 0; +} diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h index e6724e1caf..950bb1a343 100644 --- a/arch/arm/mach-pxa/include/mach/gpio.h +++ b/arch/arm/mach-pxa/include/mach/gpio.h @@ -20,6 +20,7 @@ #ifndef __ASM_ARCH_PXA_GPIO_H #define __ASM_ARCH_PXA_GPIO_H +#include <asm-generic/gpio.h> #include <mach/hardware.h> #define GPIO_REGS_VIRT (0x40E00000) diff --git a/arch/arm/mach-pxa/include/plat/gpio.h b/arch/arm/mach-pxa/include/plat/gpio.h index 4c7b5266fb..35f90715e0 100644 --- a/arch/arm/mach-pxa/include/plat/gpio.h +++ b/arch/arm/mach-pxa/include/plat/gpio.h @@ -31,38 +31,6 @@ #define GFER_OFFSET 0x3C #define GEDR_OFFSET 0x48 -static inline int gpio_get_value(unsigned gpio) -{ - return GPLR(gpio) & GPIO_bit(gpio); -} - -static inline void gpio_set_value(unsigned gpio, int value) -{ - if (value) - GPSR(gpio) = GPIO_bit(gpio); - else - GPCR(gpio) = GPIO_bit(gpio); -} - -static inline int gpio_direction_input(unsigned gpio) -{ - if (__gpio_is_inverted(gpio)) - GPDR(gpio) |= GPIO_bit(gpio); - else - GPDR(gpio) &= ~GPIO_bit(gpio); - return 0; -} - -static inline int gpio_direction_output(unsigned gpio, int value) -{ - gpio_set_value(gpio, value); - if (__gpio_is_inverted(gpio)) - GPDR(gpio) &= ~GPIO_bit(gpio); - else - GPDR(gpio) |= GPIO_bit(gpio); - return 0; -} - /* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85). * Those cases currently cause holes in the GPIO number space, the * actual number of the last GPIO is recorded by 'pxa_last_gpio'. |