12 #include <linux/sched.h>
18 #include <asm/bootinfo.h>
21 #include <lantiq_soc.h>
25 #define LTQ_ICU_IM0_ISR 0x0000
26 #define LTQ_ICU_IM0_IER 0x0008
27 #define LTQ_ICU_IM0_IOSR 0x0010
28 #define LTQ_ICU_IM0_IRSR 0x0018
29 #define LTQ_ICU_IM0_IMR 0x0020
30 #define LTQ_ICU_IM1_ISR 0x0028
31 #define LTQ_ICU_OFFSET (LTQ_ICU_IM1_ISR - LTQ_ICU_IM0_ISR)
34 #define LTQ_EIU_EXIN_C 0x0000
35 #define LTQ_EIU_EXIN_INIC 0x0004
36 #define LTQ_EIU_EXIN_INEN 0x000C
39 #define LTQ_EIU_IR0 (INT_NUM_IM4_IRL0 + 30)
40 #define LTQ_EIU_IR1 (INT_NUM_IM3_IRL0 + 31)
41 #define LTQ_EIU_IR2 (INT_NUM_IM1_IRL0 + 26)
42 #define LTQ_EIU_IR3 INT_NUM_IM1_IRL0
43 #define LTQ_EIU_IR4 (INT_NUM_IM1_IRL0 + 1)
44 #define LTQ_EIU_IR5 (INT_NUM_IM1_IRL0 + 2)
45 #define LTQ_EIU_IR6 (INT_NUM_IM2_IRL0 + 30)
46 #define XWAY_EXIN_COUNT 3
50 #define LTQ_PERF_IRQ (INT_NUM_IM4_IRL0 + 31)
56 #define LTQ_ICU_EBU_IRQ 22
58 #define ltq_icu_w32(m, x, y) ltq_w32((x), ltq_icu_membase[m] + (y))
59 #define ltq_icu_r32(m, x) ltq_r32(ltq_icu_membase[m] + (x))
61 #define ltq_eiu_w32(x, y) ltq_w32((x), ltq_eiu_membase + (y))
62 #define ltq_eiu_r32(x) ltq_r32(ltq_eiu_membase + (x))
65 #define MIPS_CPU_IPI_RESCHED_IRQ 0
66 #define MIPS_CPU_IPI_CALL_IRQ 1
69 #define MIPS_CPU_IRQ_CASCADE 8
71 #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
75 static unsigned short ltq_eiu_irq[
MAX_EIU] = {
84 static int exin_avail;
86 static void __iomem *ltq_eiu_membase;
111 static void ltq_ack_irq(
struct irq_data *
d)
131 static unsigned int ltq_startup_eiu_irq(
struct irq_data *d)
136 for (i = 0; i <
MAX_EIU; i++) {
137 if (d->
hwirq == ltq_eiu_irq[i]) {
154 static void ltq_shutdown_eiu_irq(
struct irq_data *d)
159 for (i = 0; i <
MAX_EIU; i++) {
160 if (d->
hwirq == ltq_eiu_irq[i]) {
169 static struct irq_chip ltq_irq_type = {
174 .irq_ack = ltq_ack_irq,
179 static struct irq_chip ltq_eiu_type = {
181 .irq_startup = ltq_startup_eiu_irq,
182 .irq_shutdown = ltq_shutdown_eiu_irq,
186 .irq_ack = ltq_ack_irq,
191 static void ltq_hw_irqdispatch(
int module)
212 #define DEFINE_HWx_IRQDISPATCH(x) \
213 static void ltq_hw ## x ## _irqdispatch(void) \
215 ltq_hw_irqdispatch(x); \
223 #if MIPS_CPU_TIMER_IRQ == 7
224 static void ltq_hw5_irqdispatch(
void)
232 #ifdef CONFIG_MIPS_MT_SMP
239 static void ltq_sw0_irqdispatch(
void)
244 static void ltq_sw1_irqdispatch(
void)
261 .
handler = ipi_resched_interrupt,
263 .name =
"IPI_resched"
282 for (i = 0; i <
MAX_IM; i++) {
284 ltq_hw_irqdispatch(i);
303 for (i = 0; i < exin_avail; i++)
304 if (hw == ltq_eiu_irq[i])
305 chip = <q_eiu_type;
328 for (i = 0; i <
MAX_IM; i++) {
330 panic(
"Failed to get icu memory range");
334 pr_err(
"Failed to request icu memory");
337 resource_size(&res));
338 if (!ltq_icu_membase[i])
339 panic(
"Failed to remap icu memory");
347 "lantiq,count",
NULL);
351 if (exin_avail > MAX_EIU)
356 pr_err(
"Failed to request eiu memory");
359 resource_size(&res));
360 if (!ltq_eiu_membase)
361 panic(
"Failed to remap eiu memory");
365 for (i = 0; i <
MAX_IM; i++) {
374 for (i = 0; i <
MAX_IM; i++)
378 pr_info(
"Setting up vectored interrupts\n");
391 #if defined(CONFIG_MIPS_MT_SMP)
393 pr_info(
"Setting up IPI vectored interrupts\n");
402 #if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC)
429 { .compatible =
"lantiq,icu", .data =
icu_of_init },