2 * linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
4 * Toshiba RBTX4927 specific interrupt handlers
6 * Author: MontaVista Software, Inc.
9 * Copyright 2001-2002 MontaVista Software Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 01 RBTX4927-ISA/01 PS2/Keyboard
37 02 RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15)
47 12 RBTX4927-ISA/12 PS2/Mouse (not supported at this time)
49 14 RBTX4927-ISA/14 IDE
52 16 TX4927-CP0/00 Software 0
53 17 TX4927-CP0/01 Software 1
54 18 TX4927-CP0/02 Cascade TX4927-CP0
55 19 TX4927-CP0/03 Multiplexed -- do not use
56 20 TX4927-CP0/04 Multiplexed -- do not use
57 21 TX4927-CP0/05 Multiplexed -- do not use
58 22 TX4927-CP0/06 Multiplexed -- do not use
59 23 TX4927-CP0/07 CPU TIMER
64 27 TX4927-PIC/03 Cascade RBTX4927-IOC
66 29 TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet
69 32 TX4927-PIC/08 TX4927 SerialIO Channel 0
70 33 TX4927-PIC/09 TX4927 SerialIO Channel 1
77 40 TX4927-PIC/16 TX4927 PCI PCI-C
83 46 TX4927-PIC/22 TX4927 PCI PCI-ERR
84 47 TX4927-PIC/23 TX4927 PCI PCI-PMA (not used)
94 56 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed) [RTL-8139=PJ4]
95 57 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed) [RTL-8139=PJ5]
96 58 RBTX4927-IOC/02 FPCIB0 PCI-B PJ4/C PJ5/D SB/A PJ6/B PJ7/C (SouthBridge/IDE/pin=1,INTR) [RTL-8139=NotSupported]
97 59 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4) [RTL-8139=PJ6]
104 SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58
105 SouthBridge/ISA/pin=0 no pci irq used by this device
106 SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14
107 SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59
108 SouthBridge/PMC/pin=0 no pci irq used by this device
109 SuperIO/PS2/Keyboard, using INTR via ISA IRQ1
110 SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported)
111 JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6
114 #include <linux/config.h>
115 #include <linux/init.h>
116 #include <linux/kernel.h>
117 #include <linux/types.h>
118 #include <linux/mm.h>
119 #include <linux/swap.h>
120 #include <linux/ioport.h>
121 #include <linux/sched.h>
122 #include <linux/interrupt.h>
123 #include <linux/pci.h>
124 #include <linux/timex.h>
125 #include <asm/bootinfo.h>
126 #include <asm/page.h>
130 #include <asm/processor.h>
131 #include <asm/ptrace.h>
132 #include <asm/reboot.h>
133 #include <asm/time.h>
134 #include <linux/bootmem.h>
135 #include <linux/blkdev.h>
136 #ifdef CONFIG_RTC_DS1742
137 #include <linux/ds1742rtc.h>
139 #ifdef CONFIG_TOSHIBA_FPCIB0
140 #include <asm/tx4927/smsc_fdc37m81x.h>
142 #include <asm/tx4927/toshiba_rbtx4927.h>
145 #undef TOSHIBA_RBTX4927_IRQ_DEBUG
147 #ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
148 #define TOSHIBA_RBTX4927_IRQ_NONE 0x00000000
150 #define TOSHIBA_RBTX4927_IRQ_INFO ( 1 << 0 )
151 #define TOSHIBA_RBTX4927_IRQ_WARN ( 1 << 1 )
152 #define TOSHIBA_RBTX4927_IRQ_EROR ( 1 << 2 )
154 #define TOSHIBA_RBTX4927_IRQ_IOC_INIT ( 1 << 10 )
155 #define TOSHIBA_RBTX4927_IRQ_IOC_STARTUP ( 1 << 11 )
156 #define TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN ( 1 << 12 )
157 #define TOSHIBA_RBTX4927_IRQ_IOC_ENABLE ( 1 << 13 )
158 #define TOSHIBA_RBTX4927_IRQ_IOC_DISABLE ( 1 << 14 )
159 #define TOSHIBA_RBTX4927_IRQ_IOC_MASK ( 1 << 15 )
160 #define TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ ( 1 << 16 )
162 #define TOSHIBA_RBTX4927_IRQ_ISA_INIT ( 1 << 20 )
163 #define TOSHIBA_RBTX4927_IRQ_ISA_STARTUP ( 1 << 21 )
164 #define TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN ( 1 << 22 )
165 #define TOSHIBA_RBTX4927_IRQ_ISA_ENABLE ( 1 << 23 )
166 #define TOSHIBA_RBTX4927_IRQ_ISA_DISABLE ( 1 << 24 )
167 #define TOSHIBA_RBTX4927_IRQ_ISA_MASK ( 1 << 25 )
168 #define TOSHIBA_RBTX4927_IRQ_ISA_ENDIRQ ( 1 << 26 )
170 #define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff
174 #ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
175 static const u32 toshiba_rbtx4927_irq_debug_flag
=
176 (TOSHIBA_RBTX4927_IRQ_NONE
| TOSHIBA_RBTX4927_IRQ_INFO
|
177 TOSHIBA_RBTX4927_IRQ_WARN
| TOSHIBA_RBTX4927_IRQ_EROR
178 // | TOSHIBA_RBTX4927_IRQ_IOC_INIT
179 // | TOSHIBA_RBTX4927_IRQ_IOC_STARTUP
180 // | TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN
181 // | TOSHIBA_RBTX4927_IRQ_IOC_ENABLE
182 // | TOSHIBA_RBTX4927_IRQ_IOC_DISABLE
183 // | TOSHIBA_RBTX4927_IRQ_IOC_MASK
184 // | TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ
185 // | TOSHIBA_RBTX4927_IRQ_ISA_INIT
186 // | TOSHIBA_RBTX4927_IRQ_ISA_STARTUP
187 // | TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN
188 // | TOSHIBA_RBTX4927_IRQ_ISA_ENABLE
189 // | TOSHIBA_RBTX4927_IRQ_ISA_DISABLE
190 // | TOSHIBA_RBTX4927_IRQ_ISA_MASK
191 // | TOSHIBA_RBTX4927_IRQ_ISA_ENDIRQ
196 #ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
197 #define TOSHIBA_RBTX4927_IRQ_DPRINTK(flag,str...) \
198 if ( (toshiba_rbtx4927_irq_debug_flag) & (flag) ) \
201 sprintf( tmp, str ); \
202 printk( "%s(%s:%u)::%s", __FUNCTION__, __FILE__, __LINE__, tmp ); \
205 #define TOSHIBA_RBTX4927_IRQ_DPRINTK(flag,str...)
211 #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0
212 #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_END 7
214 #define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */
215 #define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */
218 #define TOSHIBA_RBTX4927_IRQ_ISA_BEG MI8259_IRQ_ISA_BEG
219 #define TOSHIBA_RBTX4927_IRQ_ISA_END MI8259_IRQ_ISA_END
220 #define TOSHIBA_RBTX4927_IRQ_ISA_MID ((TOSHIBA_RBTX4927_IRQ_ISA_BEG+TOSHIBA_RBTX4927_IRQ_ISA_END+1)/2)
223 #define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC
224 #define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2)
225 #define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA (TOSHIBA_RBTX4927_IRQ_ISA_BEG+2)
227 extern int tx4927_using_backplane
;
229 #ifdef CONFIG_TOSHIBA_FPCIB0
230 extern void enable_8259A_irq(unsigned int irq
);
231 extern void disable_8259A_irq(unsigned int irq
);
232 extern void mask_and_ack_8259A(unsigned int irq
);
235 static unsigned int toshiba_rbtx4927_irq_ioc_startup(unsigned int irq
);
236 static void toshiba_rbtx4927_irq_ioc_shutdown(unsigned int irq
);
237 static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq
);
238 static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq
);
239 static void toshiba_rbtx4927_irq_ioc_mask_and_ack(unsigned int irq
);
240 static void toshiba_rbtx4927_irq_ioc_end(unsigned int irq
);
242 #ifdef CONFIG_TOSHIBA_FPCIB0
243 static unsigned int toshiba_rbtx4927_irq_isa_startup(unsigned int irq
);
244 static void toshiba_rbtx4927_irq_isa_shutdown(unsigned int irq
);
245 static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq
);
246 static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq
);
247 static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq
);
248 static void toshiba_rbtx4927_irq_isa_end(unsigned int irq
);
251 static DEFINE_SPINLOCK(toshiba_rbtx4927_ioc_lock
);
254 #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
255 static struct hw_interrupt_type toshiba_rbtx4927_irq_ioc_type
= {
256 .typename
= TOSHIBA_RBTX4927_IOC_NAME
,
257 .startup
= toshiba_rbtx4927_irq_ioc_startup
,
258 .shutdown
= toshiba_rbtx4927_irq_ioc_shutdown
,
259 .enable
= toshiba_rbtx4927_irq_ioc_enable
,
260 .disable
= toshiba_rbtx4927_irq_ioc_disable
,
261 .ack
= toshiba_rbtx4927_irq_ioc_mask_and_ack
,
262 .end
= toshiba_rbtx4927_irq_ioc_end
,
265 #define TOSHIBA_RBTX4927_IOC_INTR_ENAB 0xbc002000
266 #define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006
269 #ifdef CONFIG_TOSHIBA_FPCIB0
270 #define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
271 static struct hw_interrupt_type toshiba_rbtx4927_irq_isa_type
= {
272 .typename
= TOSHIBA_RBTX4927_ISA_NAME
,
273 .startup
= toshiba_rbtx4927_irq_isa_startup
,
274 .shutdown
= toshiba_rbtx4927_irq_isa_shutdown
,
275 .enable
= toshiba_rbtx4927_irq_isa_enable
,
276 .disable
= toshiba_rbtx4927_irq_isa_disable
,
277 .ack
= toshiba_rbtx4927_irq_isa_mask_and_ack
,
278 .end
= toshiba_rbtx4927_irq_isa_end
,
288 for (i
= 0; i
< (sizeof(num
) * 8); i
++) {
289 if (num
& (1 << i
)) {
296 int toshiba_rbtx4927_irq_nested(int sw_irq
)
302 level3
= reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT
) & 0x1f;
304 sw_irq
= TOSHIBA_RBTX4927_IRQ_IOC_BEG
+ bit2num(level3
);
305 if (sw_irq
!= TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC
) {
309 #ifdef CONFIG_TOSHIBA_FPCIB0
311 if (tx4927_using_backplane
) {
313 level4
= inb(0x20) & 0xff;
316 TOSHIBA_RBTX4927_IRQ_ISA_BEG
+
319 TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA
) {
325 level5
= inb(0xA0) & 0xff;
328 TOSHIBA_RBTX4927_IRQ_ISA_MID
+
340 //#define TOSHIBA_RBTX4927_PIC_ACTION(s) { no_action, 0, CPU_MASK_NONE, s, NULL, NULL }
341 #define TOSHIBA_RBTX4927_PIC_ACTION(s) { no_action, SA_SHIRQ, CPU_MASK_NONE, s, NULL, NULL }
342 static struct irqaction toshiba_rbtx4927_irq_ioc_action
=
343 TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_IOC_NAME
);
344 #ifdef CONFIG_TOSHIBA_FPCIB0
345 static struct irqaction toshiba_rbtx4927_irq_isa_master
=
346 TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_ISA_NAME
"/M");
347 static struct irqaction toshiba_rbtx4927_irq_isa_slave
=
348 TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_ISA_NAME
"/S");
352 /**********************************************************************************/
353 /* Functions for ioc */
354 /**********************************************************************************/
357 static void __init
toshiba_rbtx4927_irq_ioc_init(void)
361 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_INIT
,
363 TOSHIBA_RBTX4927_IRQ_IOC_BEG
,
364 TOSHIBA_RBTX4927_IRQ_IOC_END
);
366 for (i
= TOSHIBA_RBTX4927_IRQ_IOC_BEG
;
367 i
<= TOSHIBA_RBTX4927_IRQ_IOC_END
; i
++) {
368 irq_desc
[i
].status
= IRQ_DISABLED
;
369 irq_desc
[i
].action
= 0;
370 irq_desc
[i
].depth
= 3;
371 irq_desc
[i
].handler
= &toshiba_rbtx4927_irq_ioc_type
;
374 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC
,
375 &toshiba_rbtx4927_irq_ioc_action
);
380 static unsigned int toshiba_rbtx4927_irq_ioc_startup(unsigned int irq
)
382 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_STARTUP
,
385 if (irq
< TOSHIBA_RBTX4927_IRQ_IOC_BEG
386 || irq
> TOSHIBA_RBTX4927_IRQ_IOC_END
) {
387 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
388 "bad irq=%d\n", irq
);
392 toshiba_rbtx4927_irq_ioc_enable(irq
);
398 static void toshiba_rbtx4927_irq_ioc_shutdown(unsigned int irq
)
400 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN
,
403 if (irq
< TOSHIBA_RBTX4927_IRQ_IOC_BEG
404 || irq
> TOSHIBA_RBTX4927_IRQ_IOC_END
) {
405 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
406 "bad irq=%d\n", irq
);
410 toshiba_rbtx4927_irq_ioc_disable(irq
);
416 static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq
)
419 volatile unsigned char v
;
421 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENABLE
,
424 if (irq
< TOSHIBA_RBTX4927_IRQ_IOC_BEG
425 || irq
> TOSHIBA_RBTX4927_IRQ_IOC_END
) {
426 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
427 "bad irq=%d\n", irq
);
431 spin_lock_irqsave(&toshiba_rbtx4927_ioc_lock
, flags
);
433 v
= TX4927_RD08(TOSHIBA_RBTX4927_IOC_INTR_ENAB
);
434 v
|= (1 << (irq
- TOSHIBA_RBTX4927_IRQ_IOC_BEG
));
435 TOSHIBA_RBTX4927_WR08(TOSHIBA_RBTX4927_IOC_INTR_ENAB
, v
);
437 spin_unlock_irqrestore(&toshiba_rbtx4927_ioc_lock
, flags
);
443 static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq
)
446 volatile unsigned char v
;
448 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_DISABLE
,
451 if (irq
< TOSHIBA_RBTX4927_IRQ_IOC_BEG
452 || irq
> TOSHIBA_RBTX4927_IRQ_IOC_END
) {
453 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
454 "bad irq=%d\n", irq
);
458 spin_lock_irqsave(&toshiba_rbtx4927_ioc_lock
, flags
);
460 v
= TX4927_RD08(TOSHIBA_RBTX4927_IOC_INTR_ENAB
);
461 v
&= ~(1 << (irq
- TOSHIBA_RBTX4927_IRQ_IOC_BEG
));
462 TOSHIBA_RBTX4927_WR08(TOSHIBA_RBTX4927_IOC_INTR_ENAB
, v
);
464 spin_unlock_irqrestore(&toshiba_rbtx4927_ioc_lock
, flags
);
470 static void toshiba_rbtx4927_irq_ioc_mask_and_ack(unsigned int irq
)
472 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_MASK
,
475 if (irq
< TOSHIBA_RBTX4927_IRQ_IOC_BEG
476 || irq
> TOSHIBA_RBTX4927_IRQ_IOC_END
) {
477 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
478 "bad irq=%d\n", irq
);
482 toshiba_rbtx4927_irq_ioc_disable(irq
);
488 static void toshiba_rbtx4927_irq_ioc_end(unsigned int irq
)
490 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ
,
493 if (irq
< TOSHIBA_RBTX4927_IRQ_IOC_BEG
494 || irq
> TOSHIBA_RBTX4927_IRQ_IOC_END
) {
495 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
496 "bad irq=%d\n", irq
);
500 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
| IRQ_INPROGRESS
))) {
501 toshiba_rbtx4927_irq_ioc_enable(irq
);
508 /**********************************************************************************/
509 /* Functions for isa */
510 /**********************************************************************************/
513 #ifdef CONFIG_TOSHIBA_FPCIB0
514 static void __init
toshiba_rbtx4927_irq_isa_init(void)
518 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_INIT
,
520 TOSHIBA_RBTX4927_IRQ_ISA_BEG
,
521 TOSHIBA_RBTX4927_IRQ_ISA_END
);
523 for (i
= TOSHIBA_RBTX4927_IRQ_ISA_BEG
;
524 i
<= TOSHIBA_RBTX4927_IRQ_ISA_END
; i
++) {
525 irq_desc
[i
].status
= IRQ_DISABLED
;
526 irq_desc
[i
].action
= 0;
528 ((i
< TOSHIBA_RBTX4927_IRQ_ISA_MID
) ? (4) : (5));
529 irq_desc
[i
].handler
= &toshiba_rbtx4927_irq_isa_type
;
532 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC
,
533 &toshiba_rbtx4927_irq_isa_master
);
534 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA
,
535 &toshiba_rbtx4927_irq_isa_slave
);
537 /* make sure we are looking at IRR (not ISR) */
546 #ifdef CONFIG_TOSHIBA_FPCIB0
547 static unsigned int toshiba_rbtx4927_irq_isa_startup(unsigned int irq
)
549 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_STARTUP
,
552 if (irq
< TOSHIBA_RBTX4927_IRQ_ISA_BEG
553 || irq
> TOSHIBA_RBTX4927_IRQ_ISA_END
) {
554 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
555 "bad irq=%d\n", irq
);
559 toshiba_rbtx4927_irq_isa_enable(irq
);
566 #ifdef CONFIG_TOSHIBA_FPCIB0
567 static void toshiba_rbtx4927_irq_isa_shutdown(unsigned int irq
)
569 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN
,
572 if (irq
< TOSHIBA_RBTX4927_IRQ_ISA_BEG
573 || irq
> TOSHIBA_RBTX4927_IRQ_ISA_END
) {
574 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
575 "bad irq=%d\n", irq
);
579 toshiba_rbtx4927_irq_isa_disable(irq
);
586 #ifdef CONFIG_TOSHIBA_FPCIB0
587 static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq
)
589 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_ENABLE
,
592 if (irq
< TOSHIBA_RBTX4927_IRQ_ISA_BEG
593 || irq
> TOSHIBA_RBTX4927_IRQ_ISA_END
) {
594 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
595 "bad irq=%d\n", irq
);
599 enable_8259A_irq(irq
);
606 #ifdef CONFIG_TOSHIBA_FPCIB0
607 static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq
)
609 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_DISABLE
,
612 if (irq
< TOSHIBA_RBTX4927_IRQ_ISA_BEG
613 || irq
> TOSHIBA_RBTX4927_IRQ_ISA_END
) {
614 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
615 "bad irq=%d\n", irq
);
619 disable_8259A_irq(irq
);
626 #ifdef CONFIG_TOSHIBA_FPCIB0
627 static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq
)
629 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_MASK
,
632 if (irq
< TOSHIBA_RBTX4927_IRQ_ISA_BEG
633 || irq
> TOSHIBA_RBTX4927_IRQ_ISA_END
) {
634 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
635 "bad irq=%d\n", irq
);
639 mask_and_ack_8259A(irq
);
646 #ifdef CONFIG_TOSHIBA_FPCIB0
647 static void toshiba_rbtx4927_irq_isa_end(unsigned int irq
)
649 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_ENDIRQ
,
652 if (irq
< TOSHIBA_RBTX4927_IRQ_ISA_BEG
653 || irq
> TOSHIBA_RBTX4927_IRQ_ISA_END
) {
654 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR
,
655 "bad irq=%d\n", irq
);
659 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
| IRQ_INPROGRESS
))) {
660 toshiba_rbtx4927_irq_isa_enable(irq
);
668 void __init
arch_init_irq(void)
670 extern void tx4927_irq_init(void);
675 toshiba_rbtx4927_irq_ioc_init();
676 #ifdef CONFIG_TOSHIBA_FPCIB0
678 if (tx4927_using_backplane
) {
679 toshiba_rbtx4927_irq_isa_init();
689 void toshiba_rbtx4927_irq_dump(char *key
)
691 #ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
694 for (i
= 0; i
< NR_IRQS
; i
++) {
695 if (strcmp(irq_desc
[i
].handler
->typename
, "none")
700 && (irq_desc
[i
- 1].handler
->typename
==
701 irq_desc
[i
].handler
->typename
)) {
706 TOSHIBA_RBTX4927_IRQ_DPRINTK
707 (TOSHIBA_RBTX4927_IRQ_INFO
,
708 "%s irq=0x%02x/%3d s=0x%08x h=0x%08x a=0x%08x ah=0x%08x d=%1d n=%s/%02d\n",
709 key
, i
, i
, irq_desc
[i
].status
,
710 (u32
) irq_desc
[i
].handler
,
711 (u32
) irq_desc
[i
].action
,
712 (u32
) (irq_desc
[i
].action
? irq_desc
[i
].
713 action
->handler
: 0),
715 irq_desc
[i
].handler
->typename
, j
);
722 void toshiba_rbtx4927_irq_dump_pics(char *s
)
741 level0_m
= (read_c0_status() & 0x0000ff00) >> 8;
742 level0_s
= (read_c0_cause() & 0x0000ff00) >> 8;
745 level1_s
= level0_s
& 0x87;
747 level2
= TX4927_RD(0xff1ff6a0);
748 level2_p
= (((level2
& 0x10000)) ? 0 : 1);
749 level2_s
= (((level2
& 0x1f) == 0x1f) ? 0 : (level2
& 0x1f));
751 level3_m
= reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_ENAB
) & 0x1f;
752 level3_s
= reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT
) & 0x1f;
754 level4_m
= inb(0x21);
756 level4_s
= inb(0x20);
758 level5_m
= inb(0xa1);
760 level5_s
= inb(0xa0);
762 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
764 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
765 "cp0:m=0x%02x/s=0x%02x ", level0_m
,
767 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
768 "cp0:m=0x%02x/s=0x%02x ", level1_m
,
770 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
771 "pic:e=0x%02x/s=0x%02x ", level2_p
,
773 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
774 "ioc:m=0x%02x/s=0x%02x ", level3_m
,
776 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
777 "sbm:m=0x%02x/s=0x%02x ", level4_m
,
779 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
,
780 "sbs:m=0x%02x/s=0x%02x ", level5_m
,
782 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO
, "[%s]\n",