2 * include/asm-arm/arch-ebsa285/irq.h
4 * Copyright (C) 1996-1998 Russell King
7 * 22-Aug-1998 RMK Restructured IRQ routines
8 * 03-Sep-1998 PJB Merged CATS support
9 * 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder
10 * 26-Jan-1999 PJB Don't use IACK on CATS
11 * 16-Mar-1999 RMK Added autodetect of ISA PICs
13 /* no need for config.h - arch/arm/kernel/irq.c does this for us */
14 #include <linux/config.h>
15 #include <asm/hardware.h>
16 #include <asm/dec21285.h>
20 * Footbridge IRQ translation table
21 * Converts from our IRQ numbers into FootBridge masks
23 static int dc21285_irq_mask
[] = {
24 IRQ_MASK_UART_RX
, /* 0 */
25 IRQ_MASK_UART_TX
, /* 1 */
26 IRQ_MASK_TIMER1
, /* 2 */
27 IRQ_MASK_TIMER2
, /* 3 */
28 IRQ_MASK_TIMER3
, /* 4 */
33 IRQ_MASK_DOORBELLHOST
, /* 9 */
34 IRQ_MASK_DMA1
, /* 10 */
35 IRQ_MASK_DMA2
, /* 11 */
36 IRQ_MASK_PCI
, /* 12 */
37 IRQ_MASK_SDRAMPARITY
, /* 13 */
38 IRQ_MASK_I2OINPOST
, /* 14 */
39 IRQ_MASK_PCI_ERR
/* 15 */
42 static int isa_irq
= -1;
44 static inline int fixup_irq(unsigned int irq
)
46 #ifdef CONFIG_HOST_FOOTBRIDGE
48 irq
= *(unsigned char *)PCIIACK_BASE
;
54 static void dc21285_mask_irq(unsigned int irq
)
56 *CSR_IRQ_DISABLE
= dc21285_irq_mask
[irq
& 15];
59 static void dc21285_unmask_irq(unsigned int irq
)
61 *CSR_IRQ_ENABLE
= dc21285_irq_mask
[irq
& 15];
64 static void isa_mask_pic_lo_irq(unsigned int irq
)
66 unsigned int mask
= 1 << (irq
& 7);
68 outb(inb(PIC_MASK_LO
) | mask
, PIC_MASK_LO
);
71 static void isa_mask_ack_pic_lo_irq(unsigned int irq
)
73 unsigned int mask
= 1 << (irq
& 7);
75 outb(inb(PIC_MASK_LO
) | mask
, PIC_MASK_LO
);
79 static void isa_unmask_pic_lo_irq(unsigned int irq
)
81 unsigned int mask
= 1 << (irq
& 7);
83 outb(inb(PIC_MASK_LO
) & ~mask
, PIC_MASK_LO
);
86 static void isa_mask_pic_hi_irq(unsigned int irq
)
88 unsigned int mask
= 1 << (irq
& 7);
90 outb(inb(PIC_MASK_HI
) | mask
, PIC_MASK_HI
);
93 static void isa_mask_ack_pic_hi_irq(unsigned int irq
)
95 unsigned int mask
= 1 << (irq
& 7);
97 outb(inb(PIC_MASK_HI
) | mask
, PIC_MASK_HI
);
102 static void isa_unmask_pic_hi_irq(unsigned int irq
)
104 unsigned int mask
= 1 << (irq
& 7);
106 outb(inb(PIC_MASK_HI
) & ~mask
, PIC_MASK_HI
);
109 static void no_action(int cpl
, void *dev_id
, struct pt_regs
*regs
)
113 static struct irqaction irq_cascade
= { no_action
, 0, 0, "cascade", NULL
, NULL
};
114 static struct resource pic1_resource
= { "pic1", 0x20, 0x3f };
115 static struct resource pic2_resource
= { "pic2", 0xa0, 0xbf };
117 static __inline__
void irq_init_irq(void)
124 *CSR_IRQ_DISABLE
= -1;
125 *CSR_FIQ_DISABLE
= -1;
127 for (irq
= _DC21285_IRQ(0); irq
< _DC21285_IRQ(16); irq
++) {
128 irq_desc
[irq
].valid
= 1;
129 irq_desc
[irq
].probe_ok
= 1;
130 irq_desc
[irq
].mask_ack
= dc21285_mask_irq
;
131 irq_desc
[irq
].mask
= dc21285_mask_irq
;
132 irq_desc
[irq
].unmask
= dc21285_unmask_irq
;
136 * Determine the ISA settings for
137 * the machine we're running on.
141 if (machine_is_ebsa285())
142 /* The following is dependent on which slot
143 * you plug the Southbridge card into. We
144 * currently assume that you plug it into
145 * the right-hand most slot.
149 if (machine_is_cats())
152 if (machine_is_netwinder())
157 * Setup, and then probe for an ISA PIC
158 * If the PIC is not there, then we
162 outb(_ISA_IRQ(0), PIC_MASK_LO
); /* IRQ number */
163 outb(0x04, PIC_MASK_LO
); /* Slave on Ch2 */
164 outb(0x01, PIC_MASK_LO
); /* x86 */
165 outb(0xf5, PIC_MASK_LO
); /* pattern: 11110101 */
168 outb(_ISA_IRQ(8), PIC_MASK_HI
); /* IRQ number */
169 outb(0x02, PIC_MASK_HI
); /* Slave on Ch1 */
170 outb(0x01, PIC_MASK_HI
); /* x86 */
171 outb(0xfa, PIC_MASK_HI
); /* pattern: 11111010 */
176 if (inb(PIC_MASK_LO
) == 0xf5 && inb(PIC_MASK_HI
) == 0xfa) {
177 outb(0xff, PIC_MASK_LO
);/* mask all IRQs */
178 outb(0xff, PIC_MASK_HI
);/* mask all IRQs */
184 for (irq
= _ISA_IRQ(0); irq
< _ISA_IRQ(8); irq
++) {
185 irq_desc
[irq
].valid
= 1;
186 irq_desc
[irq
].probe_ok
= 1;
187 irq_desc
[irq
].mask_ack
= isa_mask_ack_pic_lo_irq
;
188 irq_desc
[irq
].mask
= isa_mask_pic_lo_irq
;
189 irq_desc
[irq
].unmask
= isa_unmask_pic_lo_irq
;
192 for (irq
= _ISA_IRQ(8); irq
< _ISA_IRQ(16); irq
++) {
193 irq_desc
[irq
].valid
= 1;
194 irq_desc
[irq
].probe_ok
= 1;
195 irq_desc
[irq
].mask_ack
= isa_mask_ack_pic_hi_irq
;
196 irq_desc
[irq
].mask
= isa_mask_pic_hi_irq
;
197 irq_desc
[irq
].unmask
= isa_unmask_pic_hi_irq
;
200 request_resource(&ioport_resource
, &pic1_resource
);
201 request_resource(&ioport_resource
, &pic2_resource
);
202 setup_arm_irq(IRQ_ISA_CASCADE
, &irq_cascade
);
203 setup_arm_irq(isa_irq
, &irq_cascade
);
206 * On the NetWinder, don't automatically
207 * enable ISA IRQ11 when it is requested.
208 * There appears to be a missing pull-up
209 * resistor on this line.
211 if (machine_is_netwinder())
212 irq_desc
[_ISA_IRQ(11)].noautoenable
= 1;