aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/extint.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2006-12-04 06:00:03 -0500
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2006-12-08 07:06:23 -0500
commit01cb087e747538d6a831c3ab370a1e1fd4538d5c (patch)
tree7b91d418ee2da150f62d1db09a9b1b26fdc7a6ae /arch/avr32/mach-at32ap/extint.c
parentda58e92f1f2939587ac85ae3abfec8b1c743400b (diff)
[AVR32] Set flow handler for external interrupts
Make sure that the flow handler for external interrupts is updated whenever they type is changed. Also make sure that the defaults correspond with how the interrupt controller is configured. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/mach-at32ap/extint.c')
-rw-r--r--arch/avr32/mach-at32ap/extint.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index 4dff1f988900..b59272e81b9a 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -49,12 +49,25 @@ static void eim_unmask_irq(unsigned int irq)
49static int eim_set_irq_type(unsigned int irq, unsigned int flow_type) 49static int eim_set_irq_type(unsigned int irq, unsigned int flow_type)
50{ 50{
51 struct at32_sm *sm = get_irq_chip_data(irq); 51 struct at32_sm *sm = get_irq_chip_data(irq);
52 struct irq_desc *desc;
52 unsigned int i = irq - sm->eim_first_irq; 53 unsigned int i = irq - sm->eim_first_irq;
53 u32 mode, edge, level; 54 u32 mode, edge, level;
54 unsigned long flags; 55 unsigned long flags;
55 int ret = 0; 56 int ret = 0;
56 57
57 flow_type &= IRQ_TYPE_SENSE_MASK; 58 if (flow_type == IRQ_TYPE_NONE)
59 flow_type = IRQ_TYPE_LEVEL_LOW;
60
61 desc = &irq_desc[irq];
62 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
63 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
64
65 if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) {
66 desc->status |= IRQ_LEVEL;
67 set_irq_handler(irq, handle_level_irq);
68 } else {
69 set_irq_handler(irq, handle_edge_irq);
70 }
58 71
59 spin_lock_irqsave(&sm->lock, flags); 72 spin_lock_irqsave(&sm->lock, flags);
60 73
@@ -148,10 +161,15 @@ static int __init eim_init(void)
148 pattern = sm_readl(sm, EIM_MODE); 161 pattern = sm_readl(sm, EIM_MODE);
149 nr_irqs = fls(pattern); 162 nr_irqs = fls(pattern);
150 163
164 /* Trigger on falling edge unless overridden by driver */
165 sm_writel(sm, EIM_MODE, 0UL);
166 sm_writel(sm, EIM_EDGE, 0UL);
167
151 sm->eim_chip = &eim_chip; 168 sm->eim_chip = &eim_chip;
152 169
153 for (i = 0; i < nr_irqs; i++) { 170 for (i = 0; i < nr_irqs; i++) {
154 set_irq_chip(sm->eim_first_irq + i, &eim_chip); 171 set_irq_chip_and_handler(sm->eim_first_irq + i, &eim_chip,
172 handle_edge_irq);
155 set_irq_chip_data(sm->eim_first_irq + i, sm); 173 set_irq_chip_data(sm->eim_first_irq + i, sm);
156 } 174 }
157 175