Blackfin arch: Finalize the generic gpio support - add gpio_to_irq and irq_to_gpio
authorMichael Hennerich <michael.hennerich@analog.com>
Tue, 24 Jul 2007 07:35:53 +0000 (15:35 +0800)
committerBryan Wu <bryan.wu@analog.com>
Tue, 24 Jul 2007 07:35:53 +0000 (15:35 +0800)
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
include/asm-blackfin/gpio.h
include/asm-blackfin/mach-bf533/irq.h
include/asm-blackfin/mach-bf537/irq.h
include/asm-blackfin/mach-bf548/irq.h
include/asm-blackfin/mach-bf561/irq.h

index 7480cfa7e2d64304c58ff924b05fbfc385ad8bf6..e714363bc4edcdba2428da920ca1f6c1af19af64 100644 (file)
@@ -421,6 +421,19 @@ unsigned short gpio_get_value(unsigned short gpio);
 void gpio_direction_input(unsigned short gpio);
 void gpio_direction_output(unsigned short gpio);
 
+#include <asm-generic/gpio.h>          /* cansleep wrappers */
+#include <asm/irq.h>
+
+static inline int gpio_to_irq(unsigned gpio)
+{
+       return (gpio + GPIO_IRQ_BASE);
+}
+
+static inline int irq_to_gpio(unsigned irq)
+{
+       return (irq - GPIO_IRQ_BASE);
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ARCH_BLACKFIN_GPIO_H__ */
index 9879e68e315c71a5c7afc8b26b60e4f9101c1c75..452fb825d891122ce674eda8b169538dcfdc0f85 100644 (file)
@@ -128,6 +128,8 @@ Core        Emulation               **
 #define IRQ_PF14               47
 #define IRQ_PF15               48
 
+#define GPIO_IRQ_BASE          IRQ_PF0
+
 #ifdef CONFIG_IRQCHIP_DEMUX_GPIO
 #define        NR_IRQS         (IRQ_PF15+1)
 #else
index 8af2a832ef6b832d4290fdea815af7ce3921922e..36c44bc1a917d8acd6a6da642f0dc033234d2e05 100644 (file)
@@ -160,6 +160,8 @@ Core        Emulation               **
 #define IRQ_PH14        96
 #define IRQ_PH15        97
 
+#define GPIO_IRQ_BASE  IRQ_PF0
+
 #ifdef CONFIG_IRQCHIP_DEMUX_GPIO
 #define NR_IRQS     (IRQ_PH15+1)
 #else
index e548d3cd81e31b3b0099f4d25536b763b5ea35a3..21f06f710be6609db0a91ef0b7e8f19e78ae0424 100644 (file)
@@ -337,6 +337,8 @@ Events         (highest priority)  EMU         0
 #define IRQ_PJ14       BFIN_PJ_IRQ(14)         /* N/A */
 #define IRQ_PJ15       BFIN_PJ_IRQ(15)         /* N/A */
 
+#define GPIO_IRQ_BASE  IRQ_PA0
+
 #ifdef CONFIG_IRQCHIP_DEMUX_GPIO
 #define NR_IRQS     (IRQ_PJ15+1)
 #else
index a753ce720d74a935ee135228e863f099b04d984c..12789927db3d976ec7e807a6416d23d477841244 100644 (file)
 #define IRQ_PF46               119
 #define IRQ_PF47               120
 
+#define GPIO_IRQ_BASE          IRQ_PF0
+
 #ifdef CONFIG_IRQCHIP_DEMUX_GPIO
 #define NR_IRQS                        (IRQ_PF47 + 1)
 #else