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 icu_data_t icu_data
[M32700UT_NUM_CPU_IRQ
];
23 static void disable_mappi_irq(unsigned int irq
)
25 unsigned long port
, data
;
28 data
= icu_data
[irq
].icucr
|M32R_ICUCR_ILEVEL7
;
32 static void enable_mappi_irq(unsigned int irq
)
34 unsigned long port
, data
;
37 data
= icu_data
[irq
].icucr
|M32R_ICUCR_IEN
|M32R_ICUCR_ILEVEL6
;
41 static void mask_and_ack_mappi(unsigned int irq
)
43 disable_mappi_irq(irq
);
46 static void end_mappi_irq(unsigned int irq
)
48 enable_mappi_irq(irq
);
51 static unsigned int startup_mappi_irq(unsigned int irq
)
53 enable_mappi_irq(irq
);
57 static void shutdown_mappi_irq(unsigned int irq
)
62 outl(M32R_ICUCR_ILEVEL7
, port
);
65 static struct hw_interrupt_type mappi_irq_type
=
67 .typename
= "M32700-IRQ",
68 .startup
= startup_mappi_irq
,
69 .shutdown
= shutdown_mappi_irq
,
70 .enable
= enable_mappi_irq
,
71 .disable
= disable_mappi_irq
,
72 .ack
= mask_and_ack_mappi
,
77 * Interrupt Control Unit of PLD on M32700UT (Level 2)
79 #define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE)
80 #define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \
81 (((x) - 1) * sizeof(unsigned short)))
84 unsigned short icucr
; /* ICU Control Register */
87 static pld_icu_data_t pld_icu_data
[M32700UT_NUM_PLD_IRQ
];
89 static void disable_m32700ut_pld_irq(unsigned int irq
)
91 unsigned long port
, data
;
94 pldirq
= irq2pldirq(irq
);
95 port
= pldirq2port(pldirq
);
96 data
= pld_icu_data
[pldirq
].icucr
|PLD_ICUCR_ILEVEL7
;
100 static void enable_m32700ut_pld_irq(unsigned int irq
)
102 unsigned long port
, data
;
105 pldirq
= irq2pldirq(irq
);
106 port
= pldirq2port(pldirq
);
107 data
= pld_icu_data
[pldirq
].icucr
|PLD_ICUCR_IEN
|PLD_ICUCR_ILEVEL6
;
111 static void mask_and_ack_m32700ut_pld(unsigned int irq
)
113 disable_m32700ut_pld_irq(irq
);
116 static void end_m32700ut_pld_irq(unsigned int irq
)
118 enable_m32700ut_pld_irq(irq
);
119 end_mappi_irq(M32R_IRQ_INT1
);
122 static unsigned int startup_m32700ut_pld_irq(unsigned int irq
)
124 enable_m32700ut_pld_irq(irq
);
128 static void shutdown_m32700ut_pld_irq(unsigned int irq
)
133 pldirq
= irq2pldirq(irq
);
134 port
= pldirq2port(pldirq
);
135 outw(PLD_ICUCR_ILEVEL7
, port
);
138 static struct hw_interrupt_type m32700ut_pld_irq_type
=
140 .typename
= "USRV-PLD-IRQ",
141 .startup
= startup_m32700ut_pld_irq
,
142 .shutdown
= shutdown_m32700ut_pld_irq
,
143 .enable
= enable_m32700ut_pld_irq
,
144 .disable
= disable_m32700ut_pld_irq
,
145 .ack
= mask_and_ack_m32700ut_pld
,
146 .end
= end_m32700ut_pld_irq
149 void __init
init_IRQ(void)
159 /* MFT2 : system timer */
160 irq_desc
[M32R_IRQ_MFT2
].status
= IRQ_DISABLED
;
161 irq_desc
[M32R_IRQ_MFT2
].handler
= &mappi_irq_type
;
162 irq_desc
[M32R_IRQ_MFT2
].action
= 0;
163 irq_desc
[M32R_IRQ_MFT2
].depth
= 1;
164 icu_data
[M32R_IRQ_MFT2
].icucr
= M32R_ICUCR_IEN
;
165 disable_mappi_irq(M32R_IRQ_MFT2
);
167 #if defined(CONFIG_SERIAL_M32R_SIO)
168 /* SIO0_R : uart receive data */
169 irq_desc
[M32R_IRQ_SIO0_R
].status
= IRQ_DISABLED
;
170 irq_desc
[M32R_IRQ_SIO0_R
].handler
= &mappi_irq_type
;
171 irq_desc
[M32R_IRQ_SIO0_R
].action
= 0;
172 irq_desc
[M32R_IRQ_SIO0_R
].depth
= 1;
173 icu_data
[M32R_IRQ_SIO0_R
].icucr
= 0;
174 disable_mappi_irq(M32R_IRQ_SIO0_R
);
176 /* SIO0_S : uart send data */
177 irq_desc
[M32R_IRQ_SIO0_S
].status
= IRQ_DISABLED
;
178 irq_desc
[M32R_IRQ_SIO0_S
].handler
= &mappi_irq_type
;
179 irq_desc
[M32R_IRQ_SIO0_S
].action
= 0;
180 irq_desc
[M32R_IRQ_SIO0_S
].depth
= 1;
181 icu_data
[M32R_IRQ_SIO0_S
].icucr
= 0;
182 disable_mappi_irq(M32R_IRQ_SIO0_S
);
184 /* SIO1_R : uart receive data */
185 irq_desc
[M32R_IRQ_SIO1_R
].status
= IRQ_DISABLED
;
186 irq_desc
[M32R_IRQ_SIO1_R
].handler
= &mappi_irq_type
;
187 irq_desc
[M32R_IRQ_SIO1_R
].action
= 0;
188 irq_desc
[M32R_IRQ_SIO1_R
].depth
= 1;
189 icu_data
[M32R_IRQ_SIO1_R
].icucr
= 0;
190 disable_mappi_irq(M32R_IRQ_SIO1_R
);
192 /* SIO1_S : uart send data */
193 irq_desc
[M32R_IRQ_SIO1_S
].status
= IRQ_DISABLED
;
194 irq_desc
[M32R_IRQ_SIO1_S
].handler
= &mappi_irq_type
;
195 irq_desc
[M32R_IRQ_SIO1_S
].action
= 0;
196 irq_desc
[M32R_IRQ_SIO1_S
].depth
= 1;
197 icu_data
[M32R_IRQ_SIO1_S
].icucr
= 0;
198 disable_mappi_irq(M32R_IRQ_SIO1_S
);
199 #endif /* CONFIG_SERIAL_M32R_SIO */
201 /* INT#67-#71: CFC#0 IREQ on PLD */
202 for (i
= 0 ; i
< CONFIG_CFC_NUM
; i
++ ) {
203 irq_desc
[PLD_IRQ_CF0
+ i
].status
= IRQ_DISABLED
;
204 irq_desc
[PLD_IRQ_CF0
+ i
].handler
= &m32700ut_pld_irq_type
;
205 irq_desc
[PLD_IRQ_CF0
+ i
].action
= 0;
206 irq_desc
[PLD_IRQ_CF0
+ i
].depth
= 1; /* disable nested irq */
207 pld_icu_data
[irq2pldirq(PLD_IRQ_CF0
+ i
)].icucr
208 = PLD_ICUCR_ISMOD01
; /* 'L' level sense */
209 disable_m32700ut_pld_irq(PLD_IRQ_CF0
+ i
);
212 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
213 /* INT#76: 16552D#0 IREQ on PLD */
214 irq_desc
[PLD_IRQ_UART0
].status
= IRQ_DISABLED
;
215 irq_desc
[PLD_IRQ_UART0
].handler
= &m32700ut_pld_irq_type
;
216 irq_desc
[PLD_IRQ_UART0
].action
= 0;
217 irq_desc
[PLD_IRQ_UART0
].depth
= 1; /* disable nested irq */
218 pld_icu_data
[irq2pldirq(PLD_IRQ_UART0
)].icucr
219 = PLD_ICUCR_ISMOD03
; /* 'H' level sense */
220 disable_m32700ut_pld_irq(PLD_IRQ_UART0
);
222 /* INT#77: 16552D#1 IREQ on PLD */
223 irq_desc
[PLD_IRQ_UART1
].status
= IRQ_DISABLED
;
224 irq_desc
[PLD_IRQ_UART1
].handler
= &m32700ut_pld_irq_type
;
225 irq_desc
[PLD_IRQ_UART1
].action
= 0;
226 irq_desc
[PLD_IRQ_UART1
].depth
= 1; /* disable nested irq */
227 pld_icu_data
[irq2pldirq(PLD_IRQ_UART1
)].icucr
228 = PLD_ICUCR_ISMOD03
; /* 'H' level sense */
229 disable_m32700ut_pld_irq(PLD_IRQ_UART1
);
230 #endif /* CONFIG_SERIAL_8250 || CONFIG_SERIAL_8250_MODULE */
232 #if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE)
233 /* INT#80: AK4524 IREQ on PLD */
234 irq_desc
[PLD_IRQ_SNDINT
].status
= IRQ_DISABLED
;
235 irq_desc
[PLD_IRQ_SNDINT
].handler
= &m32700ut_pld_irq_type
;
236 irq_desc
[PLD_IRQ_SNDINT
].action
= 0;
237 irq_desc
[PLD_IRQ_SNDINT
].depth
= 1; /* disable nested irq */
238 pld_icu_data
[irq2pldirq(PLD_IRQ_SNDINT
)].icucr
239 = PLD_ICUCR_ISMOD01
; /* 'L' level sense */
240 disable_m32700ut_pld_irq(PLD_IRQ_SNDINT
);
241 #endif /* CONFIG_IDC_AK4524 || CONFIG_IDC_AK4524_MODULE */
244 * INT1# is used for UART, MMC, CF Controller in FPGA.
247 icu_data
[M32R_IRQ_INT1
].icucr
= M32R_ICUCR_ISMOD11
;
248 enable_mappi_irq(M32R_IRQ_INT1
);