MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / include / asm-arm / arch-moxart / irq.h
blobf675b9c18c9ea1b8552ae3b0ac50267fc930a6d3
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-arm/mach/irq.h>
9 #ifdef CONFIG_PCI
10 #include <asm/arch/ftpci.h>
11 #endif // CONFIG_PCI
13 #if 0 // mask by Victor Yu. 03-15-2007
14 extern void cpe_mask_irq(unsigned int irq);
15 extern void cpe_unmask_irq(unsigned int irq);
16 extern void cpe_mask_ack_irq(unsigned int irq);
17 extern void cpe_clear_irq(unsigned int intNum);
18 extern void cpe_int_init(void);
20 #if 1 // add by Victor Yu. 05-17-2005
21 extern struct irqchip cpe_irq_chip;
22 #include <linux/interrupt.h>
23 #endif
25 static inline void irq_init_irq(void)
27 unsigned long flags;
28 int irq;
30 save_and_cli(flags);
31 cpe_int_init();
32 restore_flags(flags);
33 #if 1 // add by Victor Yu. 03-15-2007
34 cpe_irq_chip.ack = cpe_mask_ack_irq;
35 cpe_irq_chip.mask = cpe_mask_irq;
36 cpe_irq_chip.unmask = cpe_unmask_irq;
37 #endif
38 for (irq = 0; irq < NR_IRQS; irq++) {
39 set_irq_chip(irq, &cpe_irq_chip);
40 set_irq_handler(irq, do_level_IRQ);
41 set_irq_flags(irq, IRQF_VALID);
44 #endif
46 static inline int fixup_irq(int irq)
48 #ifdef CONFIG_ARCH_CPE
49 unsigned int status;
50 unsigned int i;
52 if( irq == IRQ_EXT_A321 ) {
53 status=*(volatile unsigned int *)(CPE_A321_IC_VA_BASE+IRQ_STATUS_REG);
54 if( status & (1<<(IRQ_A321_PCI-CPE_A321_IRQ_START)) ) { //pci irq
55 #ifdef CONFIG_PCI
56 switch ( ftpci_get_irq() ) {
57 case 0: return VIRQ_PCI_A;
58 case 1: return VIRQ_PCI_B;
59 case 2: return VIRQ_PCI_C;
60 case 3: return VIRQ_PCI_D;
62 #endif // CONFIG_PCI
63 for( i=0; i<32 ;i++ ) {
64 if ( status & (1<<i) )
65 return (i+CPE_A321_IRQ_START);
70 #endif // CONFIG_ARCH_CPE
72 #ifdef CONFIG_ARCH_IA240
73 #ifdef CONFIG_PCI
74 if ( irq == IRQ_PCI ) {
75 switch ( ftpci_get_irq() ) {
76 case 0: return VIRQ_PCI_A;
77 case 1: return VIRQ_PCI_B;
78 case 2: return VIRQ_PCI_C;
79 case 3: return VIRQ_PCI_D;
82 #endif // CONFIG_PCI
83 #endif // CONFIG_ARCH_IA240
85 return irq;
88 #endif /* __ASM_ARCH_IRQ_H__ */