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>
18 #include <asm/harp/harp.h>
21 #define NUM_EXTERNAL_IRQS 16
23 // Early versions of the STB1 Overdrive required this nasty frig
24 //#define INVERT_INTMASK_WRITES
26 static void enable_harp_irq(unsigned int irq);
27 static void disable_harp_irq(unsigned int irq);
29 /* shutdown is same as "disable" */
30 #define shutdown_harp_irq disable_harp_irq
32 static void mask_and_ack_harp(unsigned int);
33 static void end_harp_irq(unsigned int irq);
35 static unsigned int startup_harp_irq(unsigned int irq)
38 return 0; /* never anything pending */
41 static struct hw_interrupt_type harp_irq_type = {
51 static void disable_harp_irq(unsigned int irq)
58 if (irq < 0 || irq >= NUM_EXTERNAL_IRQS)
64 maskReg = EPLD_INTMASK0;
66 maskReg = EPLD_INTMASK1;
70 local_irq_save(flags);
71 mask = ctrl_inl(maskReg);
72 mask &= (~(1 << pri));
73 #if defined(INVERT_INTMASK_WRITES)
76 ctrl_outl(mask, maskReg);
77 local_irq_restore(flags);
80 static void enable_harp_irq(unsigned int irq)
87 if (irq < 0 || irq >= NUM_EXTERNAL_IRQS)
93 maskReg = EPLD_INTMASK0;
95 maskReg = EPLD_INTMASK1;
99 local_irq_save(flags);
100 mask = ctrl_inl(maskReg);
105 #if defined(INVERT_INTMASK_WRITES)
108 ctrl_outl(mask, maskReg);
110 local_irq_restore(flags);
113 /* This functions sets the desired irq handler to be an overdrive type */
114 static void __init make_harp_irq(unsigned int irq)
116 disable_irq_nosync(irq);
117 irq_desc[irq].handler = &harp_irq_type;
118 disable_harp_irq(irq);
121 static void mask_and_ack_harp(unsigned int irq)
123 disable_harp_irq(irq);
126 static void end_harp_irq(unsigned int irq)
128 enable_harp_irq(irq);
131 void __init init_harp_irq(void)
135 #if !defined(INVERT_INTMASK_WRITES)
136 // On the harp these are set to enable an interrupt
137 ctrl_outl(0x00, EPLD_INTMASK0);
138 ctrl_outl(0x00, EPLD_INTMASK1);
140 // On the Overdrive the data is inverted before being stored in the reg
141 ctrl_outl(0xff, EPLD_INTMASK0);
142 ctrl_outl(0xff, EPLD_INTMASK1);
145 for (i = 0; i < NUM_EXTERNAL_IRQS; i++) {