]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
m68knommu: add to_irq function so we can map gpios to external interrupts.
authorSteven King <sfking@fdwdc.com>
Wed, 21 May 2014 23:00:30 +0000 (16:00 -0700)
committerGreg Ungerer <gerg@uclinux.org>
Mon, 26 May 2014 03:28:37 +0000 (13:28 +1000)
Singed-off-by: Steven King <sfking@fdwdc.com>
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
arch/m68k/platform/coldfire/gpio.c

index 9cd2b5c70519a63c8614c5995b5876845bb9d9fc..ab9ac4110877a62af57693ea1f694dec3af7f930 100644 (file)
@@ -147,6 +147,18 @@ void mcfgpio_free(struct gpio_chip *chip, unsigned offset)
        __mcfgpio_free(offset);
 }
 
+int mcfgpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+#if defined(MCFGPIO_IRQ_MIN)
+       if ((offset >= MCFGPIO_IRQ_MIN) && (offset < MCFGPIO_IRQ_MAX))
+#else
+       if (offset < MCFGPIO_IRQ_MAX)
+#endif
+               return MCFGPIO_IRQ_VECBASE + offset;
+       else
+               return -EINVAL;
+}
+
 struct bus_type mcfgpio_subsys = {
        .name           = "gpio",
        .dev_name       = "gpio",
@@ -160,6 +172,7 @@ static struct gpio_chip mcfgpio_chip = {
        .direction_output       = mcfgpio_direction_output,
        .get                    = mcfgpio_get_value,
        .set                    = mcfgpio_set_value,
+       .to_irq                 = mcfgpio_to_irq,
        .base                   = 0,
        .ngpio                  = MCFGPIO_PIN_MAX,
 };