aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/tx4927
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2007-08-02 10:36:02 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-08-26 21:16:53 -0400
commitc87abd75b35e8f991ff8ff1510d6fb62612c61fa (patch)
treede68c4446c35337c47c17253d769bfeee92f80b3 /arch/mips/tx4927
parent8420fd00e88ef4f6082866aa151bc753b006b3b6 (diff)
[MIPS] Cleanup TX39/TX49 irq code
Cleanup jmr3927, tx4927 and tx4938 irq codes, using common IRQ_CPU, I8259 and IRQ_TXX9 irq routines. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/tx4927')
-rw-r--r--arch/mips/tx4927/common/tx4927_irq.c395
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c171
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c11
3 files changed, 21 insertions, 556 deletions
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index 00b0b975f349..0aabd57fdad2 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -23,398 +23,20 @@
23 * with this program; if not, write to the Free Software Foundation, Inc., 23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA. 24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26#include <linux/errno.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/kernel_stat.h>
29#include <linux/module.h>
30#include <linux/signal.h>
31#include <linux/sched.h>
32#include <linux/types.h>
33#include <linux/interrupt.h> 27#include <linux/interrupt.h>
34#include <linux/ioport.h> 28#include <asm/irq_cpu.h>
35#include <linux/timex.h>
36#include <linux/slab.h>
37#include <linux/random.h>
38#include <linux/irq.h>
39#include <linux/bitops.h>
40#include <asm/bootinfo.h>
41#include <asm/io.h>
42#include <asm/irq.h>
43#include <asm/mipsregs.h> 29#include <asm/mipsregs.h>
44#include <asm/system.h>
45#include <asm/tx4927/tx4927.h> 30#include <asm/tx4927/tx4927.h>
46#ifdef CONFIG_TOSHIBA_RBTX4927 31#ifdef CONFIG_TOSHIBA_RBTX4927
47#include <asm/tx4927/toshiba_rbtx4927.h> 32#include <asm/tx4927/toshiba_rbtx4927.h>
48#endif 33#endif
49 34
50/*
51 * DEBUG
52 */
53
54#undef TX4927_IRQ_DEBUG
55
56#ifdef TX4927_IRQ_DEBUG
57#define TX4927_IRQ_NONE 0x00000000
58
59#define TX4927_IRQ_INFO ( 1 << 0 )
60#define TX4927_IRQ_WARN ( 1 << 1 )
61#define TX4927_IRQ_EROR ( 1 << 2 )
62
63#define TX4927_IRQ_INIT ( 1 << 5 )
64#define TX4927_IRQ_NEST1 ( 1 << 6 )
65#define TX4927_IRQ_NEST2 ( 1 << 7 )
66#define TX4927_IRQ_NEST3 ( 1 << 8 )
67#define TX4927_IRQ_NEST4 ( 1 << 9 )
68
69#define TX4927_IRQ_CP0_INIT ( 1 << 10 )
70#define TX4927_IRQ_CP0_ENABLE ( 1 << 13 )
71#define TX4927_IRQ_CP0_DISABLE ( 1 << 14 )
72
73#define TX4927_IRQ_PIC_INIT ( 1 << 20 )
74#define TX4927_IRQ_PIC_ENABLE ( 1 << 23 )
75#define TX4927_IRQ_PIC_DISABLE ( 1 << 24 )
76
77#define TX4927_IRQ_ALL 0xffffffff
78#endif
79
80#ifdef TX4927_IRQ_DEBUG
81static const u32 tx4927_irq_debug_flag = (TX4927_IRQ_NONE
82 | TX4927_IRQ_INFO
83 | TX4927_IRQ_WARN | TX4927_IRQ_EROR
84// | TX4927_IRQ_CP0_INIT
85// | TX4927_IRQ_CP0_ENABLE
86// | TX4927_IRQ_CP0_ENDIRQ
87// | TX4927_IRQ_PIC_INIT
88// | TX4927_IRQ_PIC_ENABLE
89// | TX4927_IRQ_PIC_DISABLE
90// | TX4927_IRQ_INIT
91// | TX4927_IRQ_NEST1
92// | TX4927_IRQ_NEST2
93// | TX4927_IRQ_NEST3
94// | TX4927_IRQ_NEST4
95 );
96#endif
97
98#ifdef TX4927_IRQ_DEBUG
99#define TX4927_IRQ_DPRINTK(flag,str...) \
100 if ( (tx4927_irq_debug_flag) & (flag) ) \
101 { \
102 char tmp[100]; \
103 sprintf( tmp, str ); \
104 printk( "%s(%s:%u)::%s", __FUNCTION__, __FILE__, __LINE__, tmp ); \
105 }
106#else
107#define TX4927_IRQ_DPRINTK(flag,str...)
108#endif
109
110/*
111 * Forwad definitions for all pic's
112 */
113
114static void tx4927_irq_cp0_enable(unsigned int irq);
115static void tx4927_irq_cp0_disable(unsigned int irq);
116
117static void tx4927_irq_pic_enable(unsigned int irq);
118static void tx4927_irq_pic_disable(unsigned int irq);
119
120/*
121 * Kernel structs for all pic's
122 */
123
124#define TX4927_CP0_NAME "TX4927-CP0"
125static struct irq_chip tx4927_irq_cp0_type = {
126 .name = TX4927_CP0_NAME,
127 .ack = tx4927_irq_cp0_disable,
128 .mask = tx4927_irq_cp0_disable,
129 .mask_ack = tx4927_irq_cp0_disable,
130 .unmask = tx4927_irq_cp0_enable,
131};
132
133#define TX4927_PIC_NAME "TX4927-PIC"
134static struct irq_chip tx4927_irq_pic_type = {
135 .name = TX4927_PIC_NAME,
136 .ack = tx4927_irq_pic_disable,
137 .mask = tx4927_irq_pic_disable,
138 .mask_ack = tx4927_irq_pic_disable,
139 .unmask = tx4927_irq_pic_enable,
140};
141
142#define TX4927_PIC_ACTION(s) { no_action, 0, CPU_MASK_NONE, s, NULL, NULL }
143static struct irqaction tx4927_irq_pic_action =
144TX4927_PIC_ACTION(TX4927_PIC_NAME);
145
146#define CCP0_STATUS 12
147#define CCP0_CAUSE 13
148
149/*
150 * Functions for cp0
151 */
152
153#define tx4927_irq_cp0_mask(irq) ( 1 << ( irq-TX4927_IRQ_CP0_BEG+8 ) )
154
155static void
156tx4927_irq_cp0_modify(unsigned cp0_reg, unsigned clr_bits, unsigned set_bits)
157{
158 unsigned long val = 0;
159
160 switch (cp0_reg) {
161 case CCP0_STATUS:
162 val = read_c0_status();
163 break;
164
165 case CCP0_CAUSE:
166 val = read_c0_cause();
167 break;
168
169 }
170
171 val &= (~clr_bits);
172 val |= (set_bits);
173
174 switch (cp0_reg) {
175 case CCP0_STATUS:{
176 write_c0_status(val);
177 break;
178 }
179 case CCP0_CAUSE:{
180 write_c0_cause(val);
181 break;
182 }
183 }
184}
185
186static void __init tx4927_irq_cp0_init(void)
187{
188 int i;
189
190 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_INIT, "beg=%d end=%d\n",
191 TX4927_IRQ_CP0_BEG, TX4927_IRQ_CP0_END);
192
193 for (i = TX4927_IRQ_CP0_BEG; i <= TX4927_IRQ_CP0_END; i++)
194 set_irq_chip_and_handler(i, &tx4927_irq_cp0_type,
195 handle_level_irq);
196}
197
198static void tx4927_irq_cp0_enable(unsigned int irq)
199{
200 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_ENABLE, "irq=%d \n", irq);
201
202 tx4927_irq_cp0_modify(CCP0_STATUS, 0, tx4927_irq_cp0_mask(irq));
203}
204
205static void tx4927_irq_cp0_disable(unsigned int irq)
206{
207 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_DISABLE, "irq=%d \n", irq);
208
209 tx4927_irq_cp0_modify(CCP0_STATUS, tx4927_irq_cp0_mask(irq), 0);
210}
211
212/*
213 * Functions for pic
214 */
215u32 tx4927_irq_pic_addr(int irq)
216{
217 /* MVMCP -- need to formulize this */
218 irq -= TX4927_IRQ_PIC_BEG;
219 switch (irq) {
220 case 17:
221 case 16:
222 case 1:
223 case 0:
224 return (0xff1ff610);
225
226 case 19:
227 case 18:
228 case 3:
229 case 2:
230 return (0xff1ff614);
231
232 case 21:
233 case 20:
234 case 5:
235 case 4:
236 return (0xff1ff618);
237
238 case 23:
239 case 22:
240 case 7:
241 case 6:
242 return (0xff1ff61c);
243
244 case 25:
245 case 24:
246 case 9:
247 case 8:
248 return (0xff1ff620);
249
250 case 27:
251 case 26:
252 case 11:
253 case 10:
254 return (0xff1ff624);
255
256 case 29:
257 case 28:
258 case 13:
259 case 12:
260 return (0xff1ff628);
261
262 case 31:
263 case 30:
264 case 15:
265 case 14:
266 return (0xff1ff62c);
267
268 }
269 return (0);
270}
271
272u32 tx4927_irq_pic_mask(int irq)
273{
274 /* MVMCP -- need to formulize this */
275 irq -= TX4927_IRQ_PIC_BEG;
276 switch (irq) {
277 case 31:
278 case 29:
279 case 27:
280 case 25:
281 case 23:
282 case 21:
283 case 19:
284 case 17:{
285 return (0x07000000);
286 }
287 case 30:
288 case 28:
289 case 26:
290 case 24:
291 case 22:
292 case 20:
293 case 18:
294 case 16:{
295 return (0x00070000);
296 }
297 case 15:
298 case 13:
299 case 11:
300 case 9:
301 case 7:
302 case 5:
303 case 3:
304 case 1:{
305 return (0x00000700);
306 }
307 case 14:
308 case 12:
309 case 10:
310 case 8:
311 case 6:
312 case 4:
313 case 2:
314 case 0:{
315 return (0x00000007);
316 }
317 }
318 return (0x00000000);
319}
320
321static void tx4927_irq_pic_modify(unsigned pic_reg, unsigned clr_bits,
322 unsigned set_bits)
323{
324 unsigned long val = 0;
325
326 val = TX4927_RD(pic_reg);
327 val &= (~clr_bits);
328 val |= (set_bits);
329 TX4927_WR(pic_reg, val);
330}
331
332static void __init tx4927_irq_pic_init(void)
333{
334 int i;
335
336 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_INIT, "beg=%d end=%d\n",
337 TX4927_IRQ_PIC_BEG, TX4927_IRQ_PIC_END);
338
339 for (i = TX4927_IRQ_PIC_BEG; i <= TX4927_IRQ_PIC_END; i++)
340 set_irq_chip_and_handler(i, &tx4927_irq_pic_type,
341 handle_level_irq);
342
343 setup_irq(TX4927_IRQ_NEST_PIC_ON_CP0, &tx4927_irq_pic_action);
344
345 TX4927_WR(0xff1ff640, 0x6); /* irq level mask -- only accept hightest */
346 TX4927_WR(0xff1ff600, TX4927_RD(0xff1ff600) | 0x1); /* irq enable */
347}
348
349static void tx4927_irq_pic_enable(unsigned int irq)
350{
351 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_ENABLE, "irq=%d\n", irq);
352
353 tx4927_irq_pic_modify(tx4927_irq_pic_addr(irq), 0,
354 tx4927_irq_pic_mask(irq));
355}
356
357static void tx4927_irq_pic_disable(unsigned int irq)
358{
359 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_DISABLE, "irq=%d\n", irq);
360
361 tx4927_irq_pic_modify(tx4927_irq_pic_addr(irq),
362 tx4927_irq_pic_mask(irq), 0);
363}
364
365/*
366 * Main init functions
367 */
368void __init tx4927_irq_init(void) 35void __init tx4927_irq_init(void)
369{ 36{
370 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "-\n"); 37 mips_cpu_irq_init();
371 38 txx9_irq_init(TX4927_IRC_REG);
372 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_cp0_init()\n"); 39 set_irq_chained_handler(TX4927_IRQ_NEST_PIC_ON_CP0, handle_simple_irq);
373 tx4927_irq_cp0_init();
374
375 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_pic_init()\n");
376 tx4927_irq_pic_init();
377
378 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n");
379}
380
381static int tx4927_irq_nested(void)
382{
383 int sw_irq = 0;
384 u32 level2;
385
386 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST1, "-\n");
387
388 level2 = TX4927_RD(0xff1ff6a0);
389 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST2, "=level2a=0x%x\n", level2);
390
391 if ((level2 & 0x10000) == 0) {
392 level2 &= 0x1f;
393 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST3, "=level2b=0x%x\n", level2);
394
395 sw_irq = TX4927_IRQ_PIC_BEG + level2;
396 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST3, "=sw_irq=%d\n", sw_irq);
397
398 if (sw_irq == 27) {
399 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST4, "=irq-%d\n",
400 sw_irq);
401
402#ifdef CONFIG_TOSHIBA_RBTX4927
403 {
404 sw_irq = toshiba_rbtx4927_irq_nested(sw_irq);
405 }
406#endif
407
408 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST4, "=irq+%d\n",
409 sw_irq);
410 }
411 }
412
413 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST2, "=sw_irq=%d\n", sw_irq);
414
415 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST1, "+\n");
416
417 return (sw_irq);
418} 40}
419 41
420asmlinkage void plat_irq_dispatch(void) 42asmlinkage void plat_irq_dispatch(void)
@@ -424,9 +46,12 @@ asmlinkage void plat_irq_dispatch(void)
424 if (pending & STATUSF_IP7) /* cpu timer */ 46 if (pending & STATUSF_IP7) /* cpu timer */
425 do_IRQ(TX4927_IRQ_CPU_TIMER); 47 do_IRQ(TX4927_IRQ_CPU_TIMER);
426 else if (pending & STATUSF_IP2) { /* tx4927 pic */ 48 else if (pending & STATUSF_IP2) { /* tx4927 pic */
427 unsigned int irq = tx4927_irq_nested(); 49 int irq = txx9_irq();
428 50#ifdef CONFIG_TOSHIBA_RBTX4927
429 if (unlikely(irq == 0)) { 51 if (irq == TX4927_IRQ_NEST_EXT_ON_PIC)
52 irq = toshiba_rbtx4927_irq_nested(irq);
53#endif
54 if (unlikely(irq < 0)) {
430 spurious_interrupt(); 55 spurious_interrupt();
431 return; 56 return;
432 } 57 }
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
index e265fcd31b60..9607ad5e734a 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -133,6 +133,7 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB
133#include <linux/bootmem.h> 133#include <linux/bootmem.h>
134#include <linux/blkdev.h> 134#include <linux/blkdev.h>
135#ifdef CONFIG_TOSHIBA_FPCIB0 135#ifdef CONFIG_TOSHIBA_FPCIB0
136#include <asm/i8259.h>
136#include <asm/tx4927/smsc_fdc37m81x.h> 137#include <asm/tx4927/smsc_fdc37m81x.h>
137#endif 138#endif
138#include <asm/tx4927/toshiba_rbtx4927.h> 139#include <asm/tx4927/toshiba_rbtx4927.h>
@@ -151,11 +152,6 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB
151#define TOSHIBA_RBTX4927_IRQ_IOC_ENABLE ( 1 << 13 ) 152#define TOSHIBA_RBTX4927_IRQ_IOC_ENABLE ( 1 << 13 )
152#define TOSHIBA_RBTX4927_IRQ_IOC_DISABLE ( 1 << 14 ) 153#define TOSHIBA_RBTX4927_IRQ_IOC_DISABLE ( 1 << 14 )
153 154
154#define TOSHIBA_RBTX4927_IRQ_ISA_INIT ( 1 << 20 )
155#define TOSHIBA_RBTX4927_IRQ_ISA_ENABLE ( 1 << 23 )
156#define TOSHIBA_RBTX4927_IRQ_ISA_DISABLE ( 1 << 24 )
157#define TOSHIBA_RBTX4927_IRQ_ISA_MASK ( 1 << 25 )
158
159#define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff 155#define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff
160#endif 156#endif
161 157
@@ -167,10 +163,6 @@ static const u32 toshiba_rbtx4927_irq_debug_flag =
167// | TOSHIBA_RBTX4927_IRQ_IOC_INIT 163// | TOSHIBA_RBTX4927_IRQ_IOC_INIT
168// | TOSHIBA_RBTX4927_IRQ_IOC_ENABLE 164// | TOSHIBA_RBTX4927_IRQ_IOC_ENABLE
169// | TOSHIBA_RBTX4927_IRQ_IOC_DISABLE 165// | TOSHIBA_RBTX4927_IRQ_IOC_DISABLE
170// | TOSHIBA_RBTX4927_IRQ_ISA_INIT
171// | TOSHIBA_RBTX4927_IRQ_ISA_ENABLE
172// | TOSHIBA_RBTX4927_IRQ_ISA_DISABLE
173// | TOSHIBA_RBTX4927_IRQ_ISA_MASK
174 ); 166 );
175#endif 167#endif
176 168
@@ -196,33 +188,14 @@ static const u32 toshiba_rbtx4927_irq_debug_flag =
196#define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */ 188#define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */
197#define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */ 189#define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */
198 190
199
200#define TOSHIBA_RBTX4927_IRQ_ISA_BEG MI8259_IRQ_ISA_BEG
201#define TOSHIBA_RBTX4927_IRQ_ISA_END MI8259_IRQ_ISA_END
202#define TOSHIBA_RBTX4927_IRQ_ISA_MID ((TOSHIBA_RBTX4927_IRQ_ISA_BEG+TOSHIBA_RBTX4927_IRQ_ISA_END+1)/2)
203
204
205#define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC 191#define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC
206#define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2) 192#define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2)
207#define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA (TOSHIBA_RBTX4927_IRQ_ISA_BEG+2)
208 193
209extern int tx4927_using_backplane; 194extern int tx4927_using_backplane;
210 195
211#ifdef CONFIG_TOSHIBA_FPCIB0
212extern void enable_8259A_irq(unsigned int irq);
213extern void disable_8259A_irq(unsigned int irq);
214extern void mask_and_ack_8259A(unsigned int irq);
215#endif
216
217static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq); 196static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq);
218static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq); 197static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq);
219 198
220#ifdef CONFIG_TOSHIBA_FPCIB0
221static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq);
222static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq);
223static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq);
224#endif
225
226#define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" 199#define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
227static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { 200static struct irq_chip toshiba_rbtx4927_irq_ioc_type = {
228 .name = TOSHIBA_RBTX4927_IOC_NAME, 201 .name = TOSHIBA_RBTX4927_IOC_NAME,
@@ -235,18 +208,6 @@ static struct irq_chip toshiba_rbtx4927_irq_ioc_type = {
235#define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006 208#define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006
236 209
237 210
238#ifdef CONFIG_TOSHIBA_FPCIB0
239#define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
240static struct irq_chip toshiba_rbtx4927_irq_isa_type = {
241 .name = TOSHIBA_RBTX4927_ISA_NAME,
242 .ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
243 .mask = toshiba_rbtx4927_irq_isa_disable,
244 .mask_ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
245 .unmask = toshiba_rbtx4927_irq_isa_enable,
246};
247#endif
248
249
250u32 bit2num(u32 num) 211u32 bit2num(u32 num)
251{ 212{
252 u32 i; 213 u32 i;
@@ -271,31 +232,10 @@ int toshiba_rbtx4927_irq_nested(int sw_irq)
271 } 232 }
272 } 233 }
273#ifdef CONFIG_TOSHIBA_FPCIB0 234#ifdef CONFIG_TOSHIBA_FPCIB0
274 { 235 if (tx4927_using_backplane) {
275 if (tx4927_using_backplane) { 236 int irq = i8259_irq();
276 u32 level4; 237 if (irq >= 0)
277 u32 level5; 238 sw_irq = irq;
278 outb(0x0A, 0x20);
279 level4 = inb(0x20) & 0xff;
280 if (level4) {
281 sw_irq =
282 TOSHIBA_RBTX4927_IRQ_ISA_BEG +
283 bit2num(level4);
284 if (sw_irq !=
285 TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA) {
286 goto RETURN;
287 }
288 }
289
290 outb(0x0A, 0xA0);
291 level5 = inb(0xA0) & 0xff;
292 if (level5) {
293 sw_irq =
294 TOSHIBA_RBTX4927_IRQ_ISA_MID +
295 bit2num(level5);
296 goto RETURN;
297 }
298 }
299 } 239 }
300#endif 240#endif
301 241
@@ -307,12 +247,6 @@ int toshiba_rbtx4927_irq_nested(int sw_irq)
307#define TOSHIBA_RBTX4927_PIC_ACTION(s) { no_action, IRQF_SHARED, CPU_MASK_NONE, s, NULL, NULL } 247#define TOSHIBA_RBTX4927_PIC_ACTION(s) { no_action, IRQF_SHARED, CPU_MASK_NONE, s, NULL, NULL }
308static struct irqaction toshiba_rbtx4927_irq_ioc_action = 248static struct irqaction toshiba_rbtx4927_irq_ioc_action =
309TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_IOC_NAME); 249TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_IOC_NAME);
310#ifdef CONFIG_TOSHIBA_FPCIB0
311static struct irqaction toshiba_rbtx4927_irq_isa_master =
312TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_ISA_NAME "/M");
313static struct irqaction toshiba_rbtx4927_irq_isa_slave =
314TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_ISA_NAME "/S");
315#endif
316 250
317 251
318/**********************************************************************************/ 252/**********************************************************************************/
@@ -378,92 +312,6 @@ static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq)
378} 312}
379 313
380 314
381/**********************************************************************************/
382/* Functions for isa */
383/**********************************************************************************/
384
385
386#ifdef CONFIG_TOSHIBA_FPCIB0
387static void __init toshiba_rbtx4927_irq_isa_init(void)
388{
389 int i;
390
391 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_INIT,
392 "beg=%d end=%d\n",
393 TOSHIBA_RBTX4927_IRQ_ISA_BEG,
394 TOSHIBA_RBTX4927_IRQ_ISA_END);
395
396 for (i = TOSHIBA_RBTX4927_IRQ_ISA_BEG;
397 i <= TOSHIBA_RBTX4927_IRQ_ISA_END; i++)
398 set_irq_chip_and_handler(i, &toshiba_rbtx4927_irq_isa_type,
399 handle_level_irq);
400
401 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC,
402 &toshiba_rbtx4927_irq_isa_master);
403 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA,
404 &toshiba_rbtx4927_irq_isa_slave);
405
406 /* make sure we are looking at IRR (not ISR) */
407 outb(0x0A, 0x20);
408 outb(0x0A, 0xA0);
409}
410#endif
411
412
413#ifdef CONFIG_TOSHIBA_FPCIB0
414static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq)
415{
416 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_ENABLE,
417 "irq=%d\n", irq);
418
419 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
420 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
421 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
422 "bad irq=%d\n", irq);
423 panic("\n");
424 }
425
426 enable_8259A_irq(irq);
427}
428#endif
429
430
431#ifdef CONFIG_TOSHIBA_FPCIB0
432static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq)
433{
434 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_DISABLE,
435 "irq=%d\n", irq);
436
437 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
438 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
439 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
440 "bad irq=%d\n", irq);
441 panic("\n");
442 }
443
444 disable_8259A_irq(irq);
445}
446#endif
447
448
449#ifdef CONFIG_TOSHIBA_FPCIB0
450static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq)
451{
452 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_MASK,
453 "irq=%d\n", irq);
454
455 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
456 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
457 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
458 "bad irq=%d\n", irq);
459 panic("\n");
460 }
461
462 mask_and_ack_8259A(irq);
463}
464#endif
465
466
467void __init arch_init_irq(void) 315void __init arch_init_irq(void)
468{ 316{
469 extern void tx4927_irq_init(void); 317 extern void tx4927_irq_init(void);
@@ -471,12 +319,11 @@ void __init arch_init_irq(void)
471 tx4927_irq_init(); 319 tx4927_irq_init();
472 toshiba_rbtx4927_irq_ioc_init(); 320 toshiba_rbtx4927_irq_ioc_init();
473#ifdef CONFIG_TOSHIBA_FPCIB0 321#ifdef CONFIG_TOSHIBA_FPCIB0
474 { 322 if (tx4927_using_backplane)
475 if (tx4927_using_backplane) { 323 init_i8259_irqs();
476 toshiba_rbtx4927_irq_isa_init();
477 }
478 }
479#endif 324#endif
325 /* Onboard 10M Ether: High Active */
326 set_irq_type(RBTX4927_RTL_8019_IRQ, IRQF_TRIGGER_HIGH);
480 327
481 wbflush(); 328 wbflush();
482} 329}
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index ea5a70b252a0..3e84237abe63 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -151,7 +151,6 @@ unsigned long mips_memory_upper;
151static int tx4927_ccfg_toeon = 1; 151static int tx4927_ccfg_toeon = 1;
152static int tx4927_pcic_trdyto = 0; /* default: disabled */ 152static int tx4927_pcic_trdyto = 0; /* default: disabled */
153unsigned long tx4927_ce_base[8]; 153unsigned long tx4927_ce_base[8];
154void tx4927_pci_setup(void);
155void tx4927_reset_pci_pcic(void); 154void tx4927_reset_pci_pcic(void);
156int tx4927_pci66 = 0; /* 0:auto */ 155int tx4927_pci66 = 0; /* 0:auto */
157#endif 156#endif
@@ -442,7 +441,7 @@ arch_initcall(tx4927_pcibios_init);
442extern struct resource pci_io_resource; 441extern struct resource pci_io_resource;
443extern struct resource pci_mem_resource; 442extern struct resource pci_mem_resource;
444 443
445void tx4927_pci_setup(void) 444void __init tx4927_pci_setup(void)
446{ 445{
447 static int called = 0; 446 static int called = 0;
448 extern unsigned int tx4927_get_mem_size(void); 447 extern unsigned int tx4927_get_mem_size(void);
@@ -748,12 +747,6 @@ void __init toshiba_rbtx4927_setup(void)
748 } 747 }
749#endif 748#endif
750 749
751 /* setup irq stuff */
752 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
753 ":Setting up tx4927 pic.\n");
754 TX4927_WR(0xff1ff604, 0x00000400); /* irq trigger */
755 TX4927_WR(0xff1ff608, 0x00000000); /* irq trigger */
756
757 /* setup serial stuff */ 750 /* setup serial stuff */
758 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP, 751 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
759 ":Setting up tx4927 sio.\n"); 752 ":Setting up tx4927 sio.\n");
@@ -915,7 +908,7 @@ void __init toshiba_rbtx4927_setup(void)
915 req.iotype = UPIO_MEM; 908 req.iotype = UPIO_MEM;
916 req.membase = (char *)(0xff1ff300 + i * 0x100); 909 req.membase = (char *)(0xff1ff300 + i * 0x100);
917 req.mapbase = 0xff1ff300 + i * 0x100; 910 req.mapbase = 0xff1ff300 + i * 0x100;
918 req.irq = 32 + i; 911 req.irq = TX4927_IRQ_PIC_BEG + 8 + i;
919 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/; 912 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
920 req.uartclk = 50000000; 913 req.uartclk = 50000000;
921 early_serial_txx9_setup(&req); 914 early_serial_txx9_setup(&req);