diff options
Diffstat (limited to 'arch/sh/boards/se/7343/irq.c')
-rw-r--r-- | arch/sh/boards/se/7343/irq.c | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/arch/sh/boards/se/7343/irq.c b/arch/sh/boards/se/7343/irq.c new file mode 100644 index 00000000000..b41e3d4ea37 --- /dev/null +++ b/arch/sh/boards/se/7343/irq.c | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/7343/irq.c | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #include <linux/config.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/interrupt.h> | ||
9 | #include <linux/irq.h> | ||
10 | #include <asm/irq.h> | ||
11 | #include <asm/io.h> | ||
12 | #include <asm/mach/se7343.h> | ||
13 | |||
14 | static void | ||
15 | disable_intreq_irq(unsigned int irq) | ||
16 | { | ||
17 | int bit = irq - OFFCHIP_IRQ_BASE; | ||
18 | u16 val; | ||
19 | |||
20 | val = ctrl_inw(PA_CPLD_IMSK); | ||
21 | val |= 1 << bit; | ||
22 | ctrl_outw(val, PA_CPLD_IMSK); | ||
23 | } | ||
24 | |||
25 | static void | ||
26 | enable_intreq_irq(unsigned int irq) | ||
27 | { | ||
28 | int bit = irq - OFFCHIP_IRQ_BASE; | ||
29 | u16 val; | ||
30 | |||
31 | val = ctrl_inw(PA_CPLD_IMSK); | ||
32 | val &= ~(1 << bit); | ||
33 | ctrl_outw(val, PA_CPLD_IMSK); | ||
34 | } | ||
35 | |||
36 | static void | ||
37 | mask_and_ack_intreq_irq(unsigned int irq) | ||
38 | { | ||
39 | disable_intreq_irq(irq); | ||
40 | } | ||
41 | |||
42 | static unsigned int | ||
43 | startup_intreq_irq(unsigned int irq) | ||
44 | { | ||
45 | enable_intreq_irq(irq); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static void | ||
50 | shutdown_intreq_irq(unsigned int irq) | ||
51 | { | ||
52 | disable_intreq_irq(irq); | ||
53 | } | ||
54 | |||
55 | static void | ||
56 | end_intreq_irq(unsigned int irq) | ||
57 | { | ||
58 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
59 | enable_intreq_irq(irq); | ||
60 | } | ||
61 | |||
62 | static struct hw_interrupt_type intreq_irq_type = { | ||
63 | .typename = "FPGA-IRQ", | ||
64 | .startup = startup_intreq_irq, | ||
65 | .shutdown = shutdown_intreq_irq, | ||
66 | .enable = enable_intreq_irq, | ||
67 | .disable = disable_intreq_irq, | ||
68 | .ack = mask_and_ack_intreq_irq, | ||
69 | .end = end_intreq_irq | ||
70 | }; | ||
71 | |||
72 | static void | ||
73 | make_intreq_irq(unsigned int irq) | ||
74 | { | ||
75 | disable_irq_nosync(irq); | ||
76 | irq_desc[irq].handler = &intreq_irq_type; | ||
77 | disable_intreq_irq(irq); | ||
78 | } | ||
79 | |||
80 | int | ||
81 | shmse_irq_demux(int irq) | ||
82 | { | ||
83 | int bit; | ||
84 | volatile u16 val; | ||
85 | |||
86 | if (irq == IRQ5_IRQ) { | ||
87 | /* Read status Register */ | ||
88 | val = ctrl_inw(PA_CPLD_ST); | ||
89 | bit = ffs(val); | ||
90 | if (bit != 0) | ||
91 | return OFFCHIP_IRQ_BASE + bit - 1; | ||
92 | } | ||
93 | return irq; | ||
94 | } | ||
95 | |||
96 | /* IRQ5 is multiplexed between the following sources: | ||
97 | * 1. PC Card socket | ||
98 | * 2. Extension slot | ||
99 | * 3. USB Controller | ||
100 | * 4. Serial Controller | ||
101 | * | ||
102 | * We configure IRQ5 as a cascade IRQ. | ||
103 | */ | ||
104 | static struct irqaction irq5 = { no_action, 0, CPU_MASK_NONE, "IRQ5-cascade", | ||
105 | NULL, NULL}; | ||
106 | |||
107 | /* | ||
108 | * Initialize IRQ setting | ||
109 | */ | ||
110 | void __init | ||
111 | init_7343se_IRQ(void) | ||
112 | { | ||
113 | /* Setup Multiplexed interrupts */ | ||
114 | ctrl_outw(8, PA_CPLD_MODESET); /* Set all CPLD interrupts to active | ||
115 | * low. | ||
116 | */ | ||
117 | /* Mask all CPLD controller interrupts */ | ||
118 | ctrl_outw(0x0fff, PA_CPLD_IMSK); | ||
119 | |||
120 | /* PC Card interrupts */ | ||
121 | make_intreq_irq(PC_IRQ0); | ||
122 | make_intreq_irq(PC_IRQ1); | ||
123 | make_intreq_irq(PC_IRQ2); | ||
124 | make_intreq_irq(PC_IRQ3); | ||
125 | |||
126 | /* Extension Slot Interrupts */ | ||
127 | make_intreq_irq(EXT_IRQ0); | ||
128 | make_intreq_irq(EXT_IRQ1); | ||
129 | make_intreq_irq(EXT_IRQ2); | ||
130 | make_intreq_irq(EXT_IRQ3); | ||
131 | |||
132 | /* USB Controller interrupts */ | ||
133 | make_intreq_irq(USB_IRQ0); | ||
134 | make_intreq_irq(USB_IRQ1); | ||
135 | |||
136 | /* Serial Controller interrupts */ | ||
137 | make_intreq_irq(UART_IRQ0); | ||
138 | make_intreq_irq(UART_IRQ1); | ||
139 | |||
140 | /* Setup all external interrupts to be active low */ | ||
141 | ctrl_outw(0xaaaa, INTC_ICR1); | ||
142 | |||
143 | make_ipr_irq(IRQ5_IRQ, IRQ5_IPR_ADDR+2, IRQ5_IPR_POS, IRQ5_PRIORITY); | ||
144 | setup_irq(IRQ5_IRQ, &irq5); | ||
145 | /* Set port control to use IRQ5 */ | ||
146 | *(u16 *)0xA4050108 &= ~0xc; | ||
147 | |||
148 | make_ipr_irq(SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY); | ||
149 | make_ipr_irq(VPU_IRQ, VPU_IPR_ADDR, VPU_IPR_POS, 8); | ||
150 | |||
151 | ctrl_outb(0x0f, INTC_IMCR5); /* enable SCIF IRQ */ | ||
152 | |||
153 | make_ipr_irq(DMTE0_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
154 | make_ipr_irq(DMTE1_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
155 | make_ipr_irq(DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
156 | make_ipr_irq(DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
157 | make_ipr_irq(DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY); | ||
158 | make_ipr_irq(DMTE5_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY); | ||
159 | |||
160 | /* I2C block */ | ||
161 | make_ipr_irq(IIC0_ALI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY); | ||
162 | make_ipr_irq(IIC0_TACKI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, | ||
163 | IIC0_PRIORITY); | ||
164 | make_ipr_irq(IIC0_WAITI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, | ||
165 | IIC0_PRIORITY); | ||
166 | make_ipr_irq(IIC0_DTEI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY); | ||
167 | |||
168 | make_ipr_irq(IIC1_ALI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY); | ||
169 | make_ipr_irq(IIC1_TACKI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, | ||
170 | IIC1_PRIORITY); | ||
171 | make_ipr_irq(IIC1_WAITI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, | ||
172 | IIC1_PRIORITY); | ||
173 | make_ipr_irq(IIC1_DTEI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY); | ||
174 | |||
175 | /* SIOF */ | ||
176 | make_ipr_irq(SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY); | ||
177 | |||
178 | /* SIU */ | ||
179 | make_ipr_irq(SIU_IRQ, SIU_IPR_ADDR, SIU_IPR_POS, SIU_PRIORITY); | ||
180 | |||
181 | /* VIO interrupt */ | ||
182 | make_ipr_irq(CEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); | ||
183 | make_ipr_irq(BEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); | ||
184 | make_ipr_irq(VEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); | ||
185 | |||
186 | /*MFI interrupt*/ | ||
187 | |||
188 | make_ipr_irq(MFI_IRQ, MFI_IPR_ADDR, MFI_IPR_POS, MFI_PRIORITY); | ||
189 | |||
190 | /* LCD controller */ | ||
191 | make_ipr_irq(LCDC_IRQ, LCDC_IPR_ADDR, LCDC_IPR_POS, LCDC_PRIORITY); | ||
192 | ctrl_outw(0x2000, PA_MRSHPC + 0x0c); /* mrshpc irq enable */ | ||
193 | } | ||