diff options
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/emma/common/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/emma/common/irq.c | 105 | ||||
-rw-r--r-- | arch/mips/emma/common/irq_emma2rh.c | 103 | ||||
-rw-r--r-- | arch/mips/emma/markeins/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/emma/markeins/irq.c | 251 | ||||
-rw-r--r-- | arch/mips/emma/markeins/irq_markeins.c | 153 |
6 files changed, 249 insertions, 367 deletions
diff --git a/arch/mips/emma/common/Makefile b/arch/mips/emma/common/Makefile index cb0fd328c61f..c392d28c1ef1 100644 --- a/arch/mips/emma/common/Makefile +++ b/arch/mips/emma/common/Makefile | |||
@@ -10,4 +10,4 @@ | |||
10 | # (at your option) any later version. | 10 | # (at your option) any later version. |
11 | # | 11 | # |
12 | 12 | ||
13 | obj-$(CONFIG_NEC_MARKEINS) += irq.o irq_emma2rh.o prom.o | 13 | obj-$(CONFIG_NEC_MARKEINS) += prom.o |
diff --git a/arch/mips/emma/common/irq.c b/arch/mips/emma/common/irq.c deleted file mode 100644 index 4158f808aa8e..000000000000 --- a/arch/mips/emma/common/irq.c +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/common/irq.c | ||
3 | * This file is common irq dispatcher. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2005-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c | ||
8 | * | ||
9 | * Copyright 2001 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/irq.h> | ||
28 | #include <linux/types.h> | ||
29 | |||
30 | #include <asm/system.h> | ||
31 | #include <asm/mipsregs.h> | ||
32 | #include <asm/addrspace.h> | ||
33 | #include <asm/bootinfo.h> | ||
34 | |||
35 | #include <asm/emma/emma2rh.h> | ||
36 | |||
37 | /* | ||
38 | * the first level int-handler will jump here if it is a emma2rh irq | ||
39 | */ | ||
40 | void emma2rh_irq_dispatch(void) | ||
41 | { | ||
42 | u32 intStatus; | ||
43 | u32 bitmask; | ||
44 | u32 i; | ||
45 | |||
46 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0) | ||
47 | & emma2rh_in32(EMMA2RH_BHIF_INT_EN_0); | ||
48 | |||
49 | #ifdef EMMA2RH_SW_CASCADE | ||
50 | if (intStatus & | ||
51 | (1 << ((EMMA2RH_SW_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) { | ||
52 | u32 swIntStatus; | ||
53 | swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT) | ||
54 | & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
55 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { | ||
56 | if (swIntStatus & bitmask) { | ||
57 | do_IRQ(EMMA2RH_SW_IRQ_BASE + i); | ||
58 | return; | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | #endif | ||
63 | |||
64 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { | ||
65 | if (intStatus & bitmask) { | ||
66 | do_IRQ(EMMA2RH_IRQ_BASE + i); | ||
67 | return; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1) | ||
72 | & emma2rh_in32(EMMA2RH_BHIF_INT_EN_1); | ||
73 | |||
74 | #ifdef EMMA2RH_GPIO_CASCADE | ||
75 | if (intStatus & | ||
76 | (1 << ((EMMA2RH_GPIO_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) { | ||
77 | u32 gpioIntStatus; | ||
78 | gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST) | ||
79 | & emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
80 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { | ||
81 | if (gpioIntStatus & bitmask) { | ||
82 | do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i); | ||
83 | return; | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | #endif | ||
88 | |||
89 | for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) { | ||
90 | if (intStatus & bitmask) { | ||
91 | do_IRQ(EMMA2RH_IRQ_BASE + i); | ||
92 | return; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2) | ||
97 | & emma2rh_in32(EMMA2RH_BHIF_INT_EN_2); | ||
98 | |||
99 | for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) { | ||
100 | if (intStatus & bitmask) { | ||
101 | do_IRQ(EMMA2RH_IRQ_BASE + i); | ||
102 | return; | ||
103 | } | ||
104 | } | ||
105 | } | ||
diff --git a/arch/mips/emma/common/irq_emma2rh.c b/arch/mips/emma/common/irq_emma2rh.c deleted file mode 100644 index 4f84fede4c4c..000000000000 --- a/arch/mips/emma/common/irq_emma2rh.c +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/common/irq_emma2rh.c | ||
3 | * This file defines the irq handler for EMMA2RH. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2005-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c | ||
8 | * | ||
9 | * Copyright 2001 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | |||
26 | /* | ||
27 | * EMMA2RH defines 64 IRQs. | ||
28 | * | ||
29 | * This file exports one function: | ||
30 | * emma2rh_irq_init(u32 irq_base); | ||
31 | */ | ||
32 | |||
33 | #include <linux/interrupt.h> | ||
34 | #include <linux/types.h> | ||
35 | #include <linux/ptrace.h> | ||
36 | |||
37 | #include <asm/debug.h> | ||
38 | |||
39 | #include <asm/emma/emma2rh.h> | ||
40 | |||
41 | /* number of total irqs supported by EMMA2RH */ | ||
42 | #define NUM_EMMA2RH_IRQ 96 | ||
43 | |||
44 | void ll_emma2rh_irq_enable(int); | ||
45 | void ll_emma2rh_irq_disable(int); | ||
46 | |||
47 | static void emma2rh_irq_enable(unsigned int irq) | ||
48 | { | ||
49 | ll_emma2rh_irq_enable(irq - EMMA2RH_IRQ_BASE); | ||
50 | } | ||
51 | |||
52 | static void emma2rh_irq_disable(unsigned int irq) | ||
53 | { | ||
54 | ll_emma2rh_irq_disable(irq - EMMA2RH_IRQ_BASE); | ||
55 | } | ||
56 | |||
57 | struct irq_chip emma2rh_irq_controller = { | ||
58 | .name = "emma2rh_irq", | ||
59 | .ack = emma2rh_irq_disable, | ||
60 | .mask = emma2rh_irq_disable, | ||
61 | .mask_ack = emma2rh_irq_disable, | ||
62 | .unmask = emma2rh_irq_enable, | ||
63 | }; | ||
64 | |||
65 | void emma2rh_irq_init(void) | ||
66 | { | ||
67 | u32 i; | ||
68 | |||
69 | for (i = 0; i < NUM_EMMA2RH_IRQ; i++) | ||
70 | set_irq_chip_and_handler(EMMA2RH_IRQ_BASE + i, | ||
71 | &emma2rh_irq_controller, | ||
72 | handle_level_irq); | ||
73 | } | ||
74 | |||
75 | void ll_emma2rh_irq_enable(int emma2rh_irq) | ||
76 | { | ||
77 | u32 reg_value; | ||
78 | u32 reg_bitmask; | ||
79 | u32 reg_index; | ||
80 | |||
81 | reg_index = EMMA2RH_BHIF_INT_EN_0 | ||
82 | + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) | ||
83 | * (emma2rh_irq / 32); | ||
84 | reg_value = emma2rh_in32(reg_index); | ||
85 | reg_bitmask = 0x1 << (emma2rh_irq % 32); | ||
86 | db_assert((reg_value & reg_bitmask) == 0); | ||
87 | emma2rh_out32(reg_index, reg_value | reg_bitmask); | ||
88 | } | ||
89 | |||
90 | void ll_emma2rh_irq_disable(int emma2rh_irq) | ||
91 | { | ||
92 | u32 reg_value; | ||
93 | u32 reg_bitmask; | ||
94 | u32 reg_index; | ||
95 | |||
96 | reg_index = EMMA2RH_BHIF_INT_EN_0 | ||
97 | + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) | ||
98 | * (emma2rh_irq / 32); | ||
99 | reg_value = emma2rh_in32(reg_index); | ||
100 | reg_bitmask = 0x1 << (emma2rh_irq % 32); | ||
101 | db_assert((reg_value & reg_bitmask) != 0); | ||
102 | emma2rh_out32(reg_index, reg_value & ~reg_bitmask); | ||
103 | } | ||
diff --git a/arch/mips/emma/markeins/Makefile b/arch/mips/emma/markeins/Makefile index 3c8b864f7bc5..16e0017ba919 100644 --- a/arch/mips/emma/markeins/Makefile +++ b/arch/mips/emma/markeins/Makefile | |||
@@ -10,4 +10,4 @@ | |||
10 | # (at your option) any later version. | 10 | # (at your option) any later version. |
11 | # | 11 | # |
12 | 12 | ||
13 | obj-$(CONFIG_NEC_MARKEINS) += irq.o irq_markeins.o setup.o led.o platform.o | 13 | obj-$(CONFIG_NEC_MARKEINS) += irq.o setup.o led.o platform.o |
diff --git a/arch/mips/emma/markeins/irq.c b/arch/mips/emma/markeins/irq.c index 3577fd52030d..ada33d8f6edf 100644 --- a/arch/mips/emma/markeins/irq.c +++ b/arch/mips/emma/markeins/irq.c | |||
@@ -38,6 +38,9 @@ | |||
38 | 38 | ||
39 | #include <asm/emma/emma2rh.h> | 39 | #include <asm/emma/emma2rh.h> |
40 | 40 | ||
41 | /* number of total irqs supported by EMMA2RH */ | ||
42 | #define NUM_EMMA2RH_IRQ 96 | ||
43 | |||
41 | /* | 44 | /* |
42 | * IRQ mapping | 45 | * IRQ mapping |
43 | * | 46 | * |
@@ -53,10 +56,180 @@ | |||
53 | * | 56 | * |
54 | */ | 57 | */ |
55 | 58 | ||
56 | extern void emma2rh_sw_irq_init(void); | 59 | void ll_emma2rh_irq_enable(int emma2rh_irq) |
57 | extern void emma2rh_gpio_irq_init(void); | 60 | { |
58 | extern void emma2rh_irq_init(void); | 61 | u32 reg_value; |
59 | extern void emma2rh_irq_dispatch(void); | 62 | u32 reg_bitmask; |
63 | u32 reg_index; | ||
64 | |||
65 | reg_index = EMMA2RH_BHIF_INT_EN_0 + | ||
66 | (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * | ||
67 | (emma2rh_irq / 32); | ||
68 | reg_value = emma2rh_in32(reg_index); | ||
69 | reg_bitmask = 0x1 << (emma2rh_irq % 32); | ||
70 | db_assert((reg_value & reg_bitmask) == 0); | ||
71 | emma2rh_out32(reg_index, reg_value | reg_bitmask); | ||
72 | } | ||
73 | |||
74 | void ll_emma2rh_irq_disable(int emma2rh_irq) | ||
75 | { | ||
76 | u32 reg_value; | ||
77 | u32 reg_bitmask; | ||
78 | u32 reg_index; | ||
79 | |||
80 | reg_index = EMMA2RH_BHIF_INT_EN_0 + | ||
81 | (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * | ||
82 | (emma2rh_irq / 32); | ||
83 | reg_value = emma2rh_in32(reg_index); | ||
84 | reg_bitmask = 0x1 << (emma2rh_irq % 32); | ||
85 | db_assert((reg_value & reg_bitmask) != 0); | ||
86 | emma2rh_out32(reg_index, reg_value & ~reg_bitmask); | ||
87 | } | ||
88 | |||
89 | static void emma2rh_irq_enable(unsigned int irq) | ||
90 | { | ||
91 | ll_emma2rh_irq_enable(irq - EMMA2RH_IRQ_BASE); | ||
92 | } | ||
93 | |||
94 | static void emma2rh_irq_disable(unsigned int irq) | ||
95 | { | ||
96 | ll_emma2rh_irq_disable(irq - EMMA2RH_IRQ_BASE); | ||
97 | } | ||
98 | |||
99 | struct irq_chip emma2rh_irq_controller = { | ||
100 | .name = "emma2rh_irq", | ||
101 | .ack = emma2rh_irq_disable, | ||
102 | .mask = emma2rh_irq_disable, | ||
103 | .mask_ack = emma2rh_irq_disable, | ||
104 | .unmask = emma2rh_irq_enable, | ||
105 | }; | ||
106 | |||
107 | void emma2rh_irq_init(void) | ||
108 | { | ||
109 | u32 i; | ||
110 | |||
111 | for (i = 0; i < NUM_EMMA2RH_IRQ; i++) | ||
112 | set_irq_chip_and_handler(EMMA2RH_IRQ_BASE + i, | ||
113 | &emma2rh_irq_controller, | ||
114 | handle_level_irq); | ||
115 | } | ||
116 | |||
117 | void ll_emma2rh_sw_irq_enable(int irq) | ||
118 | { | ||
119 | u32 reg; | ||
120 | |||
121 | db_assert(irq >= 0); | ||
122 | db_assert(irq < NUM_EMMA2RH_IRQ_SW); | ||
123 | |||
124 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
125 | reg |= 1 << irq; | ||
126 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); | ||
127 | } | ||
128 | |||
129 | void ll_emma2rh_sw_irq_disable(int irq) | ||
130 | { | ||
131 | u32 reg; | ||
132 | |||
133 | db_assert(irq >= 0); | ||
134 | db_assert(irq < 32); | ||
135 | |||
136 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
137 | reg &= ~(1 << irq); | ||
138 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); | ||
139 | } | ||
140 | |||
141 | static void emma2rh_sw_irq_enable(unsigned int irq) | ||
142 | { | ||
143 | ll_emma2rh_sw_irq_enable(irq - EMMA2RH_SW_IRQ_BASE); | ||
144 | } | ||
145 | |||
146 | static void emma2rh_sw_irq_disable(unsigned int irq) | ||
147 | { | ||
148 | ll_emma2rh_sw_irq_disable(irq - EMMA2RH_SW_IRQ_BASE); | ||
149 | } | ||
150 | |||
151 | struct irq_chip emma2rh_sw_irq_controller = { | ||
152 | .name = "emma2rh_sw_irq", | ||
153 | .ack = emma2rh_sw_irq_disable, | ||
154 | .mask = emma2rh_sw_irq_disable, | ||
155 | .mask_ack = emma2rh_sw_irq_disable, | ||
156 | .unmask = emma2rh_sw_irq_enable, | ||
157 | }; | ||
158 | |||
159 | void emma2rh_sw_irq_init(void) | ||
160 | { | ||
161 | u32 i; | ||
162 | |||
163 | for (i = 0; i < NUM_EMMA2RH_IRQ_SW; i++) | ||
164 | set_irq_chip_and_handler(EMMA2RH_SW_IRQ_BASE + i, | ||
165 | &emma2rh_sw_irq_controller, | ||
166 | handle_level_irq); | ||
167 | } | ||
168 | |||
169 | void ll_emma2rh_gpio_irq_enable(int irq) | ||
170 | { | ||
171 | u32 reg; | ||
172 | |||
173 | db_assert(irq >= 0); | ||
174 | db_assert(irq < NUM_EMMA2RH_IRQ_GPIO); | ||
175 | |||
176 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
177 | reg |= 1 << irq; | ||
178 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); | ||
179 | } | ||
180 | |||
181 | void ll_emma2rh_gpio_irq_disable(int irq) | ||
182 | { | ||
183 | u32 reg; | ||
184 | |||
185 | db_assert(irq >= 0); | ||
186 | db_assert(irq < NUM_EMMA2RH_IRQ_GPIO); | ||
187 | |||
188 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
189 | reg &= ~(1 << irq); | ||
190 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); | ||
191 | } | ||
192 | |||
193 | static void emma2rh_gpio_irq_enable(unsigned int irq) | ||
194 | { | ||
195 | ll_emma2rh_gpio_irq_enable(irq - EMMA2RH_GPIO_IRQ_BASE); | ||
196 | } | ||
197 | |||
198 | static void emma2rh_gpio_irq_disable(unsigned int irq) | ||
199 | { | ||
200 | ll_emma2rh_gpio_irq_disable(irq - EMMA2RH_GPIO_IRQ_BASE); | ||
201 | } | ||
202 | |||
203 | static void emma2rh_gpio_irq_ack(unsigned int irq) | ||
204 | { | ||
205 | irq -= EMMA2RH_GPIO_IRQ_BASE; | ||
206 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); | ||
207 | ll_emma2rh_gpio_irq_disable(irq); | ||
208 | } | ||
209 | |||
210 | static void emma2rh_gpio_irq_end(unsigned int irq) | ||
211 | { | ||
212 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
213 | ll_emma2rh_gpio_irq_enable(irq - EMMA2RH_GPIO_IRQ_BASE); | ||
214 | } | ||
215 | |||
216 | struct irq_chip emma2rh_gpio_irq_controller = { | ||
217 | .name = "emma2rh_gpio_irq", | ||
218 | .ack = emma2rh_gpio_irq_ack, | ||
219 | .mask = emma2rh_gpio_irq_disable, | ||
220 | .mask_ack = emma2rh_gpio_irq_ack, | ||
221 | .unmask = emma2rh_gpio_irq_enable, | ||
222 | .end = emma2rh_gpio_irq_end, | ||
223 | }; | ||
224 | |||
225 | void emma2rh_gpio_irq_init(void) | ||
226 | { | ||
227 | u32 i; | ||
228 | |||
229 | for (i = 0; i < NUM_EMMA2RH_IRQ_GPIO; i++) | ||
230 | set_irq_chip(EMMA2RH_GPIO_IRQ_BASE + i, | ||
231 | &emma2rh_gpio_irq_controller); | ||
232 | } | ||
60 | 233 | ||
61 | static struct irqaction irq_cascade = { | 234 | static struct irqaction irq_cascade = { |
62 | .handler = no_action, | 235 | .handler = no_action, |
@@ -67,6 +240,76 @@ static struct irqaction irq_cascade = { | |||
67 | .next = NULL, | 240 | .next = NULL, |
68 | }; | 241 | }; |
69 | 242 | ||
243 | /* | ||
244 | * the first level int-handler will jump here if it is a emma2rh irq | ||
245 | */ | ||
246 | void emma2rh_irq_dispatch(void) | ||
247 | { | ||
248 | u32 intStatus; | ||
249 | u32 bitmask; | ||
250 | u32 i; | ||
251 | |||
252 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0) & | ||
253 | emma2rh_in32(EMMA2RH_BHIF_INT_EN_0); | ||
254 | |||
255 | #ifdef EMMA2RH_SW_CASCADE | ||
256 | if (intStatus & | ||
257 | (1 << ((EMMA2RH_SW_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) { | ||
258 | u32 swIntStatus; | ||
259 | swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT) | ||
260 | & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
261 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { | ||
262 | if (swIntStatus & bitmask) { | ||
263 | do_IRQ(EMMA2RH_SW_IRQ_BASE + i); | ||
264 | return; | ||
265 | } | ||
266 | } | ||
267 | } | ||
268 | #endif | ||
269 | |||
270 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { | ||
271 | if (intStatus & bitmask) { | ||
272 | do_IRQ(EMMA2RH_IRQ_BASE + i); | ||
273 | return; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1) & | ||
278 | emma2rh_in32(EMMA2RH_BHIF_INT_EN_1); | ||
279 | |||
280 | #ifdef EMMA2RH_GPIO_CASCADE | ||
281 | if (intStatus & | ||
282 | (1 << ((EMMA2RH_GPIO_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) { | ||
283 | u32 gpioIntStatus; | ||
284 | gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST) | ||
285 | & emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
286 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { | ||
287 | if (gpioIntStatus & bitmask) { | ||
288 | do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i); | ||
289 | return; | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | #endif | ||
294 | |||
295 | for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) { | ||
296 | if (intStatus & bitmask) { | ||
297 | do_IRQ(EMMA2RH_IRQ_BASE + i); | ||
298 | return; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2) & | ||
303 | emma2rh_in32(EMMA2RH_BHIF_INT_EN_2); | ||
304 | |||
305 | for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) { | ||
306 | if (intStatus & bitmask) { | ||
307 | do_IRQ(EMMA2RH_IRQ_BASE + i); | ||
308 | return; | ||
309 | } | ||
310 | } | ||
311 | } | ||
312 | |||
70 | void __init arch_init_irq(void) | 313 | void __init arch_init_irq(void) |
71 | { | 314 | { |
72 | u32 reg; | 315 | u32 reg; |
diff --git a/arch/mips/emma/markeins/irq_markeins.c b/arch/mips/emma/markeins/irq_markeins.c deleted file mode 100644 index ea27ec573d95..000000000000 --- a/arch/mips/emma/markeins/irq_markeins.c +++ /dev/null | |||
@@ -1,153 +0,0 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/irq_markeins.c | ||
3 | * This file defines the irq handler for Mark-eins. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c | ||
8 | * | ||
9 | * Copyright 2001 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/ptrace.h> | ||
29 | |||
30 | #include <asm/debug.h> | ||
31 | #include <asm/emma/emma2rh.h> | ||
32 | |||
33 | void ll_emma2rh_sw_irq_enable(int reg); | ||
34 | void ll_emma2rh_sw_irq_disable(int reg); | ||
35 | void ll_emma2rh_gpio_irq_enable(int reg); | ||
36 | void ll_emma2rh_gpio_irq_disable(int reg); | ||
37 | |||
38 | static void emma2rh_sw_irq_enable(unsigned int irq) | ||
39 | { | ||
40 | ll_emma2rh_sw_irq_enable(irq - EMMA2RH_SW_IRQ_BASE); | ||
41 | } | ||
42 | |||
43 | static void emma2rh_sw_irq_disable(unsigned int irq) | ||
44 | { | ||
45 | ll_emma2rh_sw_irq_disable(irq - EMMA2RH_SW_IRQ_BASE); | ||
46 | } | ||
47 | |||
48 | struct irq_chip emma2rh_sw_irq_controller = { | ||
49 | .name = "emma2rh_sw_irq", | ||
50 | .ack = emma2rh_sw_irq_disable, | ||
51 | .mask = emma2rh_sw_irq_disable, | ||
52 | .mask_ack = emma2rh_sw_irq_disable, | ||
53 | .unmask = emma2rh_sw_irq_enable, | ||
54 | }; | ||
55 | |||
56 | void emma2rh_sw_irq_init(void) | ||
57 | { | ||
58 | u32 i; | ||
59 | |||
60 | for (i = 0; i < NUM_EMMA2RH_IRQ_SW; i++) | ||
61 | set_irq_chip_and_handler(EMMA2RH_SW_IRQ_BASE + i, | ||
62 | &emma2rh_sw_irq_controller, | ||
63 | handle_level_irq); | ||
64 | } | ||
65 | |||
66 | void ll_emma2rh_sw_irq_enable(int irq) | ||
67 | { | ||
68 | u32 reg; | ||
69 | |||
70 | db_assert(irq >= 0); | ||
71 | db_assert(irq < NUM_EMMA2RH_IRQ_SW); | ||
72 | |||
73 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
74 | reg |= 1 << irq; | ||
75 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); | ||
76 | } | ||
77 | |||
78 | void ll_emma2rh_sw_irq_disable(int irq) | ||
79 | { | ||
80 | u32 reg; | ||
81 | |||
82 | db_assert(irq >= 0); | ||
83 | db_assert(irq < 32); | ||
84 | |||
85 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
86 | reg &= ~(1 << irq); | ||
87 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); | ||
88 | } | ||
89 | |||
90 | static void emma2rh_gpio_irq_enable(unsigned int irq) | ||
91 | { | ||
92 | ll_emma2rh_gpio_irq_enable(irq - EMMA2RH_GPIO_IRQ_BASE); | ||
93 | } | ||
94 | |||
95 | static void emma2rh_gpio_irq_disable(unsigned int irq) | ||
96 | { | ||
97 | ll_emma2rh_gpio_irq_disable(irq - EMMA2RH_GPIO_IRQ_BASE); | ||
98 | } | ||
99 | |||
100 | static void emma2rh_gpio_irq_ack(unsigned int irq) | ||
101 | { | ||
102 | irq -= EMMA2RH_GPIO_IRQ_BASE; | ||
103 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); | ||
104 | ll_emma2rh_gpio_irq_disable(irq); | ||
105 | } | ||
106 | |||
107 | static void emma2rh_gpio_irq_end(unsigned int irq) | ||
108 | { | ||
109 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
110 | ll_emma2rh_gpio_irq_enable(irq - EMMA2RH_GPIO_IRQ_BASE); | ||
111 | } | ||
112 | |||
113 | struct irq_chip emma2rh_gpio_irq_controller = { | ||
114 | .name = "emma2rh_gpio_irq", | ||
115 | .ack = emma2rh_gpio_irq_ack, | ||
116 | .mask = emma2rh_gpio_irq_disable, | ||
117 | .mask_ack = emma2rh_gpio_irq_ack, | ||
118 | .unmask = emma2rh_gpio_irq_enable, | ||
119 | .end = emma2rh_gpio_irq_end, | ||
120 | }; | ||
121 | |||
122 | void emma2rh_gpio_irq_init(void) | ||
123 | { | ||
124 | u32 i; | ||
125 | |||
126 | for (i = 0; i < NUM_EMMA2RH_IRQ_GPIO; i++) | ||
127 | set_irq_chip(EMMA2RH_GPIO_IRQ_BASE + i, | ||
128 | &emma2rh_gpio_irq_controller); | ||
129 | } | ||
130 | |||
131 | void ll_emma2rh_gpio_irq_enable(int irq) | ||
132 | { | ||
133 | u32 reg; | ||
134 | |||
135 | db_assert(irq >= 0); | ||
136 | db_assert(irq < NUM_EMMA2RH_IRQ_GPIO); | ||
137 | |||
138 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
139 | reg |= 1 << irq; | ||
140 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); | ||
141 | } | ||
142 | |||
143 | void ll_emma2rh_gpio_irq_disable(int irq) | ||
144 | { | ||
145 | u32 reg; | ||
146 | |||
147 | db_assert(irq >= 0); | ||
148 | db_assert(irq < NUM_EMMA2RH_IRQ_GPIO); | ||
149 | |||
150 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
151 | reg &= ~(1 << irq); | ||
152 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); | ||
153 | } | ||