diff options
-rw-r--r-- | arch/mips/include/asm/mach-rc32434/irq.h | 3 | ||||
-rw-r--r-- | arch/mips/rb532/irq.c | 27 |
2 files changed, 30 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-rc32434/irq.h b/arch/mips/include/asm/mach-rc32434/irq.h index 56738d8ec4e2..023a5b100ed0 100644 --- a/arch/mips/include/asm/mach-rc32434/irq.h +++ b/arch/mips/include/asm/mach-rc32434/irq.h | |||
@@ -30,4 +30,7 @@ | |||
30 | #define ETH0_RX_OVR_IRQ (GROUP3_IRQ_BASE + 9) | 30 | #define ETH0_RX_OVR_IRQ (GROUP3_IRQ_BASE + 9) |
31 | #define ETH0_TX_UND_IRQ (GROUP3_IRQ_BASE + 10) | 31 | #define ETH0_TX_UND_IRQ (GROUP3_IRQ_BASE + 10) |
32 | 32 | ||
33 | #define GPIO_MAPPED_IRQ_BASE GROUP4_IRQ_BASE | ||
34 | #define GPIO_MAPPED_IRQ_GROUP 4 | ||
35 | |||
33 | #endif /* __ASM_RC32434_IRQ_H */ | 36 | #endif /* __ASM_RC32434_IRQ_H */ |
diff --git a/arch/mips/rb532/irq.c b/arch/mips/rb532/irq.c index 549b46d2fcee..53eeb5e7bc5b 100644 --- a/arch/mips/rb532/irq.c +++ b/arch/mips/rb532/irq.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/system.h> | 46 | #include <asm/system.h> |
47 | 47 | ||
48 | #include <asm/mach-rc32434/irq.h> | 48 | #include <asm/mach-rc32434/irq.h> |
49 | #include <asm/mach-rc32434/gpio.h> | ||
49 | 50 | ||
50 | struct intr_group { | 51 | struct intr_group { |
51 | u32 mask; /* mask of valid bits in pending/mask registers */ | 52 | u32 mask; /* mask of valid bits in pending/mask registers */ |
@@ -150,6 +151,9 @@ static void rb532_disable_irq(unsigned int irq_nr) | |||
150 | mask |= intr_bit; | 151 | mask |= intr_bit; |
151 | WRITE_MASK(addr, mask); | 152 | WRITE_MASK(addr, mask); |
152 | 153 | ||
154 | if (group == GPIO_MAPPED_IRQ_GROUP) | ||
155 | rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE); | ||
156 | |||
153 | /* | 157 | /* |
154 | * if there are no more interrupts enabled in this | 158 | * if there are no more interrupts enabled in this |
155 | * group, disable corresponding IP | 159 | * group, disable corresponding IP |
@@ -165,12 +169,35 @@ static void rb532_mask_and_ack_irq(unsigned int irq_nr) | |||
165 | ack_local_irq(group_to_ip(irq_to_group(irq_nr))); | 169 | ack_local_irq(group_to_ip(irq_to_group(irq_nr))); |
166 | } | 170 | } |
167 | 171 | ||
172 | static int rb532_set_type(unsigned int irq_nr, unsigned type) | ||
173 | { | ||
174 | int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE; | ||
175 | int group = irq_to_group(irq_nr); | ||
176 | |||
177 | if (group != GPIO_MAPPED_IRQ_GROUP) | ||
178 | return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL; | ||
179 | |||
180 | switch (type) { | ||
181 | case IRQ_TYPE_LEVEL_HIGH: | ||
182 | rb532_gpio_set_ilevel(1, gpio); | ||
183 | break; | ||
184 | case IRQ_TYPE_LEVEL_LOW: | ||
185 | rb532_gpio_set_ilevel(0, gpio); | ||
186 | break; | ||
187 | default: | ||
188 | return -EINVAL; | ||
189 | } | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
168 | static struct irq_chip rc32434_irq_type = { | 194 | static struct irq_chip rc32434_irq_type = { |
169 | .name = "RB532", | 195 | .name = "RB532", |
170 | .ack = rb532_disable_irq, | 196 | .ack = rb532_disable_irq, |
171 | .mask = rb532_disable_irq, | 197 | .mask = rb532_disable_irq, |
172 | .mask_ack = rb532_mask_and_ack_irq, | 198 | .mask_ack = rb532_mask_and_ack_irq, |
173 | .unmask = rb532_enable_irq, | 199 | .unmask = rb532_enable_irq, |
200 | .set_type = rb532_set_type, | ||
174 | }; | 201 | }; |
175 | 202 | ||
176 | void __init arch_init_irq(void) | 203 | void __init arch_init_irq(void) |