diff options
Diffstat (limited to 'arch/arm/mach-ixp4xx/common.c')
-rw-r--r-- | arch/arm/mach-ixp4xx/common.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 09edea9779e6..f5cae1e46b7e 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -105,6 +105,29 @@ static signed char irq2gpio[32] = { | |||
105 | 7, 8, 9, 10, 11, 12, -1, -1, | 105 | 7, 8, 9, 10, 11, 12, -1, -1, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | int gpio_to_irq(int gpio) | ||
109 | { | ||
110 | int irq; | ||
111 | |||
112 | for (irq = 0; irq < 32; irq++) { | ||
113 | if (irq2gpio[irq] == gpio) | ||
114 | return irq; | ||
115 | } | ||
116 | return -EINVAL; | ||
117 | } | ||
118 | EXPORT_SYMBOL(gpio_to_irq); | ||
119 | |||
120 | int irq_to_gpio(int irq) | ||
121 | { | ||
122 | int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL; | ||
123 | |||
124 | if (gpio == -1) | ||
125 | return -EINVAL; | ||
126 | |||
127 | return gpio; | ||
128 | } | ||
129 | EXPORT_SYMBOL(irq_to_gpio); | ||
130 | |||
108 | static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) | 131 | static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) |
109 | { | 132 | { |
110 | int line = irq2gpio[irq]; | 133 | int line = irq2gpio[irq]; |
@@ -172,7 +195,7 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) | |||
172 | 195 | ||
173 | static void ixp4xx_irq_mask(unsigned int irq) | 196 | static void ixp4xx_irq_mask(unsigned int irq) |
174 | { | 197 | { |
175 | if (cpu_is_ixp46x() && irq >= 32) | 198 | if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) |
176 | *IXP4XX_ICMR2 &= ~(1 << (irq - 32)); | 199 | *IXP4XX_ICMR2 &= ~(1 << (irq - 32)); |
177 | else | 200 | else |
178 | *IXP4XX_ICMR &= ~(1 << irq); | 201 | *IXP4XX_ICMR &= ~(1 << irq); |
@@ -195,7 +218,7 @@ static void ixp4xx_irq_unmask(unsigned int irq) | |||
195 | if (!(ixp4xx_irq_edge & (1 << irq))) | 218 | if (!(ixp4xx_irq_edge & (1 << irq))) |
196 | ixp4xx_irq_ack(irq); | 219 | ixp4xx_irq_ack(irq); |
197 | 220 | ||
198 | if (cpu_is_ixp46x() && irq >= 32) | 221 | if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) |
199 | *IXP4XX_ICMR2 |= (1 << (irq - 32)); | 222 | *IXP4XX_ICMR2 |= (1 << (irq - 32)); |
200 | else | 223 | else |
201 | *IXP4XX_ICMR |= (1 << irq); | 224 | *IXP4XX_ICMR |= (1 << irq); |
@@ -219,7 +242,7 @@ void __init ixp4xx_init_irq(void) | |||
219 | /* Disable all interrupt */ | 242 | /* Disable all interrupt */ |
220 | *IXP4XX_ICMR = 0x0; | 243 | *IXP4XX_ICMR = 0x0; |
221 | 244 | ||
222 | if (cpu_is_ixp46x()) { | 245 | if (cpu_is_ixp46x() || cpu_is_ixp43x()) { |
223 | /* Route upper 32 sources to IRQ instead of FIQ */ | 246 | /* Route upper 32 sources to IRQ instead of FIQ */ |
224 | *IXP4XX_ICLR2 = 0x00; | 247 | *IXP4XX_ICLR2 = 0x00; |
225 | 248 | ||