2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) 2005 Wu Qi Ming infineon
17 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
20 #include <linux/init.h>
21 #include <linux/sched.h>
22 #include <linux/slab.h>
23 #include <linux/interrupt.h>
24 #include <linux/kernel_stat.h>
25 #include <linux/module.h>
27 #include <asm/bootinfo.h>
29 #include <asm/ifxmips/ifxmips.h>
30 #include <asm/ifxmips/ifxmips_irq.h>
31 #include <asm/irq_cpu.h>
34 ifxmips_disable_irq(unsigned int irq_nr
)
37 u32
*ifxmips_ier
= IFXMIPS_ICU_IM0_IER
;
39 irq_nr
-= INT_NUM_IRQ0
;
40 for(i
= 0; i
<= 4; i
++)
42 if(irq_nr
< INT_NUM_IM_OFFSET
){
43 ifxmips_w32(ifxmips_r32(ifxmips_ier
) & ~(1 << irq_nr
), ifxmips_ier
);
46 ifxmips_ier
+= IFXMIPS_ICU_OFFSET
;
47 irq_nr
-= INT_NUM_IM_OFFSET
;
50 EXPORT_SYMBOL(ifxmips_disable_irq
);
53 ifxmips_mask_and_ack_irq(unsigned int irq_nr
)
56 u32
*ifxmips_ier
= IFXMIPS_ICU_IM0_IER
;
57 u32
*ifxmips_isr
= IFXMIPS_ICU_IM0_ISR
;
59 irq_nr
-= INT_NUM_IRQ0
;
60 for(i
= 0; i
<= 4; i
++)
62 if(irq_nr
< INT_NUM_IM_OFFSET
)
64 ifxmips_w32(ifxmips_r32(ifxmips_ier
) & ~(1 << irq_nr
), ifxmips_ier
);
65 ifxmips_w32((1 << irq_nr
), ifxmips_isr
);
68 ifxmips_ier
+= IFXMIPS_ICU_OFFSET
;
69 ifxmips_isr
+= IFXMIPS_ICU_OFFSET
;
70 irq_nr
-= INT_NUM_IM_OFFSET
;
73 EXPORT_SYMBOL(ifxmips_mask_and_ack_irq
);
76 ifxmips_enable_irq(unsigned int irq_nr
)
79 u32
*ifxmips_ier
= IFXMIPS_ICU_IM0_IER
;
81 irq_nr
-= INT_NUM_IRQ0
;
82 for(i
= 0; i
<= 4; i
++)
84 if(irq_nr
< INT_NUM_IM_OFFSET
)
86 ifxmips_w32(ifxmips_r32(ifxmips_ier
) | (1 << irq_nr
), ifxmips_ier
);
89 ifxmips_ier
+= IFXMIPS_ICU_OFFSET
;
90 irq_nr
-= INT_NUM_IM_OFFSET
;
93 EXPORT_SYMBOL(ifxmips_enable_irq
);
96 ifxmips_startup_irq(unsigned int irq
)
98 ifxmips_enable_irq(irq
);
103 ifxmips_end_irq(unsigned int irq
)
105 if(!(irq_desc
[irq
].status
& (IRQ_DISABLED
| IRQ_INPROGRESS
)))
106 ifxmips_enable_irq (irq
);
109 static struct hw_interrupt_type
112 .startup
= ifxmips_startup_irq
,
113 .enable
= ifxmips_enable_irq
,
114 .disable
= ifxmips_disable_irq
,
115 .unmask
= ifxmips_enable_irq
,
116 .ack
= ifxmips_end_irq
,
117 .mask
= ifxmips_disable_irq
,
118 .mask_ack
= ifxmips_mask_and_ack_irq
,
119 .end
= ifxmips_end_irq
,
123 ls1bit32(unsigned long x
)
136 ifxmips_hw_irqdispatch(int module
)
140 irq
= ifxmips_r32(IFXMIPS_ICU_IM0_IOSR
+ (module
* IFXMIPS_ICU_OFFSET
));
145 do_IRQ((int)irq
+ INT_NUM_IM0_IRL0
+ (INT_NUM_IM_OFFSET
* module
));
147 if((irq
== 22) && (module
== 0)){
148 ifxmips_w32(ifxmips_r32(IFXMIPS_EBU_PCC_ISTAT
) | 0x10, IFXMIPS_EBU_PCC_ISTAT
);
153 plat_irq_dispatch(void)
155 unsigned int pending
= read_c0_status() & read_c0_cause() & ST0_IM
;
158 if(pending
& CAUSEF_IP7
)
160 do_IRQ(MIPS_CPU_TIMER_IRQ
);
163 for(i
= 0; i
< 5; i
++)
165 if(pending
& (CAUSEF_IP2
<< i
))
167 ifxmips_hw_irqdispatch(i
);
172 printk("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
178 static struct irqaction
180 .handler
= no_action
,
181 .flags
= IRQF_DISABLED
,
190 for(i
= 0; i
< 5; i
++)
191 ifxmips_w32(0, IFXMIPS_ICU_IM0_IER
+ (i
* IFXMIPS_ICU_OFFSET
));
195 for(i
= 2; i
<= 6; i
++)
196 setup_irq(i
, &cascade
);
198 for(i
= INT_NUM_IRQ0
; i
<= (INT_NUM_IRQ0
+ (5 * INT_NUM_IM_OFFSET
)); i
++)
199 set_irq_chip_and_handler(i
, &ifxmips_irq_type
, handle_level_irq
);
201 set_c0_status(IE_IRQ0
| IE_IRQ1
| IE_IRQ2
| IE_IRQ3
| IE_IRQ4
| IE_IRQ5
);
This page took 0.048215 seconds and 5 git commands to generate.