diff options
author | Joachim Eastwood <joachim.eastwood@jotron.com> | 2010-02-10 06:31:41 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-03-09 00:30:52 -0500 |
commit | 7f4f69f991146fa976cbc914a50285b2afc0ad93 (patch) | |
tree | 3cbcc6cdf3e433e2be68278b51a22aa7be9f9773 /arch/blackfin/include | |
parent | f8e6dbffa7a6cb3da3bcaf1fde3039896e1ac764 (diff) |
Blackfin: GPIO: implement to_irq handler
This makes it possible to support IRQs coming from off-chip GPIO
controllers.
Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r-- | arch/blackfin/include/asm/gpio.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 539468a05057..91bd2d7b9d55 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h | |||
@@ -70,6 +70,8 @@ | |||
70 | 70 | ||
71 | #ifndef __ASSEMBLY__ | 71 | #ifndef __ASSEMBLY__ |
72 | 72 | ||
73 | #include <linux/compiler.h> | ||
74 | |||
73 | /*********************************************************** | 75 | /*********************************************************** |
74 | * | 76 | * |
75 | * FUNCTIONS: Blackfin General Purpose Ports Access Functions | 77 | * FUNCTIONS: Blackfin General Purpose Ports Access Functions |
@@ -223,6 +225,9 @@ int bfin_gpio_direction_output(unsigned gpio, int value); | |||
223 | int bfin_gpio_get_value(unsigned gpio); | 225 | int bfin_gpio_get_value(unsigned gpio); |
224 | void bfin_gpio_set_value(unsigned gpio, int value); | 226 | void bfin_gpio_set_value(unsigned gpio, int value); |
225 | 227 | ||
228 | #include <asm/irq.h> | ||
229 | #include <asm/errno.h> | ||
230 | |||
226 | #ifdef CONFIG_GPIOLIB | 231 | #ifdef CONFIG_GPIOLIB |
227 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 232 | #include <asm-generic/gpio.h> /* cansleep wrappers */ |
228 | 233 | ||
@@ -247,6 +252,11 @@ static inline int gpio_cansleep(unsigned int gpio) | |||
247 | return __gpio_cansleep(gpio); | 252 | return __gpio_cansleep(gpio); |
248 | } | 253 | } |
249 | 254 | ||
255 | static inline int gpio_to_irq(unsigned gpio) | ||
256 | { | ||
257 | return __gpio_to_irq(gpio); | ||
258 | } | ||
259 | |||
250 | #else /* !CONFIG_GPIOLIB */ | 260 | #else /* !CONFIG_GPIOLIB */ |
251 | 261 | ||
252 | static inline int gpio_request(unsigned gpio, const char *label) | 262 | static inline int gpio_request(unsigned gpio, const char *label) |
@@ -279,10 +289,6 @@ static inline void gpio_set_value(unsigned gpio, int value) | |||
279 | return bfin_gpio_set_value(gpio, value); | 289 | return bfin_gpio_set_value(gpio, value); |
280 | } | 290 | } |
281 | 291 | ||
282 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
283 | #endif /* !CONFIG_GPIOLIB */ | ||
284 | #include <asm/irq.h> | ||
285 | |||
286 | static inline int gpio_to_irq(unsigned gpio) | 292 | static inline int gpio_to_irq(unsigned gpio) |
287 | { | 293 | { |
288 | if (likely(gpio < MAX_BLACKFIN_GPIOS)) | 294 | if (likely(gpio < MAX_BLACKFIN_GPIOS)) |
@@ -291,6 +297,9 @@ static inline int gpio_to_irq(unsigned gpio) | |||
291 | return -EINVAL; | 297 | return -EINVAL; |
292 | } | 298 | } |
293 | 299 | ||
300 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
301 | #endif /* !CONFIG_GPIOLIB */ | ||
302 | |||
294 | static inline int irq_to_gpio(unsigned irq) | 303 | static inline int irq_to_gpio(unsigned irq) |
295 | { | 304 | { |
296 | return (irq - GPIO_IRQ_BASE); | 305 | return (irq - GPIO_IRQ_BASE); |