提交 7f4f69f9 编写于 作者: J Joachim Eastwood 提交者: Mike Frysinger

Blackfin: GPIO: implement to_irq handler

This makes it possible to support IRQs coming from off-chip GPIO
controllers.
Signed-off-by: NJoachim Eastwood <joachim.eastwood@jotron.com>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
上级 f8e6dbff
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/compiler.h>
/*********************************************************** /***********************************************************
* *
* FUNCTIONS: Blackfin General Purpose Ports Access Functions * FUNCTIONS: Blackfin General Purpose Ports Access Functions
...@@ -223,6 +225,9 @@ int bfin_gpio_direction_output(unsigned gpio, int value); ...@@ -223,6 +225,9 @@ int bfin_gpio_direction_output(unsigned gpio, int value);
int bfin_gpio_get_value(unsigned gpio); int bfin_gpio_get_value(unsigned gpio);
void bfin_gpio_set_value(unsigned gpio, int value); void bfin_gpio_set_value(unsigned gpio, int value);
#include <asm/irq.h>
#include <asm/errno.h>
#ifdef CONFIG_GPIOLIB #ifdef CONFIG_GPIOLIB
#include <asm-generic/gpio.h> /* cansleep wrappers */ #include <asm-generic/gpio.h> /* cansleep wrappers */
...@@ -247,6 +252,11 @@ static inline int gpio_cansleep(unsigned int gpio) ...@@ -247,6 +252,11 @@ static inline int gpio_cansleep(unsigned int gpio)
return __gpio_cansleep(gpio); return __gpio_cansleep(gpio);
} }
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
#else /* !CONFIG_GPIOLIB */ #else /* !CONFIG_GPIOLIB */
static inline int gpio_request(unsigned gpio, const char *label) 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,10 +289,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
return bfin_gpio_set_value(gpio, value); return bfin_gpio_set_value(gpio, value);
} }
#include <asm-generic/gpio.h> /* cansleep wrappers */
#endif /* !CONFIG_GPIOLIB */
#include <asm/irq.h>
static inline int gpio_to_irq(unsigned gpio) static inline int gpio_to_irq(unsigned gpio)
{ {
if (likely(gpio < MAX_BLACKFIN_GPIOS)) if (likely(gpio < MAX_BLACKFIN_GPIOS))
...@@ -291,6 +297,9 @@ static inline int gpio_to_irq(unsigned gpio) ...@@ -291,6 +297,9 @@ static inline int gpio_to_irq(unsigned gpio)
return -EINVAL; return -EINVAL;
} }
#include <asm-generic/gpio.h> /* cansleep wrappers */
#endif /* !CONFIG_GPIOLIB */
static inline int irq_to_gpio(unsigned irq) static inline int irq_to_gpio(unsigned irq)
{ {
return (irq - GPIO_IRQ_BASE); return (irq - GPIO_IRQ_BASE);
......
...@@ -1319,6 +1319,11 @@ void bfin_gpiolib_gpio_free(struct gpio_chip *chip, unsigned gpio) ...@@ -1319,6 +1319,11 @@ void bfin_gpiolib_gpio_free(struct gpio_chip *chip, unsigned gpio)
return bfin_gpio_free(gpio); return bfin_gpio_free(gpio);
} }
int bfin_gpiolib_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
{
return gpio + GPIO_IRQ_BASE;
}
static struct gpio_chip bfin_chip = { static struct gpio_chip bfin_chip = {
.label = "BFIN-GPIO", .label = "BFIN-GPIO",
.direction_input = bfin_gpiolib_direction_input, .direction_input = bfin_gpiolib_direction_input,
...@@ -1327,6 +1332,7 @@ static struct gpio_chip bfin_chip = { ...@@ -1327,6 +1332,7 @@ static struct gpio_chip bfin_chip = {
.set = bfin_gpiolib_set_value, .set = bfin_gpiolib_set_value,
.request = bfin_gpiolib_gpio_request, .request = bfin_gpiolib_gpio_request,
.free = bfin_gpiolib_gpio_free, .free = bfin_gpiolib_gpio_free,
.to_irq = bfin_gpiolib_gpio_to_irq,
.base = 0, .base = 0,
.ngpio = MAX_BLACKFIN_GPIOS, .ngpio = MAX_BLACKFIN_GPIOS,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册