aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2009-01-06 05:06:25 -0500
committerEric Miao <eric.miao@marvell.com>2009-03-09 09:22:37 -0400
commit0d9f768fce67a53b9c2296789129d4dfb3f4996b (patch)
tree5f5cfcfb48c924f6f4eef4a936061722dcb5e441
parenta58fbcd8ad17ddaa0c7aadbbbd20de4ebc807fa4 (diff)
[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.c31
-rw-r--r--arch/arm/mach-pxa/gpio.c31
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 @@
28 28
29#include <mach/pxa-regs.h> 29#include <mach/pxa-regs.h>
30#include <mach/reset.h> 30#include <mach/reset.h>
31#include <mach/pxa2xx-gpio.h>
31 32
32#include "generic.h" 33#include "generic.h"
33 34
@@ -127,3 +128,33 @@ void __init pxa_map_io(void)
127 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); 128 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
128 get_clk_frequency_khz(1); 129 get_clk_frequency_khz(1);
129} 130}
131
132/*
133 * Configure pins for GPIO or other functions
134 */
135int pxa_gpio_mode(int gpio_mode)
136{
137 unsigned long flags;
138 int gpio = gpio_mode & GPIO_MD_MASK_NR;
139 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
140 int gafr;
141
142 if (gpio > pxa_last_gpio)
143 return -EINVAL;
144
145 local_irq_save(flags);
146 if (gpio_mode & GPIO_DFLT_LOW)
147 GPCR(gpio) = GPIO_bit(gpio);
148 else if (gpio_mode & GPIO_DFLT_HIGH)
149 GPSR(gpio) = GPIO_bit(gpio);
150 if (gpio_mode & GPIO_MD_MASK_DIR)
151 GPDR(gpio) |= GPIO_bit(gpio);
152 else
153 GPDR(gpio) &= ~GPIO_bit(gpio);
154 gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
155 GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));
156 local_irq_restore(flags);
157
158 return 0;
159}
160EXPORT_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 @@
21#include <asm/gpio.h> 21#include <asm/gpio.h>
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/pxa-regs.h> 23#include <mach/pxa-regs.h>
24#include <mach/pxa2xx-gpio.h>
25 24
26#include "generic.h" 25#include "generic.h"
27 26
@@ -45,36 +44,6 @@ struct pxa_gpio_chip {
45 44
46int pxa_last_gpio; 45int pxa_last_gpio;
47 46
48/*
49 * Configure pins for GPIO or other functions
50 */
51int pxa_gpio_mode(int gpio_mode)
52{
53 unsigned long flags;
54 int gpio = gpio_mode & GPIO_MD_MASK_NR;
55 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
56 int gafr;
57
58 if (gpio > pxa_last_gpio)
59 return -EINVAL;
60
61 local_irq_save(flags);
62 if (gpio_mode & GPIO_DFLT_LOW)
63 GPCR(gpio) = GPIO_bit(gpio);
64 else if (gpio_mode & GPIO_DFLT_HIGH)
65 GPSR(gpio) = GPIO_bit(gpio);
66 if (gpio_mode & GPIO_MD_MASK_DIR)
67 GPDR(gpio) |= GPIO_bit(gpio);
68 else
69 GPDR(gpio) &= ~GPIO_bit(gpio);
70 gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
71 GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));
72 local_irq_restore(flags);
73
74 return 0;
75}
76EXPORT_SYMBOL(pxa_gpio_mode);
77
78static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 47static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
79{ 48{
80 unsigned long flags; 49 unsigned long flags;