aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2007-10-02 09:28:01 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-10-15 13:53:55 -0400
commit3e0cc7ee045fb53e8215fed7442455c0cee0ee93 (patch)
tree0fc2829d0678224f95cbece240f28a7b58231d1c /arch
parent39cbd4896e39e2b93c33635a9abc1a4405827e14 (diff)
[ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put()
pxa_gpio_mode() is a universal call that fiddles with the GAFR (gpio alternate function register.) GAFR does not exist on PXA3 CPUs, but instead the alternate functions are controlled via the MFP support code. Platforms are expected to configure the MFP according to their needs in their platform support code rather than drivers. We extend this idea to the GAFR, and make the gpio_direction_*() functions purely operate on the GPIO level. This means platform support code is entirely responsible for configuring the GPIOs alternate functions on all PXA CPU types. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/generic.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 2263a84844a1..1c34946ee16e 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -105,6 +105,44 @@ int pxa_gpio_mode(int gpio_mode)
105 105
106EXPORT_SYMBOL(pxa_gpio_mode); 106EXPORT_SYMBOL(pxa_gpio_mode);
107 107
108int gpio_direction_input(unsigned gpio)
109{
110 unsigned long flags;
111 u32 mask;
112
113 if (gpio > pxa_last_gpio)
114 return -EINVAL;
115
116 mask = GPIO_bit(gpio);
117 local_irq_save(flags);
118 GPDR(gpio) &= ~mask;
119 local_irq_restore(flags);
120
121 return 0;
122}
123EXPORT_SYMBOL(gpio_direction_input);
124
125int gpio_direction_output(unsigned gpio, int value)
126{
127 unsigned long flags;
128 u32 mask;
129
130 if (gpio > pxa_last_gpio)
131 return -EINVAL;
132
133 mask = GPIO_bit(gpio);
134 local_irq_save(flags);
135 if (value)
136 GPSR(gpio) = mask;
137 else
138 GPCR(gpio) = mask;
139 GPDR(gpio) |= mask;
140 local_irq_restore(flags);
141
142 return 0;
143}
144EXPORT_SYMBOL(gpio_direction_output);
145
108/* 146/*
109 * Return GPIO level 147 * Return GPIO level
110 */ 148 */