This source file includes following definitions.
- rts7751r2d_irq_demux
- init_rts7751r2d_IRQ
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 #include <linux/init.h>
  14 #include <linux/irq.h>
  15 #include <linux/interrupt.h>
  16 #include <linux/io.h>
  17 #include <mach/r2d.h>
  18 
  19 #define R2D_NR_IRL 13
  20 
  21 enum {
  22         UNUSED = 0,
  23 
  24         
  25         EXT,              
  26         RTC_T, RTC_A,     
  27         AX88796,          
  28         KEY,              
  29         SDCARD,           
  30         CF_CD, CF_IDE,    
  31         SM501,            
  32         PCI_INTD_RTL8139, 
  33         PCI_INTC_PCI1520, 
  34         PCI_INTB_RTL8139, 
  35         PCI_INTB_SLOT,    
  36         PCI_INTA_SLOT,    
  37         TP,               
  38 };
  39 
  40 #ifdef CONFIG_RTS7751R2D_1
  41 
  42 
  43 static struct intc_vect vectors_r2d_1[] __initdata = {
  44         INTC_IRQ(EXT, IRQ_EXT),
  45         INTC_IRQ(RTC_T, IRQ_RTC_T), INTC_IRQ(RTC_A, IRQ_RTC_A),
  46         INTC_IRQ(AX88796, IRQ_AX88796), INTC_IRQ(SDCARD, IRQ_SDCARD),
  47         INTC_IRQ(CF_CD, IRQ_CF_CD), INTC_IRQ(CF_IDE, IRQ_CF_IDE), 
  48         INTC_IRQ(SM501, IRQ_VOYAGER),
  49         INTC_IRQ(PCI_INTD_RTL8139, IRQ_PCI_INTD),
  50         INTC_IRQ(PCI_INTC_PCI1520, IRQ_PCI_INTC),
  51         INTC_IRQ(PCI_INTB_SLOT, IRQ_PCI_INTB),
  52         INTC_IRQ(PCI_INTA_SLOT, IRQ_PCI_INTA),
  53         INTC_IRQ(TP, IRQ_TP),
  54 };
  55 
  56 
  57 static struct intc_mask_reg mask_registers_r2d_1[] __initdata = {
  58         { 0xa4000000, 0, 16, 
  59           { TP, PCI_INTA_SLOT, PCI_INTB_SLOT,
  60             PCI_INTC_PCI1520, PCI_INTD_RTL8139,
  61             SM501, CF_IDE, CF_CD, SDCARD, AX88796,
  62             RTC_A, RTC_T, 0, 0, 0, EXT } },
  63 };
  64 
  65 
  66 static unsigned char irl2irq_r2d_1[R2D_NR_IRL] __initdata = {
  67         IRQ_PCI_INTD, IRQ_CF_IDE, IRQ_CF_CD, IRQ_PCI_INTC,
  68         IRQ_VOYAGER, IRQ_AX88796, IRQ_RTC_A, IRQ_RTC_T,
  69         IRQ_SDCARD, IRQ_PCI_INTA, IRQ_PCI_INTB, IRQ_EXT,
  70         IRQ_TP,
  71 };
  72 
  73 static DECLARE_INTC_DESC(intc_desc_r2d_1, "r2d-1", vectors_r2d_1,
  74                          NULL, mask_registers_r2d_1, NULL, NULL);
  75 
  76 #endif 
  77 
  78 #ifdef CONFIG_RTS7751R2D_PLUS
  79 
  80 
  81 static struct intc_vect vectors_r2d_plus[] __initdata = {
  82         INTC_IRQ(EXT, IRQ_EXT),
  83         INTC_IRQ(RTC_T, IRQ_RTC_T), INTC_IRQ(RTC_A, IRQ_RTC_A),
  84         INTC_IRQ(KEY, IRQ_KEY), INTC_IRQ(SDCARD, IRQ_SDCARD),
  85         INTC_IRQ(CF_CD, IRQ_CF_CD), INTC_IRQ(CF_IDE, IRQ_CF_IDE),
  86         INTC_IRQ(SM501, IRQ_VOYAGER),
  87         INTC_IRQ(PCI_INTD_RTL8139, IRQ_PCI_INTD),
  88         INTC_IRQ(PCI_INTC_PCI1520, IRQ_PCI_INTC),
  89         INTC_IRQ(PCI_INTB_RTL8139, IRQ_PCI_INTB),
  90         INTC_IRQ(PCI_INTA_SLOT, IRQ_PCI_INTA),
  91         INTC_IRQ(TP, IRQ_TP),
  92 };
  93 
  94 
  95 static struct intc_mask_reg mask_registers_r2d_plus[] __initdata = {
  96         { 0xa4000000, 0, 16, 
  97           { TP, PCI_INTA_SLOT, PCI_INTB_RTL8139,
  98             PCI_INTC_PCI1520, PCI_INTD_RTL8139,
  99             SM501, CF_IDE, CF_CD, SDCARD, KEY,
 100             RTC_A, RTC_T, 0, 0, 0, EXT } },
 101 };
 102 
 103 
 104 static unsigned char irl2irq_r2d_plus[R2D_NR_IRL] __initdata = {
 105         IRQ_PCI_INTD, IRQ_CF_IDE, IRQ_CF_CD, IRQ_PCI_INTC,
 106         IRQ_VOYAGER, IRQ_KEY, IRQ_RTC_A, IRQ_RTC_T,
 107         IRQ_SDCARD, IRQ_PCI_INTA, IRQ_PCI_INTB, IRQ_EXT,
 108         IRQ_TP,
 109 };
 110 
 111 static DECLARE_INTC_DESC(intc_desc_r2d_plus, "r2d-plus", vectors_r2d_plus,
 112                          NULL, mask_registers_r2d_plus, NULL, NULL);
 113 
 114 #endif 
 115 
 116 static unsigned char irl2irq[R2D_NR_IRL];
 117 
 118 int rts7751r2d_irq_demux(int irq)
 119 {
 120         if (irq >= R2D_NR_IRL || irq < 0 || !irl2irq[irq])
 121                 return irq;
 122 
 123         return irl2irq[irq];
 124 }
 125 
 126 
 127 
 128 
 129 void __init init_rts7751r2d_IRQ(void)
 130 {
 131         struct intc_desc *d;
 132 
 133         switch (__raw_readw(PA_VERREG) & 0xf0) {
 134 #ifdef CONFIG_RTS7751R2D_PLUS
 135         case 0x10:
 136                 printk(KERN_INFO "Using R2D-PLUS interrupt controller.\n");
 137                 d = &intc_desc_r2d_plus;
 138                 memcpy(irl2irq, irl2irq_r2d_plus, R2D_NR_IRL);
 139                 break;
 140 #endif
 141 #ifdef CONFIG_RTS7751R2D_1
 142         case 0x00: 
 143         case 0x30: 
 144                 printk(KERN_INFO "Using R2D-1 interrupt controller.\n");
 145                 d = &intc_desc_r2d_1;
 146                 memcpy(irl2irq, irl2irq_r2d_1, R2D_NR_IRL);
 147                 break;
 148 #endif
 149         default:
 150                 printk(KERN_INFO "Unknown R2D interrupt controller 0x%04x\n",
 151                        __raw_readw(PA_VERREG));
 152                 return;
 153         }
 154 
 155         register_intc_controller(d);
 156 }