2 * DEC I/O ASIC interrupts.
4 * Copyright (c) 2002, 2003 Maciej W. Rozycki
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #include <linux/init.h>
13 #include <linux/irq.h>
14 #include <linux/types.h>
16 #include <asm/dec/ioasic.h>
17 #include <asm/dec/ioasic_addrs.h>
18 #include <asm/dec/ioasic_ints.h>
21 static int ioasic_irq_base;
24 static inline void unmask_ioasic_irq(unsigned int irq)
28 simr = ioasic_read(IO_REG_SIMR);
29 simr |= (1 << (irq - ioasic_irq_base));
30 ioasic_write(IO_REG_SIMR, simr);
33 static inline void mask_ioasic_irq(unsigned int irq)
37 simr = ioasic_read(IO_REG_SIMR);
38 simr &= ~(1 << (irq - ioasic_irq_base));
39 ioasic_write(IO_REG_SIMR, simr);
42 static inline void clear_ioasic_irq(unsigned int irq)
46 sir = ~(1 << (irq - ioasic_irq_base));
47 ioasic_write(IO_REG_SIR, sir);
50 static inline void ack_ioasic_irq(unsigned int irq)
56 static inline void end_ioasic_irq(unsigned int irq)
58 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
59 unmask_ioasic_irq(irq);
62 static struct irq_chip ioasic_irq_type = {
64 .ack = ack_ioasic_irq,
65 .mask = mask_ioasic_irq,
66 .mask_ack = ack_ioasic_irq,
67 .unmask = unmask_ioasic_irq,
71 #define unmask_ioasic_dma_irq unmask_ioasic_irq
73 #define mask_ioasic_dma_irq mask_ioasic_irq
75 #define ack_ioasic_dma_irq ack_ioasic_irq
77 static inline void end_ioasic_dma_irq(unsigned int irq)
79 clear_ioasic_irq(irq);
84 static struct irq_chip ioasic_dma_irq_type = {
85 .name = "IO-ASIC-DMA",
86 .ack = ack_ioasic_dma_irq,
87 .mask = mask_ioasic_dma_irq,
88 .mask_ack = ack_ioasic_dma_irq,
89 .unmask = unmask_ioasic_dma_irq,
90 .end = end_ioasic_dma_irq,
94 void __init init_ioasic_irqs(int base)
98 /* Mask interrupts. */
99 ioasic_write(IO_REG_SIMR, 0);
102 for (i = base; i < base + IO_INR_DMA; i++)
103 set_irq_chip_and_handler(i, &ioasic_irq_type,
105 for (; i < base + IO_IRQ_LINES; i++)
106 set_irq_chip(i, &ioasic_dma_irq_type);
108 ioasic_irq_base = base;