MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / asm-arm / arch-moxacpu / irq.h
blobc7d4f4e983bf9a089dc366c80266a8e84e004595
1 /* asm/arch-cpe/irq.h */
3 #ifndef __ASM_ARCH_IRQ_H__
4 #define __ASM_ARCH_IRQ_H__
6 #include <asm/hardware.h>
7 #include <asm/io.h>
8 #include <asm/mach/irq.h>
9 #include <asm/arch/irqs.h>
10 #include <asm/arch/ftpci.h>
11 #include <asm/arch/cpe/cpe.h>
13 extern void cpe_mask_irq(unsigned int irq);
14 extern void cpe_unmask_irq(unsigned int irq);
15 extern void cpe_mask_ack_irq(unsigned int irq);
16 extern void cpe_clear_irq(unsigned int intNum);
17 extern void cpe_int_init(void);
19 #if 1 // add by Victor Yu. 05-17-2005
20 extern struct irqchip cpe_irq_chip;
21 #include <linux/interrupt.h>
22 #endif
24 static inline void irq_init_irq(void)
26 unsigned long flags;
27 int irq;
29 save_and_cli(flags);
30 cpe_int_init();
31 restore_flags(flags);
32 for (irq = 0; irq < NR_IRQS; irq++) {
33 set_irq_chip(irq, &cpe_irq_chip);
34 set_irq_handler(irq, do_level_IRQ);
35 set_irq_flags(irq, IRQF_VALID);
39 static inline int fixup_irq(int irq)
41 #ifdef CONFIG_ARCH_CPE
42 unsigned int status;
43 unsigned int i;
45 if( irq == IRQ_EXT_A321 ) {
46 status=*(volatile unsigned int *)(CPE_A321_IC_VA_BASE+IRQ_STATUS_REG);
47 if( status & (1<<(IRQ_A321_PCI-CPE_A321_IRQ_START)) ) { //pci irq
48 #ifdef CONFIG_PCI
49 switch ( ftpci_get_irq() ) {
50 case 0: return VIRQ_PCI_A;
51 case 1: return VIRQ_PCI_B;
52 case 2: return VIRQ_PCI_C;
53 case 3: return VIRQ_PCI_D;
55 #endif // CONFIG_PCI
56 for( i=0; i<32 ;i++ ) {
57 if ( status & (1<<i) )
58 return (i+CPE_A321_IRQ_START);
63 #endif // CONFIG_ARCH_CPE
65 #ifdef CONFIG_ARCH_MOXACPU
66 #ifdef CONFIG_PCI
67 if ( irq == IRQ_PCI ) {
68 switch ( ftpci_get_irq() ) {
69 case 0: return VIRQ_PCI_A;
70 case 1: return VIRQ_PCI_B;
71 case 2: return VIRQ_PCI_C;
72 case 3: return VIRQ_PCI_D;
75 #endif // CONFIG_PCI
76 #endif // CONFIG_ARCH_MOXACPU
78 return irq;
81 #endif /* __ASM_ARCH_IRQ_H__ */