3 #include <linux/interrupt.h>
4 #include <linux/module.h>
6 #include <asm/irq_cpu.h>
8 #include <asm/mipsregs.h>
12 unsigned int ht_irq[] = {0, 1, 3, 4, 5, 6, 7, 8, 12, 14, 15};
14 static void ht_irqdispatch(void)
18 irq = LOONGSON_HT1_INT_VECTOR(0);
19 LOONGSON_HT1_INT_VECTOR(0) = irq; /* Acknowledge the IRQs */
21 for (i = 0; i < ARRAY_SIZE(ht_irq); i++) {
22 if (irq & (0x1 << ht_irq[i]))
27 #define UNUSED_IPS (CAUSEF_IP5 | CAUSEF_IP4 | CAUSEF_IP1 | CAUSEF_IP0)
29 void mach_irq_dispatch(unsigned int pending)
31 if (pending & CAUSEF_IP7)
32 do_IRQ(LOONGSON_TIMER_IRQ);
33 #if defined(CONFIG_SMP)
34 if (pending & CAUSEF_IP6)
35 loongson3_ipi_interrupt(NULL);
37 if (pending & CAUSEF_IP3)
39 if (pending & CAUSEF_IP2)
40 do_IRQ(LOONGSON_UART_IRQ);
41 if (pending & UNUSED_IPS) {
42 pr_err("%s : spurious interrupt\n", __func__);
47 static inline void mask_loongson_irq(struct irq_data *d) { }
48 static inline void unmask_loongson_irq(struct irq_data *d) { }
50 /* For MIPS IRQs which shared by all cores */
51 static struct irq_chip loongson_irq_chip = {
53 .irq_ack = mask_loongson_irq,
54 .irq_mask = mask_loongson_irq,
55 .irq_mask_ack = mask_loongson_irq,
56 .irq_unmask = unmask_loongson_irq,
57 .irq_eoi = unmask_loongson_irq,
60 void irq_router_init(void)
64 /* route LPC int to cpu core0 int 0 */
65 LOONGSON_INT_ROUTER_LPC =
66 LOONGSON_INT_COREx_INTy(loongson_sysconf.boot_cpu_id, 0);
67 /* route HT1 int0 ~ int7 to cpu core0 INT1*/
68 for (i = 0; i < 8; i++)
69 LOONGSON_INT_ROUTER_HT1(i) =
70 LOONGSON_INT_COREx_INTy(loongson_sysconf.boot_cpu_id, 1);
71 /* enable HT1 interrupt */
72 LOONGSON_HT1_INTN_EN(0) = 0xffffffff;
73 /* enable router interrupt intenset */
74 LOONGSON_INT_ROUTER_INTENSET =
75 LOONGSON_INT_ROUTER_INTEN | (0xffff << 16) | 0x1 << 10;
78 void __init mach_init_irq(void)
80 clear_c0_status(ST0_IM | ST0_BEV);
85 irq_set_chip_and_handler(LOONGSON_UART_IRQ,
86 &loongson_irq_chip, handle_percpu_irq);
87 irq_set_chip_and_handler(LOONGSON_BRIDGE_IRQ,
88 &loongson_irq_chip, handle_percpu_irq);
90 set_c0_status(STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP6);
93 #ifdef CONFIG_HOTPLUG_CPU
98 clear_c0_status(ST0_IM);