http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / arch / arm / mach-footbridge / irq.c
1 /*
2  *  linux/arch/arm/mach-footbridge/irq.c
3  *
4  *  Copyright (C) 1996-2000 Russell King
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  *  Changelog:
11  *   22-Aug-1998 RMK    Restructured IRQ routines
12  *   03-Sep-1998 PJB    Merged CATS support
13  *   20-Jan-1998 RMK    Started merge of EBSA286, CATS and NetWinder
14  *   26-Jan-1999 PJB    Don't use IACK on CATS
15  *   16-Mar-1999 RMK    Added autodetect of ISA PICs
16  */
17 #include <linux/ioport.h>
18 #include <linux/list.h>
19 #include <linux/init.h>
20
21 #include <asm/mach/irq.h>
22
23 #include <asm/hardware.h>
24 #include <asm/hardware/dec21285.h>
25 #include <asm/irq.h>
26 #include <asm/io.h>
27 #include <asm/mach-types.h>
28
29 extern void __init isa_init_irq(unsigned int irq);
30
31 /*
32  * Footbridge IRQ translation table
33  *  Converts from our IRQ numbers into FootBridge masks
34  */
35 static const int fb_irq_mask[] = {
36         IRQ_MASK_UART_RX,       /*  0 */
37         IRQ_MASK_UART_TX,       /*  1 */
38         IRQ_MASK_TIMER1,        /*  2 */
39         IRQ_MASK_TIMER2,        /*  3 */
40         IRQ_MASK_TIMER3,        /*  4 */
41         IRQ_MASK_IN0,           /*  5 */
42         IRQ_MASK_IN1,           /*  6 */
43         IRQ_MASK_IN2,           /*  7 */
44         IRQ_MASK_IN3,           /*  8 */
45         IRQ_MASK_DOORBELLHOST,  /*  9 */
46         IRQ_MASK_DMA1,          /* 10 */
47         IRQ_MASK_DMA2,          /* 11 */
48         IRQ_MASK_PCI,           /* 12 */
49         IRQ_MASK_SDRAMPARITY,   /* 13 */
50         IRQ_MASK_I2OINPOST,     /* 14 */
51         IRQ_MASK_PCI_ABORT,     /* 15 */
52         IRQ_MASK_PCI_SERR,      /* 16 */
53         IRQ_MASK_DISCARD_TIMER, /* 17 */
54         IRQ_MASK_PCI_DPERR,     /* 18 */
55         IRQ_MASK_PCI_PERR,      /* 19 */
56 };
57
58 static void fb_mask_irq(unsigned int irq)
59 {
60         *CSR_IRQ_DISABLE = fb_irq_mask[_DC21285_INR(irq)];
61 }
62
63 static void fb_unmask_irq(unsigned int irq)
64 {
65         *CSR_IRQ_ENABLE = fb_irq_mask[_DC21285_INR(irq)];
66 }
67
68 static struct irqchip fb_chip = {
69         .ack    = fb_mask_irq,
70         .mask   = fb_mask_irq,
71         .unmask = fb_unmask_irq,
72 };
73
74 static void __init __fb_init_irq(void)
75 {
76         unsigned int irq;
77
78         /*
79          * setup DC21285 IRQs
80          */
81         *CSR_IRQ_DISABLE = -1;
82         *CSR_FIQ_DISABLE = -1;
83
84         for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(20); irq++) {
85                 set_irq_chip(irq, &fb_chip);
86                 set_irq_handler(irq, do_level_IRQ);
87                 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
88         }
89 }
90
91 void __init footbridge_init_irq(void)
92 {
93         __fb_init_irq();
94
95         if (!footbridge_cfn_mode())
96                 return;
97
98         if (machine_is_ebsa285())
99                 /* The following is dependent on which slot
100                  * you plug the Southbridge card into.  We
101                  * currently assume that you plug it into
102                  * the right-hand most slot.
103                  */
104                 isa_init_irq(IRQ_PCI);
105
106         if (machine_is_cats())
107                 isa_init_irq(IRQ_IN2);
108
109         if (machine_is_netwinder())
110                 isa_init_irq(IRQ_IN3);
111 }