1 /*
2  * include/asm-arm/arch-nexuspci/irq.h
3  *
4  * Copyright (C) 1998, 1999, 2000 Philip Blundell
5  */
6 
7 /*
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version
11  * 2 of the License, or (at your option) any later version.
12  */
13 
14 #include <asm/io.h>
15 
16 #define fixup_irq(x) (x)
17 
18 extern unsigned long soft_irq_mask;
19 
20 static const unsigned char irq_cmd[] =
21 {
22 	INTCONT_IRQ_DUART,
23 	INTCONT_IRQ_PLX,
24 	INTCONT_IRQ_D,
25 	INTCONT_IRQ_C,
26 	INTCONT_IRQ_B,
27 	INTCONT_IRQ_A,
28 	INTCONT_IRQ_SYSERR
29 };
30 
ftvpci_mask_irq(unsigned int irq)31 static void ftvpci_mask_irq(unsigned int irq)
32 {
33 	__raw_writel(irq_cmd[irq], INTCONT_BASE);
34 	soft_irq_mask &= ~(1<<irq);
35 }
36 
ftvpci_unmask_irq(unsigned int irq)37 static void ftvpci_unmask_irq(unsigned int irq)
38 {
39 	soft_irq_mask |= (1<<irq);
40 	__raw_writel(irq_cmd[irq] | 1, INTCONT_BASE);
41 }
42 
irq_init_irq(void)43 static __inline__ void irq_init_irq(void)
44 {
45 	unsigned int i;
46 
47 	/* Mask all FIQs */
48 	__raw_writel(INTCONT_FIQ_PLX, INTCONT_BASE);
49 	__raw_writel(INTCONT_FIQ_D, INTCONT_BASE);
50 	__raw_writel(INTCONT_FIQ_C, INTCONT_BASE);
51 	__raw_writel(INTCONT_FIQ_B, INTCONT_BASE);
52 	__raw_writel(INTCONT_FIQ_A, INTCONT_BASE);
53 	__raw_writel(INTCONT_FIQ_SYSERR, INTCONT_BASE);
54 
55 	/* Disable all interrupts initially. */
56 	for (i = 0; i < NR_IRQS; i++) {
57 		if (i >= FIRST_IRQ && i <= LAST_IRQ) {
58 			irq_desc[i].valid	= 1;
59 			irq_desc[i].probe_ok	= 1;
60 			irq_desc[i].mask_ack	= ftvpci_mask_irq;
61 			irq_desc[i].mask	= ftvpci_mask_irq;
62 			irq_desc[i].unmask	= ftvpci_unmask_irq;
63 			ftvpci_mask_irq(i);
64 		} else {
65 			irq_desc[i].valid	= 0;
66 			irq_desc[i].probe_ok	= 0;
67 		}
68 	}
69 }
70