]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-arm/arch-pxa/gpio.h
ns9xxx: prepare for adding support for Digi ns921x processors
[linux-2.6-omap-h63xx.git] / include / asm-arm / arch-pxa / gpio.h
index 3d348a3511575fb4083359a944740fe12746098c..bdbf5f9ffdd5df5694deb4ffd664f9e0d5ac9d29 100644 (file)
 #include <asm/irq.h>
 #include <asm/hardware.h>
 
-static inline int gpio_request(unsigned gpio, const char *label)
-{
-       return 0;
-}
+#include <asm-generic/gpio.h>
 
-static inline void gpio_free(unsigned gpio)
-{
-       return;
-}
-
-static inline int gpio_direction_input(unsigned gpio)
-{
-       return pxa_gpio_mode(gpio | GPIO_IN);
-}
 
-static inline int gpio_direction_output(unsigned gpio)
-{
-       return pxa_gpio_mode(gpio | GPIO_OUT);
-}
+/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
+ * Those cases currently cause holes in the GPIO number space.
+ */
+#define NR_BUILTIN_GPIO 128
 
-static inline int __gpio_get_value(unsigned gpio)
+static inline int gpio_get_value(unsigned gpio)
 {
-       return GPLR(gpio) & GPIO_bit(gpio);
+       if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
+               return GPLR(gpio) & GPIO_bit(gpio);
+       else
+               return __gpio_get_value(gpio);
 }
 
-#define gpio_get_value(gpio)                   \
-       (__builtin_constant_p(gpio) ?           \
-        __gpio_get_value(gpio) :               \
-        pxa_gpio_get_value(gpio))
-
-static inline void __gpio_set_value(unsigned gpio, int value)
+static inline void gpio_set_value(unsigned gpio, int value)
 {
-       if (value)
-               GPSR(gpio) = GPIO_bit(gpio);
-       else
-               GPCR(gpio) = GPIO_bit(gpio);
+       if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
+               if (value)
+                       GPSR(gpio) = GPIO_bit(gpio);
+               else
+                       GPCR(gpio) = GPIO_bit(gpio);
+       } else {
+               __gpio_set_value(gpio, value);
+       }
 }
 
-#define gpio_set_value(gpio,value)             \
-       (__builtin_constant_p(gpio) ?           \
-        __gpio_set_value(gpio, value) :        \
-        pxa_gpio_set_value(gpio, value))
-
-#include <asm-generic/gpio.h>                  /* cansleep wrappers */
+#define gpio_cansleep __gpio_cansleep
 
 #define gpio_to_irq(gpio)      IRQ_GPIO(gpio)
 #define irq_to_gpio(irq)       IRQ_TO_GPIO(irq)