2 * Copyright (C) 2000 David J. Mckay (david.mckay@st.com)
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
7 * Looks after interrupts on the HARP board.
9 * Bases on the IPR irq system
12 #include <linux/config.h>
13 #include <linux/init.h>
14 #include <linux/irq.h>
16 #include <asm/system.h>
22 #define NUM_EXTERNAL_IRQS 16
24 // Early versions of the STB1 Overdrive required this nasty frig
25 //#define INVERT_INTMASK_WRITES
27 static void enable_harp_irq(unsigned int irq);
28 static void disable_harp_irq(unsigned int irq);
30 /* shutdown is same as "disable" */
31 #define shutdown_harp_irq disable_harp_irq
33 static void mask_and_ack_harp(unsigned int);
34 static void end_harp_irq(unsigned int irq);
36 static unsigned int startup_harp_irq(unsigned int irq)
39 return 0; /* never anything pending */
42 static struct hw_interrupt_type harp_irq_type = {
52 static void disable_harp_irq(unsigned int irq)
59 if (irq < 0 || irq >= NUM_EXTERNAL_IRQS)
65 maskReg = EPLD_INTMASK0;
67 maskReg = EPLD_INTMASK1;
72 mask = ctrl_inl(maskReg);
73 mask &= (~(1 << pri));
74 #if defined(INVERT_INTMASK_WRITES)
77 ctrl_outl(mask, maskReg);
81 static void enable_harp_irq(unsigned int irq)
88 if (irq < 0 || irq >= NUM_EXTERNAL_IRQS)
94 maskReg = EPLD_INTMASK0;
96 maskReg = EPLD_INTMASK1;
101 mask = ctrl_inl(maskReg);
106 #if defined(INVERT_INTMASK_WRITES)
109 ctrl_outl(mask, maskReg);
111 restore_flags(flags);
114 /* This functions sets the desired irq handler to be an overdrive type */
115 static void __init make_harp_irq(unsigned int irq)
117 disable_irq_nosync(irq);
118 irq_desc[irq].handler = &harp_irq_type;
119 disable_harp_irq(irq);
122 static void mask_and_ack_harp(unsigned int irq)
124 disable_harp_irq(irq);
127 static void end_harp_irq(unsigned int irq)
129 enable_harp_irq(irq);
132 void __init init_harp_irq(void)
136 #if !defined(INVERT_INTMASK_WRITES)
137 // On the harp these are set to enable an interrupt
138 ctrl_outl(0x00, EPLD_INTMASK0);
139 ctrl_outl(0x00, EPLD_INTMASK1);
141 // On the Overdrive the data is inverted before being stored in the reg
142 ctrl_outl(0xff, EPLD_INTMASK0);
143 ctrl_outl(0xff, EPLD_INTMASK1);
146 for (i = 0; i < NUM_EXTERNAL_IRQS; i++) {