diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-01-06 13:06:25 +0300 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-03-09 16:22:37 +0300 |
commit | 0d9f768fce67a53b9c2296789129d4dfb3f4996b (patch) | |
tree | 5f5cfcfb48c924f6f4eef4a936061722dcb5e441 | |
parent | a58fbcd8ad17ddaa0c7aadbbbd20de4ebc807fa4 (diff) | |
download | linux-0d9f768fce67a53b9c2296789129d4dfb3f4996b.tar.xz |
[ARM] pxa: move pxa_gpio_mode() outside of generic gpio.c
Looks like we have to live with pxa_gpio_mode() for a while, giving
its presence is actually making gpio.c not generic enough, let's
move it temporarily outside before it can be fully purged.
Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r-- | arch/arm/mach-pxa/generic.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-pxa/gpio.c | 31 |
2 files changed, 31 insertions, 31 deletions
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 0ccc91c92c44..dc870dd93697 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c @@ -28,6 +28,7 @@ #include <mach/pxa-regs.h> #include <mach/reset.h> +#include <mach/pxa2xx-gpio.h> #include "generic.h" @@ -127,3 +128,33 @@ void __init pxa_map_io(void) iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); get_clk_frequency_khz(1); } + +/* + * Configure pins for GPIO or other functions + */ +int pxa_gpio_mode(int gpio_mode) +{ + unsigned long flags; + int gpio = gpio_mode & GPIO_MD_MASK_NR; + int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8; + int gafr; + + if (gpio > pxa_last_gpio) + return -EINVAL; + + local_irq_save(flags); + if (gpio_mode & GPIO_DFLT_LOW) + GPCR(gpio) = GPIO_bit(gpio); + else if (gpio_mode & GPIO_DFLT_HIGH) + GPSR(gpio) = GPIO_bit(gpio); + if (gpio_mode & GPIO_MD_MASK_DIR) + GPDR(gpio) |= GPIO_bit(gpio); + else + GPDR(gpio) &= ~GPIO_bit(gpio); + gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2)); + GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2)); + local_irq_restore(flags); + + return 0; +} +EXPORT_SYMBOL(pxa_gpio_mode); diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c index 198246019028..c9d9c702c7d5 100644 --- a/arch/arm/mach-pxa/gpio.c +++ b/arch/arm/mach-pxa/gpio.c @@ -21,7 +21,6 @@ #include <asm/gpio.h> #include <mach/hardware.h> #include <mach/pxa-regs.h> -#include <mach/pxa2xx-gpio.h> #include "generic.h" @@ -45,36 +44,6 @@ struct pxa_gpio_chip { int pxa_last_gpio; -/* - * Configure pins for GPIO or other functions - */ -int pxa_gpio_mode(int gpio_mode) -{ - unsigned long flags; - int gpio = gpio_mode & GPIO_MD_MASK_NR; - int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8; - int gafr; - - if (gpio > pxa_last_gpio) - return -EINVAL; - - local_irq_save(flags); - if (gpio_mode & GPIO_DFLT_LOW) - GPCR(gpio) = GPIO_bit(gpio); - else if (gpio_mode & GPIO_DFLT_HIGH) - GPSR(gpio) = GPIO_bit(gpio); - if (gpio_mode & GPIO_MD_MASK_DIR) - GPDR(gpio) |= GPIO_bit(gpio); - else - GPDR(gpio) &= ~GPIO_bit(gpio); - gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2)); - GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2)); - local_irq_restore(flags); - - return 0; -} -EXPORT_SYMBOL(pxa_gpio_mode); - static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { unsigned long flags; |