aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2012-02-11 09:56:01 -0500
committerNicolas Ferre <nicolas.ferre@atmel.com>2012-03-01 07:29:02 -0500
commitb134ce854ad63421bd5c7d34623a1337d525a435 (patch)
tree41a74511132c744a32e0fb02b4e9da5510cade3d
parent5bc067b71928d3f470d051847aefa55724fd0c95 (diff)
ARM: at91/gpio: add .to_irq gpio_chip handler
Replace the gpio_to_irq() macro by a plain gpiolib .to_irq() handler. This call is using the irqdomain to translate hardware to Linux IRQ numbers. The irq_to_gpio() macro is completely removed. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
-rw-r--r--arch/arm/mach-at91/gpio.c13
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h12
2 files changed, 13 insertions, 12 deletions
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 0dc3f5ead7bb..e8f5831e573d 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/device.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/irq.h> 17#include <linux/irq.h>
@@ -48,6 +49,7 @@ static int at91_gpiolib_direction_output(struct gpio_chip *chip,
48 unsigned offset, int val); 49 unsigned offset, int val);
49static int at91_gpiolib_direction_input(struct gpio_chip *chip, 50static int at91_gpiolib_direction_input(struct gpio_chip *chip,
50 unsigned offset); 51 unsigned offset);
52static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
51 53
52#define AT91_GPIO_CHIP(name, base_gpio, nr_gpio) \ 54#define AT91_GPIO_CHIP(name, base_gpio, nr_gpio) \
53 { \ 55 { \
@@ -59,6 +61,7 @@ static int at91_gpiolib_direction_input(struct gpio_chip *chip,
59 .set = at91_gpiolib_set, \ 61 .set = at91_gpiolib_set, \
60 .dbg_show = at91_gpiolib_dbg_show, \ 62 .dbg_show = at91_gpiolib_dbg_show, \
61 .base = base_gpio, \ 63 .base = base_gpio, \
64 .to_irq = at91_gpiolib_to_irq, \
62 .ngpio = nr_gpio, \ 65 .ngpio = nr_gpio, \
63 }, \ 66 }, \
64 } 67 }
@@ -640,6 +643,16 @@ static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
640 } 643 }
641} 644}
642 645
646static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset)
647{
648 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
649 int virq = irq_find_mapping(at91_gpio->domain, offset);
650
651 dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
652 chip->label, offset + chip->base, virq);
653 return virq;
654}
655
643static int __init at91_gpio_setup_clk(int idx) 656static int __init at91_gpio_setup_clk(int idx)
644{ 657{
645 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx]; 658 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index e3fd225121c7..7cf009be8d0d 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -204,18 +204,6 @@ extern int at91_get_gpio_value(unsigned pin);
204extern void at91_gpio_suspend(void); 204extern void at91_gpio_suspend(void);
205extern void at91_gpio_resume(void); 205extern void at91_gpio_resume(void);
206 206
207/*-------------------------------------------------------------------------*/
208
209/* wrappers for "new style" GPIO calls. the old AT91-specific ones should
210 * eventually be removed (along with this errno.h inclusion), and the
211 * gpio request/free calls should probably be implemented.
212 */
213
214#include <asm/errno.h>
215
216#define gpio_to_irq(gpio) (gpio + NR_AIC_IRQS)
217#define irq_to_gpio(irq) (irq - NR_AIC_IRQS)
218
219#endif /* __ASSEMBLY__ */ 207#endif /* __ASSEMBLY__ */
220 208
221#endif 209#endif