2 * arch/sh/boards/saturn/irq.c
4 * Copyright (C) 2002 Paul Mundt
6 * Released under the terms of the GNU GPL v2.0.
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/interrupt.h>
15 * Interrupts map out as follows:
25 * 70 SOUNDREQUEST 0x0040
26 * 71 SYSTEMMANAGER 0x0080
28 * 73 LEVEL2DMAEND 0x0200
29 * 74 LEVEL1DMAEND 0x0400
30 * 75 LEVEL0DMAEND 0x0800
31 * 76 DMAILLEGAL 0x1000
32 * 77 SRITEDRAWEND 0x2000
36 #define SATURN_IRQ_MIN 64 /* VBLANKIN */
37 #define SATURN_IRQ_MAX 78 /* ABUS */
39 #define SATURN_IRQ_MASK 0xbfff
41 static inline u32 saturn_irq_mask(unsigned int irq_nr)
45 mask = (1 << (irq_nr - SATURN_IRQ_MIN));
46 mask <<= (irq_nr == SATURN_IRQ_MAX);
47 mask &= SATURN_IRQ_MASK;
52 static inline void mask_saturn_irq(unsigned int irq_nr)
56 mask = ctrl_inl(SATURN_IMR);
57 mask |= saturn_irq_mask(irq_nr);
58 ctrl_outl(mask, SATURN_IMR);
61 static inline void unmask_saturn_irq(unsigned int irq_nr)
65 mask = ctrl_inl(SATURN_IMR);
66 mask &= ~saturn_irq_mask(irq_nr);
67 ctrl_outl(mask, SATURN_IMR);
70 static void disable_saturn_irq(unsigned int irq_nr)
72 mask_saturn_irq(irq_nr);
75 static void enable_saturn_irq(unsigned int irq_nr)
77 unmask_saturn_irq(irq_nr);
80 static void mask_and_ack_saturn_irq(unsigned int irq_nr)
82 mask_saturn_irq(irq_nr);
85 static void end_saturn_irq(unsigned int irq_nr)
87 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
88 unmask_saturn_irq(irq_nr);
91 static unsigned int startup_saturn_irq(unsigned int irq_nr)
93 unmask_saturn_irq(irq_nr);
98 static void shutdown_saturn_irq(unsigned int irq_nr)
100 mask_saturn_irq(irq_nr);
103 static struct hw_interrupt_type saturn_int = {
104 .typename = "Saturn",
105 .enable = enable_saturn_irq,
106 .disable = disable_saturn_irq,
107 .ack = mask_and_ack_saturn_irq,
108 .end = end_saturn_irq,
109 .startup = startup_saturn_irq,
110 .shutdown = shutdown_saturn_irq,
113 int saturn_irq_demux(int irq_nr)