2 * linux/arch/m32r/kernel/setup_usrv.c
4 * Setup routines for MITSUBISHI uServer
6 * Copyright (c) 2001, 2002, 2003 Hiroyuki Kondo, Hirokazu Takata,
10 #include <linux/config.h>
11 #include <linux/irq.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
15 #include <asm/system.h>
19 #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
21 #if !defined(CONFIG_SMP)
23 unsigned long icucr; /* ICU Control Register */
25 #endif /* CONFIG_SMP */
27 icu_data_t icu_data[M32700UT_NUM_CPU_IRQ];
29 static void disable_mappi_irq(unsigned int irq)
31 unsigned long port, data;
34 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
38 static void enable_mappi_irq(unsigned int irq)
40 unsigned long port, data;
43 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
47 static void mask_and_ack_mappi(unsigned int irq)
49 disable_mappi_irq(irq);
52 static void end_mappi_irq(unsigned int irq)
54 enable_mappi_irq(irq);
57 static unsigned int startup_mappi_irq(unsigned int irq)
59 enable_mappi_irq(irq);
63 static void shutdown_mappi_irq(unsigned int irq)
68 outl(M32R_ICUCR_ILEVEL7, port);
71 static struct hw_interrupt_type mappi_irq_type =
73 .typename = "M32700-IRQ",
74 .startup = startup_mappi_irq,
75 .shutdown = shutdown_mappi_irq,
76 .enable = enable_mappi_irq,
77 .disable = disable_mappi_irq,
78 .ack = mask_and_ack_mappi,
83 * Interrupt Control Unit of PLD on M32700UT (Level 2)
85 #define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE)
86 #define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \
87 (((x) - 1) * sizeof(unsigned short)))
90 unsigned short icucr; /* ICU Control Register */
93 static pld_icu_data_t pld_icu_data[M32700UT_NUM_PLD_IRQ];
95 static void disable_m32700ut_pld_irq(unsigned int irq)
97 unsigned long port, data;
100 pldirq = irq2pldirq(irq);
101 port = pldirq2port(pldirq);
102 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7;
106 static void enable_m32700ut_pld_irq(unsigned int irq)
108 unsigned long port, data;
111 pldirq = irq2pldirq(irq);
112 port = pldirq2port(pldirq);
113 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6;
117 static void mask_and_ack_m32700ut_pld(unsigned int irq)
119 disable_m32700ut_pld_irq(irq);
122 static void end_m32700ut_pld_irq(unsigned int irq)
124 enable_m32700ut_pld_irq(irq);
125 end_mappi_irq(M32R_IRQ_INT1);
128 static unsigned int startup_m32700ut_pld_irq(unsigned int irq)
130 enable_m32700ut_pld_irq(irq);
134 static void shutdown_m32700ut_pld_irq(unsigned int irq)
139 pldirq = irq2pldirq(irq);
140 port = pldirq2port(pldirq);
141 outw(PLD_ICUCR_ILEVEL7, port);
144 static struct hw_interrupt_type m32700ut_pld_irq_type =
146 .typename = "USRV-PLD-IRQ",
147 .startup = startup_m32700ut_pld_irq,
148 .shutdown = shutdown_m32700ut_pld_irq,
149 .enable = enable_m32700ut_pld_irq,
150 .disable = disable_m32700ut_pld_irq,
151 .ack = mask_and_ack_m32700ut_pld,
152 .end = end_m32700ut_pld_irq
155 void __init init_IRQ(void)
165 /* MFT2 : system timer */
166 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
167 irq_desc[M32R_IRQ_MFT2].handler = &mappi_irq_type;
168 irq_desc[M32R_IRQ_MFT2].action = 0;
169 irq_desc[M32R_IRQ_MFT2].depth = 1;
170 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
171 disable_mappi_irq(M32R_IRQ_MFT2);
173 #if defined(CONFIG_SERIAL_M32R_SIO)
174 /* SIO0_R : uart receive data */
175 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
176 irq_desc[M32R_IRQ_SIO0_R].handler = &mappi_irq_type;
177 irq_desc[M32R_IRQ_SIO0_R].action = 0;
178 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
179 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
180 disable_mappi_irq(M32R_IRQ_SIO0_R);
182 /* SIO0_S : uart send data */
183 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
184 irq_desc[M32R_IRQ_SIO0_S].handler = &mappi_irq_type;
185 irq_desc[M32R_IRQ_SIO0_S].action = 0;
186 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
187 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
188 disable_mappi_irq(M32R_IRQ_SIO0_S);
190 /* SIO1_R : uart receive data */
191 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
192 irq_desc[M32R_IRQ_SIO1_R].handler = &mappi_irq_type;
193 irq_desc[M32R_IRQ_SIO1_R].action = 0;
194 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
195 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
196 disable_mappi_irq(M32R_IRQ_SIO1_R);
198 /* SIO1_S : uart send data */
199 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
200 irq_desc[M32R_IRQ_SIO1_S].handler = &mappi_irq_type;
201 irq_desc[M32R_IRQ_SIO1_S].action = 0;
202 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
203 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
204 disable_mappi_irq(M32R_IRQ_SIO1_S);
205 #endif /* CONFIG_SERIAL_M32R_SIO */
207 /* INT#67-#71: CFC#0 IREQ on PLD */
208 for (i = 0 ; i < CONFIG_CFC_NUM ; i++ ) {
209 irq_desc[PLD_IRQ_CF0 + i].status = IRQ_DISABLED;
210 irq_desc[PLD_IRQ_CF0 + i].handler = &m32700ut_pld_irq_type;
211 irq_desc[PLD_IRQ_CF0 + i].action = 0;
212 irq_desc[PLD_IRQ_CF0 + i].depth = 1; /* disable nested irq */
213 pld_icu_data[irq2pldirq(PLD_IRQ_CF0 + i)].icucr
214 = PLD_ICUCR_ISMOD01; /* 'L' level sense */
215 disable_m32700ut_pld_irq(PLD_IRQ_CF0 + i);
218 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
219 /* INT#76: 16552D#0 IREQ on PLD */
220 irq_desc[PLD_IRQ_UART0].status = IRQ_DISABLED;
221 irq_desc[PLD_IRQ_UART0].handler = &m32700ut_pld_irq_type;
222 irq_desc[PLD_IRQ_UART0].action = 0;
223 irq_desc[PLD_IRQ_UART0].depth = 1; /* disable nested irq */
224 pld_icu_data[irq2pldirq(PLD_IRQ_UART0)].icucr
225 = PLD_ICUCR_ISMOD03; /* 'H' level sense */
226 disable_m32700ut_pld_irq(PLD_IRQ_UART0);
228 /* INT#77: 16552D#1 IREQ on PLD */
229 irq_desc[PLD_IRQ_UART1].status = IRQ_DISABLED;
230 irq_desc[PLD_IRQ_UART1].handler = &m32700ut_pld_irq_type;
231 irq_desc[PLD_IRQ_UART1].action = 0;
232 irq_desc[PLD_IRQ_UART1].depth = 1; /* disable nested irq */
233 pld_icu_data[irq2pldirq(PLD_IRQ_UART1)].icucr
234 = PLD_ICUCR_ISMOD03; /* 'H' level sense */
235 disable_m32700ut_pld_irq(PLD_IRQ_UART1);
236 #endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */
238 #if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE)
239 /* INT#80: AK4524 IREQ on PLD */
240 irq_desc[PLD_IRQ_SNDINT].status = IRQ_DISABLED;
241 irq_desc[PLD_IRQ_SNDINT].handler = &m32700ut_pld_irq_type;
242 irq_desc[PLD_IRQ_SNDINT].action = 0;
243 irq_desc[PLD_IRQ_SNDINT].depth = 1; /* disable nested irq */
244 pld_icu_data[irq2pldirq(PLD_IRQ_SNDINT)].icucr
245 = PLD_ICUCR_ISMOD01; /* 'L' level sense */
246 disable_m32700ut_pld_irq(PLD_IRQ_SNDINT);
247 #endif /* CONFIG_IDC_AK4524 || CONFIG_IDC_AK4524_MODULE */
250 * INT1# is used for UART, MMC, CF Controller in FPGA.
253 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD11;
254 enable_mappi_irq(M32R_IRQ_INT1);