aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-03-03 15:43:23 -0500
committerTony Lindgren <tony@atomide.com>2008-04-14 12:57:05 -0400
commit52e3134423c3af4431fedb34f77e31cfff91e0c3 (patch)
tree0f1b92e46a3c3370d40789dc598f29bc00679f6c /include
parent120dd64cacd4fb796bca0acba3665553f1d9ecaa (diff)
ARM: OMAP: Use gpiolib
Update OMAP to use the new GPIO implementation framework. This is just a quick'n'dirty update ... more code could now be removed, ideally as part of cleaning up the entire OMAP GPIO infrastructure ... Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/arch-omap/gpio.h57
1 files changed, 15 insertions, 42 deletions
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
index 164da09be095..86621a04cd8f 100644
--- a/include/asm-arm/arch-omap/gpio.h
+++ b/include/asm-arm/arch-omap/gpio.h
@@ -82,62 +82,35 @@ extern void omap_set_gpio_debounce_time(int gpio, int enable);
82 82
83/*-------------------------------------------------------------------------*/ 83/*-------------------------------------------------------------------------*/
84 84
85/* wrappers for "new style" GPIO calls. the old OMAP-specfic ones should 85/* Wrappers for "new style" GPIO calls, using the new infrastructure
86 * eventually be removed (along with this errno.h inclusion), and maybe 86 * which lets us plug in FPGA, I2C, and other implementations.
87 * gpios should put MPUIOs last too. 87 * *
88 * The original OMAP-specfic calls should eventually be removed.
88 */ 89 */
89 90
90#include <asm/errno.h> 91#include <linux/errno.h>
91 92#include <asm-generic/gpio.h>
92static inline int gpio_request(unsigned gpio, const char *label)
93{
94 return omap_request_gpio(gpio);
95}
96
97static inline void gpio_free(unsigned gpio)
98{
99 omap_free_gpio(gpio);
100}
101
102static inline int __gpio_set_direction(unsigned gpio, int is_input)
103{
104 if (cpu_class_is_omap2()) {
105 if (gpio > OMAP_MAX_GPIO_LINES)
106 return -EINVAL;
107 } else {
108 if (gpio > (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */))
109 return -EINVAL;
110 }
111 omap_set_gpio_direction(gpio, is_input);
112 return 0;
113}
114
115static inline int gpio_direction_input(unsigned gpio)
116{
117 return __gpio_set_direction(gpio, 1);
118}
119
120static inline int gpio_direction_output(unsigned gpio, int value)
121{
122 omap_set_gpio_dataout(gpio, value);
123 return __gpio_set_direction(gpio, 0);
124}
125 93
126static inline int gpio_get_value(unsigned gpio) 94static inline int gpio_get_value(unsigned gpio)
127{ 95{
128 return omap_get_gpio_datain(gpio); 96 return __gpio_get_value(gpio);
129} 97}
130 98
131static inline void gpio_set_value(unsigned gpio, int value) 99static inline void gpio_set_value(unsigned gpio, int value)
132{ 100{
133 omap_set_gpio_dataout(gpio, value); 101 __gpio_set_value(gpio, value);
134} 102}
135 103
136#include <asm-generic/gpio.h> /* cansleep wrappers */ 104static inline int gpio_cansleep(unsigned gpio)
105{
106 return __gpio_cansleep(gpio);
107}
137 108
138static inline int gpio_to_irq(unsigned gpio) 109static inline int gpio_to_irq(unsigned gpio)
139{ 110{
140 return OMAP_GPIO_IRQ(gpio); 111 if (gpio < (OMAP_MAX_GPIO_LINES + 16))
112 return OMAP_GPIO_IRQ(gpio);
113 return -EINVAL;
141} 114}
142 115
143static inline int irq_to_gpio(unsigned irq) 116static inline int irq_to_gpio(unsigned irq)