xref: /openbmc/linux/arch/mips/lantiq/irq.c (revision 171bb2f19ed6f3627f4f783f658f2f475b2fbd50)
1*171bb2f1SJohn Crispin /*
2*171bb2f1SJohn Crispin  *  This program is free software; you can redistribute it and/or modify it
3*171bb2f1SJohn Crispin  *  under the terms of the GNU General Public License version 2 as published
4*171bb2f1SJohn Crispin  *  by the Free Software Foundation.
5*171bb2f1SJohn Crispin  *
6*171bb2f1SJohn Crispin  * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7*171bb2f1SJohn Crispin  * Copyright (C) 2010 Thomas Langer <thomas.langer@lantiq.com>
8*171bb2f1SJohn Crispin  */
9*171bb2f1SJohn Crispin 
10*171bb2f1SJohn Crispin #include <linux/interrupt.h>
11*171bb2f1SJohn Crispin #include <linux/ioport.h>
12*171bb2f1SJohn Crispin 
13*171bb2f1SJohn Crispin #include <asm/bootinfo.h>
14*171bb2f1SJohn Crispin #include <asm/irq_cpu.h>
15*171bb2f1SJohn Crispin 
16*171bb2f1SJohn Crispin #include <lantiq_soc.h>
17*171bb2f1SJohn Crispin #include <irq.h>
18*171bb2f1SJohn Crispin 
19*171bb2f1SJohn Crispin /* register definitions */
20*171bb2f1SJohn Crispin #define LTQ_ICU_IM0_ISR		0x0000
21*171bb2f1SJohn Crispin #define LTQ_ICU_IM0_IER		0x0008
22*171bb2f1SJohn Crispin #define LTQ_ICU_IM0_IOSR	0x0010
23*171bb2f1SJohn Crispin #define LTQ_ICU_IM0_IRSR	0x0018
24*171bb2f1SJohn Crispin #define LTQ_ICU_IM0_IMR		0x0020
25*171bb2f1SJohn Crispin #define LTQ_ICU_IM1_ISR		0x0028
26*171bb2f1SJohn Crispin #define LTQ_ICU_OFFSET		(LTQ_ICU_IM1_ISR - LTQ_ICU_IM0_ISR)
27*171bb2f1SJohn Crispin 
28*171bb2f1SJohn Crispin #define LTQ_EIU_EXIN_C		0x0000
29*171bb2f1SJohn Crispin #define LTQ_EIU_EXIN_INIC	0x0004
30*171bb2f1SJohn Crispin #define LTQ_EIU_EXIN_INEN	0x000C
31*171bb2f1SJohn Crispin 
32*171bb2f1SJohn Crispin /* irq numbers used by the external interrupt unit (EIU) */
33*171bb2f1SJohn Crispin #define LTQ_EIU_IR0		(INT_NUM_IM4_IRL0 + 30)
34*171bb2f1SJohn Crispin #define LTQ_EIU_IR1		(INT_NUM_IM3_IRL0 + 31)
35*171bb2f1SJohn Crispin #define LTQ_EIU_IR2		(INT_NUM_IM1_IRL0 + 26)
36*171bb2f1SJohn Crispin #define LTQ_EIU_IR3		INT_NUM_IM1_IRL0
37*171bb2f1SJohn Crispin #define LTQ_EIU_IR4		(INT_NUM_IM1_IRL0 + 1)
38*171bb2f1SJohn Crispin #define LTQ_EIU_IR5		(INT_NUM_IM1_IRL0 + 2)
39*171bb2f1SJohn Crispin #define LTQ_EIU_IR6		(INT_NUM_IM2_IRL0 + 30)
40*171bb2f1SJohn Crispin 
41*171bb2f1SJohn Crispin #define MAX_EIU			6
42*171bb2f1SJohn Crispin 
43*171bb2f1SJohn Crispin /* irqs generated by device attached to the EBU need to be acked in
44*171bb2f1SJohn Crispin  * a special manner
45*171bb2f1SJohn Crispin  */
46*171bb2f1SJohn Crispin #define LTQ_ICU_EBU_IRQ		22
47*171bb2f1SJohn Crispin 
48*171bb2f1SJohn Crispin #define ltq_icu_w32(x, y)	ltq_w32((x), ltq_icu_membase + (y))
49*171bb2f1SJohn Crispin #define ltq_icu_r32(x)		ltq_r32(ltq_icu_membase + (x))
50*171bb2f1SJohn Crispin 
51*171bb2f1SJohn Crispin #define ltq_eiu_w32(x, y)	ltq_w32((x), ltq_eiu_membase + (y))
52*171bb2f1SJohn Crispin #define ltq_eiu_r32(x)		ltq_r32(ltq_eiu_membase + (x))
53*171bb2f1SJohn Crispin 
54*171bb2f1SJohn Crispin static unsigned short ltq_eiu_irq[MAX_EIU] = {
55*171bb2f1SJohn Crispin 	LTQ_EIU_IR0,
56*171bb2f1SJohn Crispin 	LTQ_EIU_IR1,
57*171bb2f1SJohn Crispin 	LTQ_EIU_IR2,
58*171bb2f1SJohn Crispin 	LTQ_EIU_IR3,
59*171bb2f1SJohn Crispin 	LTQ_EIU_IR4,
60*171bb2f1SJohn Crispin 	LTQ_EIU_IR5,
61*171bb2f1SJohn Crispin };
62*171bb2f1SJohn Crispin 
63*171bb2f1SJohn Crispin static struct resource ltq_icu_resource = {
64*171bb2f1SJohn Crispin 	.name	= "icu",
65*171bb2f1SJohn Crispin 	.start	= LTQ_ICU_BASE_ADDR,
66*171bb2f1SJohn Crispin 	.end	= LTQ_ICU_BASE_ADDR + LTQ_ICU_SIZE - 1,
67*171bb2f1SJohn Crispin 	.flags	= IORESOURCE_MEM,
68*171bb2f1SJohn Crispin };
69*171bb2f1SJohn Crispin 
70*171bb2f1SJohn Crispin static struct resource ltq_eiu_resource = {
71*171bb2f1SJohn Crispin 	.name	= "eiu",
72*171bb2f1SJohn Crispin 	.start	= LTQ_EIU_BASE_ADDR,
73*171bb2f1SJohn Crispin 	.end	= LTQ_EIU_BASE_ADDR + LTQ_ICU_SIZE - 1,
74*171bb2f1SJohn Crispin 	.flags	= IORESOURCE_MEM,
75*171bb2f1SJohn Crispin };
76*171bb2f1SJohn Crispin 
77*171bb2f1SJohn Crispin static void __iomem *ltq_icu_membase;
78*171bb2f1SJohn Crispin static void __iomem *ltq_eiu_membase;
79*171bb2f1SJohn Crispin 
80*171bb2f1SJohn Crispin void ltq_disable_irq(struct irq_data *d)
81*171bb2f1SJohn Crispin {
82*171bb2f1SJohn Crispin 	u32 ier = LTQ_ICU_IM0_IER;
83*171bb2f1SJohn Crispin 	int irq_nr = d->irq - INT_NUM_IRQ0;
84*171bb2f1SJohn Crispin 
85*171bb2f1SJohn Crispin 	ier += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET);
86*171bb2f1SJohn Crispin 	irq_nr %= INT_NUM_IM_OFFSET;
87*171bb2f1SJohn Crispin 	ltq_icu_w32(ltq_icu_r32(ier) & ~(1 << irq_nr), ier);
88*171bb2f1SJohn Crispin }
89*171bb2f1SJohn Crispin 
90*171bb2f1SJohn Crispin void ltq_mask_and_ack_irq(struct irq_data *d)
91*171bb2f1SJohn Crispin {
92*171bb2f1SJohn Crispin 	u32 ier = LTQ_ICU_IM0_IER;
93*171bb2f1SJohn Crispin 	u32 isr = LTQ_ICU_IM0_ISR;
94*171bb2f1SJohn Crispin 	int irq_nr = d->irq - INT_NUM_IRQ0;
95*171bb2f1SJohn Crispin 
96*171bb2f1SJohn Crispin 	ier += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET);
97*171bb2f1SJohn Crispin 	isr += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET);
98*171bb2f1SJohn Crispin 	irq_nr %= INT_NUM_IM_OFFSET;
99*171bb2f1SJohn Crispin 	ltq_icu_w32(ltq_icu_r32(ier) & ~(1 << irq_nr), ier);
100*171bb2f1SJohn Crispin 	ltq_icu_w32((1 << irq_nr), isr);
101*171bb2f1SJohn Crispin }
102*171bb2f1SJohn Crispin 
103*171bb2f1SJohn Crispin static void ltq_ack_irq(struct irq_data *d)
104*171bb2f1SJohn Crispin {
105*171bb2f1SJohn Crispin 	u32 isr = LTQ_ICU_IM0_ISR;
106*171bb2f1SJohn Crispin 	int irq_nr = d->irq - INT_NUM_IRQ0;
107*171bb2f1SJohn Crispin 
108*171bb2f1SJohn Crispin 	isr += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET);
109*171bb2f1SJohn Crispin 	irq_nr %= INT_NUM_IM_OFFSET;
110*171bb2f1SJohn Crispin 	ltq_icu_w32((1 << irq_nr), isr);
111*171bb2f1SJohn Crispin }
112*171bb2f1SJohn Crispin 
113*171bb2f1SJohn Crispin void ltq_enable_irq(struct irq_data *d)
114*171bb2f1SJohn Crispin {
115*171bb2f1SJohn Crispin 	u32 ier = LTQ_ICU_IM0_IER;
116*171bb2f1SJohn Crispin 	int irq_nr = d->irq - INT_NUM_IRQ0;
117*171bb2f1SJohn Crispin 
118*171bb2f1SJohn Crispin 	ier += LTQ_ICU_OFFSET  * (irq_nr / INT_NUM_IM_OFFSET);
119*171bb2f1SJohn Crispin 	irq_nr %= INT_NUM_IM_OFFSET;
120*171bb2f1SJohn Crispin 	ltq_icu_w32(ltq_icu_r32(ier) | (1 << irq_nr), ier);
121*171bb2f1SJohn Crispin }
122*171bb2f1SJohn Crispin 
123*171bb2f1SJohn Crispin static unsigned int ltq_startup_eiu_irq(struct irq_data *d)
124*171bb2f1SJohn Crispin {
125*171bb2f1SJohn Crispin 	int i;
126*171bb2f1SJohn Crispin 	int irq_nr = d->irq - INT_NUM_IRQ0;
127*171bb2f1SJohn Crispin 
128*171bb2f1SJohn Crispin 	ltq_enable_irq(d);
129*171bb2f1SJohn Crispin 	for (i = 0; i < MAX_EIU; i++) {
130*171bb2f1SJohn Crispin 		if (irq_nr == ltq_eiu_irq[i]) {
131*171bb2f1SJohn Crispin 			/* low level - we should really handle set_type */
132*171bb2f1SJohn Crispin 			ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) |
133*171bb2f1SJohn Crispin 				(0x6 << (i * 4)), LTQ_EIU_EXIN_C);
134*171bb2f1SJohn Crispin 			/* clear all pending */
135*171bb2f1SJohn Crispin 			ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INIC) & ~(1 << i),
136*171bb2f1SJohn Crispin 				LTQ_EIU_EXIN_INIC);
137*171bb2f1SJohn Crispin 			/* enable */
138*171bb2f1SJohn Crispin 			ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) | (1 << i),
139*171bb2f1SJohn Crispin 				LTQ_EIU_EXIN_INEN);
140*171bb2f1SJohn Crispin 			break;
141*171bb2f1SJohn Crispin 		}
142*171bb2f1SJohn Crispin 	}
143*171bb2f1SJohn Crispin 
144*171bb2f1SJohn Crispin 	return 0;
145*171bb2f1SJohn Crispin }
146*171bb2f1SJohn Crispin 
147*171bb2f1SJohn Crispin static void ltq_shutdown_eiu_irq(struct irq_data *d)
148*171bb2f1SJohn Crispin {
149*171bb2f1SJohn Crispin 	int i;
150*171bb2f1SJohn Crispin 	int irq_nr = d->irq - INT_NUM_IRQ0;
151*171bb2f1SJohn Crispin 
152*171bb2f1SJohn Crispin 	ltq_disable_irq(d);
153*171bb2f1SJohn Crispin 	for (i = 0; i < MAX_EIU; i++) {
154*171bb2f1SJohn Crispin 		if (irq_nr == ltq_eiu_irq[i]) {
155*171bb2f1SJohn Crispin 			/* disable */
156*171bb2f1SJohn Crispin 			ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~(1 << i),
157*171bb2f1SJohn Crispin 				LTQ_EIU_EXIN_INEN);
158*171bb2f1SJohn Crispin 			break;
159*171bb2f1SJohn Crispin 		}
160*171bb2f1SJohn Crispin 	}
161*171bb2f1SJohn Crispin }
162*171bb2f1SJohn Crispin 
163*171bb2f1SJohn Crispin static struct irq_chip ltq_irq_type = {
164*171bb2f1SJohn Crispin 	"icu",
165*171bb2f1SJohn Crispin 	.irq_enable = ltq_enable_irq,
166*171bb2f1SJohn Crispin 	.irq_disable = ltq_disable_irq,
167*171bb2f1SJohn Crispin 	.irq_unmask = ltq_enable_irq,
168*171bb2f1SJohn Crispin 	.irq_ack = ltq_ack_irq,
169*171bb2f1SJohn Crispin 	.irq_mask = ltq_disable_irq,
170*171bb2f1SJohn Crispin 	.irq_mask_ack = ltq_mask_and_ack_irq,
171*171bb2f1SJohn Crispin };
172*171bb2f1SJohn Crispin 
173*171bb2f1SJohn Crispin static struct irq_chip ltq_eiu_type = {
174*171bb2f1SJohn Crispin 	"eiu",
175*171bb2f1SJohn Crispin 	.irq_startup = ltq_startup_eiu_irq,
176*171bb2f1SJohn Crispin 	.irq_shutdown = ltq_shutdown_eiu_irq,
177*171bb2f1SJohn Crispin 	.irq_enable = ltq_enable_irq,
178*171bb2f1SJohn Crispin 	.irq_disable = ltq_disable_irq,
179*171bb2f1SJohn Crispin 	.irq_unmask = ltq_enable_irq,
180*171bb2f1SJohn Crispin 	.irq_ack = ltq_ack_irq,
181*171bb2f1SJohn Crispin 	.irq_mask = ltq_disable_irq,
182*171bb2f1SJohn Crispin 	.irq_mask_ack = ltq_mask_and_ack_irq,
183*171bb2f1SJohn Crispin };
184*171bb2f1SJohn Crispin 
185*171bb2f1SJohn Crispin static void ltq_hw_irqdispatch(int module)
186*171bb2f1SJohn Crispin {
187*171bb2f1SJohn Crispin 	u32 irq;
188*171bb2f1SJohn Crispin 
189*171bb2f1SJohn Crispin 	irq = ltq_icu_r32(LTQ_ICU_IM0_IOSR + (module * LTQ_ICU_OFFSET));
190*171bb2f1SJohn Crispin 	if (irq == 0)
191*171bb2f1SJohn Crispin 		return;
192*171bb2f1SJohn Crispin 
193*171bb2f1SJohn Crispin 	/* silicon bug causes only the msb set to 1 to be valid. all
194*171bb2f1SJohn Crispin 	 * other bits might be bogus
195*171bb2f1SJohn Crispin 	 */
196*171bb2f1SJohn Crispin 	irq = __fls(irq);
197*171bb2f1SJohn Crispin 	do_IRQ((int)irq + INT_NUM_IM0_IRL0 + (INT_NUM_IM_OFFSET * module));
198*171bb2f1SJohn Crispin 
199*171bb2f1SJohn Crispin 	/* if this is a EBU irq, we need to ack it or get a deadlock */
200*171bb2f1SJohn Crispin 	if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0))
201*171bb2f1SJohn Crispin 		ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_ISTAT) | 0x10,
202*171bb2f1SJohn Crispin 			LTQ_EBU_PCC_ISTAT);
203*171bb2f1SJohn Crispin }
204*171bb2f1SJohn Crispin 
205*171bb2f1SJohn Crispin #define DEFINE_HWx_IRQDISPATCH(x)					\
206*171bb2f1SJohn Crispin 	static void ltq_hw ## x ## _irqdispatch(void)			\
207*171bb2f1SJohn Crispin 	{								\
208*171bb2f1SJohn Crispin 		ltq_hw_irqdispatch(x);					\
209*171bb2f1SJohn Crispin 	}
210*171bb2f1SJohn Crispin DEFINE_HWx_IRQDISPATCH(0)
211*171bb2f1SJohn Crispin DEFINE_HWx_IRQDISPATCH(1)
212*171bb2f1SJohn Crispin DEFINE_HWx_IRQDISPATCH(2)
213*171bb2f1SJohn Crispin DEFINE_HWx_IRQDISPATCH(3)
214*171bb2f1SJohn Crispin DEFINE_HWx_IRQDISPATCH(4)
215*171bb2f1SJohn Crispin 
216*171bb2f1SJohn Crispin static void ltq_hw5_irqdispatch(void)
217*171bb2f1SJohn Crispin {
218*171bb2f1SJohn Crispin 	do_IRQ(MIPS_CPU_TIMER_IRQ);
219*171bb2f1SJohn Crispin }
220*171bb2f1SJohn Crispin 
221*171bb2f1SJohn Crispin asmlinkage void plat_irq_dispatch(void)
222*171bb2f1SJohn Crispin {
223*171bb2f1SJohn Crispin 	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
224*171bb2f1SJohn Crispin 	unsigned int i;
225*171bb2f1SJohn Crispin 
226*171bb2f1SJohn Crispin 	if (pending & CAUSEF_IP7) {
227*171bb2f1SJohn Crispin 		do_IRQ(MIPS_CPU_TIMER_IRQ);
228*171bb2f1SJohn Crispin 		goto out;
229*171bb2f1SJohn Crispin 	} else {
230*171bb2f1SJohn Crispin 		for (i = 0; i < 5; i++) {
231*171bb2f1SJohn Crispin 			if (pending & (CAUSEF_IP2 << i)) {
232*171bb2f1SJohn Crispin 				ltq_hw_irqdispatch(i);
233*171bb2f1SJohn Crispin 				goto out;
234*171bb2f1SJohn Crispin 			}
235*171bb2f1SJohn Crispin 		}
236*171bb2f1SJohn Crispin 	}
237*171bb2f1SJohn Crispin 	pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
238*171bb2f1SJohn Crispin 
239*171bb2f1SJohn Crispin out:
240*171bb2f1SJohn Crispin 	return;
241*171bb2f1SJohn Crispin }
242*171bb2f1SJohn Crispin 
243*171bb2f1SJohn Crispin static struct irqaction cascade = {
244*171bb2f1SJohn Crispin 	.handler = no_action,
245*171bb2f1SJohn Crispin 	.flags = IRQF_DISABLED,
246*171bb2f1SJohn Crispin 	.name = "cascade",
247*171bb2f1SJohn Crispin };
248*171bb2f1SJohn Crispin 
249*171bb2f1SJohn Crispin void __init arch_init_irq(void)
250*171bb2f1SJohn Crispin {
251*171bb2f1SJohn Crispin 	int i;
252*171bb2f1SJohn Crispin 
253*171bb2f1SJohn Crispin 	if (insert_resource(&iomem_resource, &ltq_icu_resource) < 0)
254*171bb2f1SJohn Crispin 		panic("Failed to insert icu memory\n");
255*171bb2f1SJohn Crispin 
256*171bb2f1SJohn Crispin 	if (request_mem_region(ltq_icu_resource.start,
257*171bb2f1SJohn Crispin 			resource_size(&ltq_icu_resource), "icu") < 0)
258*171bb2f1SJohn Crispin 		panic("Failed to request icu memory\n");
259*171bb2f1SJohn Crispin 
260*171bb2f1SJohn Crispin 	ltq_icu_membase = ioremap_nocache(ltq_icu_resource.start,
261*171bb2f1SJohn Crispin 				resource_size(&ltq_icu_resource));
262*171bb2f1SJohn Crispin 	if (!ltq_icu_membase)
263*171bb2f1SJohn Crispin 		panic("Failed to remap icu memory\n");
264*171bb2f1SJohn Crispin 
265*171bb2f1SJohn Crispin 	if (insert_resource(&iomem_resource, &ltq_eiu_resource) < 0)
266*171bb2f1SJohn Crispin 		panic("Failed to insert eiu memory\n");
267*171bb2f1SJohn Crispin 
268*171bb2f1SJohn Crispin 	if (request_mem_region(ltq_eiu_resource.start,
269*171bb2f1SJohn Crispin 			resource_size(&ltq_eiu_resource), "eiu") < 0)
270*171bb2f1SJohn Crispin 		panic("Failed to request eiu memory\n");
271*171bb2f1SJohn Crispin 
272*171bb2f1SJohn Crispin 	ltq_eiu_membase = ioremap_nocache(ltq_eiu_resource.start,
273*171bb2f1SJohn Crispin 				resource_size(&ltq_eiu_resource));
274*171bb2f1SJohn Crispin 	if (!ltq_eiu_membase)
275*171bb2f1SJohn Crispin 		panic("Failed to remap eiu memory\n");
276*171bb2f1SJohn Crispin 
277*171bb2f1SJohn Crispin 	/* make sure all irqs are turned off by default */
278*171bb2f1SJohn Crispin 	for (i = 0; i < 5; i++)
279*171bb2f1SJohn Crispin 		ltq_icu_w32(0, LTQ_ICU_IM0_IER + (i * LTQ_ICU_OFFSET));
280*171bb2f1SJohn Crispin 
281*171bb2f1SJohn Crispin 	/* clear all possibly pending interrupts */
282*171bb2f1SJohn Crispin 	ltq_icu_w32(~0, LTQ_ICU_IM0_ISR + (i * LTQ_ICU_OFFSET));
283*171bb2f1SJohn Crispin 
284*171bb2f1SJohn Crispin 	mips_cpu_irq_init();
285*171bb2f1SJohn Crispin 
286*171bb2f1SJohn Crispin 	for (i = 2; i <= 6; i++)
287*171bb2f1SJohn Crispin 		setup_irq(i, &cascade);
288*171bb2f1SJohn Crispin 
289*171bb2f1SJohn Crispin 	if (cpu_has_vint) {
290*171bb2f1SJohn Crispin 		pr_info("Setting up vectored interrupts\n");
291*171bb2f1SJohn Crispin 		set_vi_handler(2, ltq_hw0_irqdispatch);
292*171bb2f1SJohn Crispin 		set_vi_handler(3, ltq_hw1_irqdispatch);
293*171bb2f1SJohn Crispin 		set_vi_handler(4, ltq_hw2_irqdispatch);
294*171bb2f1SJohn Crispin 		set_vi_handler(5, ltq_hw3_irqdispatch);
295*171bb2f1SJohn Crispin 		set_vi_handler(6, ltq_hw4_irqdispatch);
296*171bb2f1SJohn Crispin 		set_vi_handler(7, ltq_hw5_irqdispatch);
297*171bb2f1SJohn Crispin 	}
298*171bb2f1SJohn Crispin 
299*171bb2f1SJohn Crispin 	for (i = INT_NUM_IRQ0;
300*171bb2f1SJohn Crispin 		i <= (INT_NUM_IRQ0 + (5 * INT_NUM_IM_OFFSET)); i++)
301*171bb2f1SJohn Crispin 		if ((i == LTQ_EIU_IR0) || (i == LTQ_EIU_IR1) ||
302*171bb2f1SJohn Crispin 			(i == LTQ_EIU_IR2))
303*171bb2f1SJohn Crispin 			irq_set_chip_and_handler(i, &ltq_eiu_type,
304*171bb2f1SJohn Crispin 				handle_level_irq);
305*171bb2f1SJohn Crispin 		/* EIU3-5 only exist on ar9 and vr9 */
306*171bb2f1SJohn Crispin 		else if (((i == LTQ_EIU_IR3) || (i == LTQ_EIU_IR4) ||
307*171bb2f1SJohn Crispin 			(i == LTQ_EIU_IR5)) && (ltq_is_ar9() || ltq_is_vr9()))
308*171bb2f1SJohn Crispin 			irq_set_chip_and_handler(i, &ltq_eiu_type,
309*171bb2f1SJohn Crispin 				handle_level_irq);
310*171bb2f1SJohn Crispin 		else
311*171bb2f1SJohn Crispin 			irq_set_chip_and_handler(i, &ltq_irq_type,
312*171bb2f1SJohn Crispin 				handle_level_irq);
313*171bb2f1SJohn Crispin 
314*171bb2f1SJohn Crispin #if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC)
315*171bb2f1SJohn Crispin 	set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 |
316*171bb2f1SJohn Crispin 		IE_IRQ3 | IE_IRQ4 | IE_IRQ5);
317*171bb2f1SJohn Crispin #else
318*171bb2f1SJohn Crispin 	set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ0 | IE_IRQ1 |
319*171bb2f1SJohn Crispin 		IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5);
320*171bb2f1SJohn Crispin #endif
321*171bb2f1SJohn Crispin }
322*171bb2f1SJohn Crispin 
323*171bb2f1SJohn Crispin unsigned int __cpuinit get_c0_compare_int(void)
324*171bb2f1SJohn Crispin {
325*171bb2f1SJohn Crispin 	return CP0_LEGACY_COMPARE_IRQ;
326*171bb2f1SJohn Crispin }
327