blob: 648102e9236f09d34b3fb8d657a293a46797a207 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_IRQ_H
2#define __ASM_SH_IRQ_H
3
4/*
5 *
6 * linux/include/asm-sh/irq.h
7 *
8 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
9 * Copyright (C) 2000 Kazumoto Kojima
10 * Copyright (C) 2003 Paul Mundt
11 *
12 */
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <asm/machvec.h>
15#include <asm/ptrace.h> /* for pt_regs */
16
Paul Mundtbf3a00f2006-01-16 22:14:14 -080017#if defined(CONFIG_SH_HP6XX) || \
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 defined(CONFIG_SH_RTS7751R2D) || \
19 defined(CONFIG_SH_HS7751RVOIP) || \
Paul Mundtbf3a00f2006-01-16 22:14:14 -080020 defined(CONFIG_SH_HS7751RVOIP) || \
21 defined(CONFIG_SH_SH03) || \
22 defined(CONFIG_SH_R7780RP) || \
23 defined(CONFIG_SH_LANDISK)
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <asm/mach/ide.h>
25#endif
26
Paul Mundtbf3a00f2006-01-16 22:14:14 -080027#ifndef CONFIG_CPU_SUBTYPE_SH7780
28
29#define INTC_DMAC0_MSK 0
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#if defined(CONFIG_CPU_SH3)
32#define INTC_IPRA 0xfffffee2UL
33#define INTC_IPRB 0xfffffee4UL
34#elif defined(CONFIG_CPU_SH4)
35#define INTC_IPRA 0xffd00004UL
36#define INTC_IPRB 0xffd00008UL
37#define INTC_IPRC 0xffd0000cUL
38#define INTC_IPRD 0xffd00010UL
39#endif
40
41#ifdef CONFIG_IDE
42# ifndef IRQ_CFCARD
43# define IRQ_CFCARD 14
44# endif
45# ifndef IRQ_PCMCIA
46# define IRQ_PCMCIA 15
47# endif
48#endif
49
50#define TIMER_IRQ 16
51#define TIMER_IPR_ADDR INTC_IPRA
52#define TIMER_IPR_POS 3
53#define TIMER_PRIORITY 2
54
55#define TIMER1_IRQ 17
56#define TIMER1_IPR_ADDR INTC_IPRA
57#define TIMER1_IPR_POS 2
58#define TIMER1_PRIORITY 4
59
60#define RTC_IRQ 22
61#define RTC_IPR_ADDR INTC_IPRA
62#define RTC_IPR_POS 0
63#define RTC_PRIORITY TIMER_PRIORITY
64
65#if defined(CONFIG_CPU_SH3)
66#define DMTE0_IRQ 48
67#define DMTE1_IRQ 49
68#define DMTE2_IRQ 50
69#define DMTE3_IRQ 51
70#define DMA_IPR_ADDR INTC_IPRE
71#define DMA_IPR_POS 3
72#define DMA_PRIORITY 7
73#if defined(CONFIG_CPU_SUBTYPE_SH7300)
74/* TMU2 */
75#define TIMER2_IRQ 18
76#define TIMER2_IPR_ADDR INTC_IPRA
77#define TIMER2_IPR_POS 1
78#define TIMER2_PRIORITY 2
79
80/* WDT */
81#define WDT_IRQ 27
82#define WDT_IPR_ADDR INTC_IPRB
83#define WDT_IPR_POS 3
84#define WDT_PRIORITY 2
85
86/* SIM (SIM Card Module) */
87#define SIM_ERI_IRQ 23
88#define SIM_RXI_IRQ 24
89#define SIM_TXI_IRQ 25
90#define SIM_TEND_IRQ 26
91#define SIM_IPR_ADDR INTC_IPRB
92#define SIM_IPR_POS 1
93#define SIM_PRIORITY 2
94
95/* VIO (Video I/O) */
96#define VIO_IRQ 52
97#define VIO_IPR_ADDR INTC_IPRE
98#define VIO_IPR_POS 2
99#define VIO_PRIORITY 2
100
101/* MFI (Multi Functional Interface) */
102#define MFI_IRQ 56
103#define MFI_IPR_ADDR INTC_IPRE
104#define MFI_IPR_POS 1
105#define MFI_PRIORITY 2
106
107/* VPU (Video Processing Unit) */
108#define VPU_IRQ 60
109#define VPU_IPR_ADDR INTC_IPRE
110#define VPU_IPR_POS 0
111#define VPU_PRIORITY 2
112
113/* KEY (Key Scan Interface) */
114#define KEY_IRQ 79
115#define KEY_IPR_ADDR INTC_IPRF
116#define KEY_IPR_POS 3
117#define KEY_PRIORITY 2
118
119/* CMT (Compare Match Timer) */
120#define CMT_IRQ 104
121#define CMT_IPR_ADDR INTC_IPRF
122#define CMT_IPR_POS 0
123#define CMT_PRIORITY 2
124
125/* DMAC(1) */
126#define DMTE0_IRQ 48
127#define DMTE1_IRQ 49
128#define DMTE2_IRQ 50
129#define DMTE3_IRQ 51
130#define DMA1_IPR_ADDR INTC_IPRE
131#define DMA1_IPR_POS 3
132#define DMA1_PRIORITY 7
133
134/* DMAC(2) */
135#define DMTE4_IRQ 76
136#define DMTE5_IRQ 77
137#define DMA2_IPR_ADDR INTC_IPRF
138#define DMA2_IPR_POS 2
139#define DMA2_PRIORITY 7
140
141/* SIOF0 */
142#define SIOF0_IRQ 84
143#define SIOF0_IPR_ADDR INTC_IPRH
144#define SIOF0_IPR_POS 3
145#define SIOF0_PRIORITY 3
146
147/* FLCTL (Flash Memory Controller) */
148#define FLSTE_IRQ 92
149#define FLTEND_IRQ 93
150#define FLTRQ0_IRQ 94
151#define FLTRQ1_IRQ 95
152#define FLCTL_IPR_ADDR INTC_IPRH
153#define FLCTL_IPR_POS 1
154#define FLCTL_PRIORITY 3
155
156/* IIC (IIC Bus Interface) */
157#define IIC_ALI_IRQ 96
158#define IIC_TACKI_IRQ 97
159#define IIC_WAITI_IRQ 98
160#define IIC_DTEI_IRQ 99
161#define IIC_IPR_ADDR INTC_IPRH
162#define IIC_IPR_POS 0
163#define IIC_PRIORITY 3
164
165/* SIO0 */
166#define SIO0_IRQ 88
167#define SIO0_IPR_ADDR INTC_IPRI
168#define SIO0_IPR_POS 3
169#define SIO0_PRIORITY 3
170
171/* SIU (Sound Interface Unit) */
172#define SIU_IRQ 108
173#define SIU_IPR_ADDR INTC_IPRJ
174#define SIU_IPR_POS 1
175#define SIU_PRIORITY 3
176
177#endif
178#elif defined(CONFIG_CPU_SH4)
179#define DMTE0_IRQ 34
180#define DMTE1_IRQ 35
181#define DMTE2_IRQ 36
182#define DMTE3_IRQ 37
183#define DMTE4_IRQ 44 /* 7751R only */
184#define DMTE5_IRQ 45 /* 7751R only */
185#define DMTE6_IRQ 46 /* 7751R only */
186#define DMTE7_IRQ 47 /* 7751R only */
187#define DMAE_IRQ 38
188#define DMA_IPR_ADDR INTC_IPRC
189#define DMA_IPR_POS 2
190#define DMA_PRIORITY 7
191#endif
192
193#if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \
194 defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \
195 defined (CONFIG_CPU_SUBTYPE_SH7751)
196#define SCI_ERI_IRQ 23
197#define SCI_RXI_IRQ 24
198#define SCI_TXI_IRQ 25
199#define SCI_IPR_ADDR INTC_IPRB
200#define SCI_IPR_POS 1
201#define SCI_PRIORITY 3
202#endif
203
204#if defined(CONFIG_CPU_SUBTYPE_SH7300)
205#define SCIF0_IRQ 80
206#define SCIF0_IPR_ADDR INTC_IPRG
207#define SCIF0_IPR_POS 3
208#define SCIF0_PRIORITY 3
209#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
210 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
211 defined(CONFIG_CPU_SUBTYPE_SH7709)
212#define SCIF_ERI_IRQ 56
213#define SCIF_RXI_IRQ 57
214#define SCIF_BRI_IRQ 58
215#define SCIF_TXI_IRQ 59
216#define SCIF_IPR_ADDR INTC_IPRE
217#define SCIF_IPR_POS 1
218#define SCIF_PRIORITY 3
219
220#define IRDA_ERI_IRQ 52
221#define IRDA_RXI_IRQ 53
222#define IRDA_BRI_IRQ 54
223#define IRDA_TXI_IRQ 55
224#define IRDA_IPR_ADDR INTC_IPRE
225#define IRDA_IPR_POS 2
226#define IRDA_PRIORITY 3
227#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
228 defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
229#define SCIF_ERI_IRQ 40
230#define SCIF_RXI_IRQ 41
231#define SCIF_BRI_IRQ 42
232#define SCIF_TXI_IRQ 43
233#define SCIF_IPR_ADDR INTC_IPRC
234#define SCIF_IPR_POS 1
235#define SCIF_PRIORITY 3
236#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
237#define SCIF1_ERI_IRQ 23
238#define SCIF1_RXI_IRQ 24
239#define SCIF1_BRI_IRQ 25
240#define SCIF1_TXI_IRQ 26
241#define SCIF1_IPR_ADDR INTC_IPRB
242#define SCIF1_IPR_POS 1
243#define SCIF1_PRIORITY 3
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800244#endif /* ST40STB1 */
245
246#endif /* 775x / SH4-202 / ST40STB1 */
Paul Mundt8d27e082006-02-01 03:06:04 -0800247#endif /* 7780 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248
249/* NR_IRQS is made from three components:
250 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules
251 * 2. PINT_NR_IRQS - number of PINT interrupts
252 * 3. OFFCHIP_NR_IRQS - numbe of IRQs from off-chip peripherial modules
253 */
254
255/* 1. ONCHIP_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800256#if defined(CONFIG_CPU_SUBTYPE_SH7604)
257# define ONCHIP_NR_IRQS 24 // Actually 21
258#elif defined(CONFIG_CPU_SUBTYPE_SH7707)
259# define ONCHIP_NR_IRQS 64
260# define PINT_NR_IRQS 16
261#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
262# define ONCHIP_NR_IRQS 32
263#elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
264 defined(CONFIG_CPU_SUBTYPE_SH7705)
265# define ONCHIP_NR_IRQS 64 // Actually 61
266# define PINT_NR_IRQS 16
267#elif defined(CONFIG_CPU_SUBTYPE_SH7750)
268# define ONCHIP_NR_IRQS 48 // Actually 44
269#elif defined(CONFIG_CPU_SUBTYPE_SH7751)
270# define ONCHIP_NR_IRQS 72
271#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
272# define ONCHIP_NR_IRQS 112 /* XXX */
273#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
274# define ONCHIP_NR_IRQS 72
275#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276# define ONCHIP_NR_IRQS 144
Paul Mundt8d27e082006-02-01 03:06:04 -0800277#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
278 defined(CONFIG_CPU_SUBTYPE_SH73180)
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800279# define ONCHIP_NR_IRQS 109
Paul Mundt8d27e082006-02-01 03:06:04 -0800280#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
281# define ONCHIP_NR_IRQS 111
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800282#elif defined(CONFIG_SH_UNKNOWN) /* Most be last */
283# define ONCHIP_NR_IRQS 144
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284#endif
285
286/* 2. PINT_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800287#ifdef CONFIG_SH_UNKNOWN
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288# define PINT_NR_IRQS 16
289#else
290# ifndef PINT_NR_IRQS
291# define PINT_NR_IRQS 0
292# endif
293#endif
294
295#if PINT_NR_IRQS > 0
296# define PINT_IRQ_BASE ONCHIP_NR_IRQS
297#endif
298
299/* 3. OFFCHIP_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800300#if defined(CONFIG_HD64461)
301# define OFFCHIP_NR_IRQS 18
302#elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
303# define OFFCHIP_NR_IRQS 48
304#elif defined(CONFIG_HD64465)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305# define OFFCHIP_NR_IRQS 16
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800306#elif defined (CONFIG_SH_EC3104)
307# define OFFCHIP_NR_IRQS 16
308#elif defined (CONFIG_SH_DREAMCAST)
309# define OFFCHIP_NR_IRQS 96
310#elif defined (CONFIG_SH_TITAN)
311# define OFFCHIP_NR_IRQS 4
Paul Mundt8d27e082006-02-01 03:06:04 -0800312#elif defined(CONFIG_SH_R7780RP)
313# define OFFCHIP_NR_IRQS 16
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800314#elif defined(CONFIG_SH_UNKNOWN)
315# define OFFCHIP_NR_IRQS 16 /* Must also be last */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316#else
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800317# define OFFCHIP_NR_IRQS 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318#endif
319
320#if OFFCHIP_NR_IRQS > 0
321# define OFFCHIP_IRQ_BASE (ONCHIP_NR_IRQS + PINT_NR_IRQS)
322#endif
323
324/* NR_IRQS. 1+2+3 */
325#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS)
326
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327extern void disable_irq(unsigned int);
328extern void disable_irq_nosync(unsigned int);
329extern void enable_irq(unsigned int);
330
331/*
332 * Simple Mask Register Support
333 */
334extern void make_maskreg_irq(unsigned int irq);
335extern unsigned short *irq_mask_register;
336
337/*
Paul Mundt0f08f332006-09-27 17:03:56 +0900338 * PINT IRQs
339 */
340void init_IRQ_pint(void);
341
342/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 * Function for "on chip support modules".
344 */
345extern void make_ipr_irq(unsigned int irq, unsigned int addr,
346 int pos, int priority);
347extern void make_imask_irq(unsigned int irq);
348
349#if defined(CONFIG_CPU_SUBTYPE_SH7300)
350#undef INTC_IPRA
351#undef INTC_IPRB
352#define INTC_IPRA 0xA414FEE2UL
353#define INTC_IPRB 0xA414FEE4UL
354#define INTC_IPRC 0xA4140016UL
355#define INTC_IPRD 0xA4140018UL
356#define INTC_IPRE 0xA414001AUL
357#define INTC_IPRF 0xA4080000UL
358#define INTC_IPRG 0xA4080002UL
359#define INTC_IPRH 0xA4080004UL
360#define INTC_IPRI 0xA4080006UL
361#define INTC_IPRJ 0xA4080008UL
362
363#define INTC_IMR0 0xA4080040UL
364#define INTC_IMR1 0xA4080042UL
365#define INTC_IMR2 0xA4080044UL
366#define INTC_IMR3 0xA4080046UL
367#define INTC_IMR4 0xA4080048UL
368#define INTC_IMR5 0xA408004AUL
369#define INTC_IMR6 0xA408004CUL
370#define INTC_IMR7 0xA408004EUL
371#define INTC_IMR8 0xA4080050UL
372#define INTC_IMR9 0xA4080052UL
373#define INTC_IMR10 0xA4080054UL
374
375#define INTC_IMCR0 0xA4080060UL
376#define INTC_IMCR1 0xA4080062UL
377#define INTC_IMCR2 0xA4080064UL
378#define INTC_IMCR3 0xA4080066UL
379#define INTC_IMCR4 0xA4080068UL
380#define INTC_IMCR5 0xA408006AUL
381#define INTC_IMCR6 0xA408006CUL
382#define INTC_IMCR7 0xA408006EUL
383#define INTC_IMCR8 0xA4080070UL
384#define INTC_IMCR9 0xA4080072UL
385#define INTC_IMCR10 0xA4080074UL
386
387#define INTC_ICR0 0xA414FEE0UL
388#define INTC_ICR1 0xA4140010UL
389
390#define INTC_IRR0 0xA4140004UL
391
392#define PORT_PACR 0xA4050100UL
393#define PORT_PBCR 0xA4050102UL
394#define PORT_PCCR 0xA4050104UL
395#define PORT_PDCR 0xA4050106UL
396#define PORT_PECR 0xA4050108UL
397#define PORT_PFCR 0xA405010AUL
398#define PORT_PGCR 0xA405010CUL
399#define PORT_PHCR 0xA405010EUL
400#define PORT_PJCR 0xA4050110UL
401#define PORT_PKCR 0xA4050112UL
402#define PORT_PLCR 0xA4050114UL
403#define PORT_SCPCR 0xA4050116UL
404#define PORT_PMCR 0xA4050118UL
405#define PORT_PNCR 0xA405011AUL
406#define PORT_PQCR 0xA405011CUL
407
408#define PORT_PSELA 0xA4050140UL
409#define PORT_PSELB 0xA4050142UL
410#define PORT_PSELC 0xA4050144UL
411
412#define PORT_HIZCRA 0xA4050146UL
413#define PORT_HIZCRB 0xA4050148UL
414#define PORT_DRVCR 0xA4050150UL
415
416#define PORT_PADR 0xA4050120UL
417#define PORT_PBDR 0xA4050122UL
418#define PORT_PCDR 0xA4050124UL
419#define PORT_PDDR 0xA4050126UL
420#define PORT_PEDR 0xA4050128UL
421#define PORT_PFDR 0xA405012AUL
422#define PORT_PGDR 0xA405012CUL
423#define PORT_PHDR 0xA405012EUL
424#define PORT_PJDR 0xA4050130UL
425#define PORT_PKDR 0xA4050132UL
426#define PORT_PLDR 0xA4050134UL
427#define PORT_SCPDR 0xA4050136UL
428#define PORT_PMDR 0xA4050138UL
429#define PORT_PNDR 0xA405013AUL
430#define PORT_PQDR 0xA405013CUL
431
432#define IRQ0_IRQ 32
433#define IRQ1_IRQ 33
434#define IRQ2_IRQ 34
435#define IRQ3_IRQ 35
436#define IRQ4_IRQ 36
437#define IRQ5_IRQ 37
438
439#define IRQ0_IPR_ADDR INTC_IPRC
440#define IRQ1_IPR_ADDR INTC_IPRC
441#define IRQ2_IPR_ADDR INTC_IPRC
442#define IRQ3_IPR_ADDR INTC_IPRC
443#define IRQ4_IPR_ADDR INTC_IPRD
444#define IRQ5_IPR_ADDR INTC_IPRD
445
446#define IRQ0_IPR_POS 0
447#define IRQ1_IPR_POS 1
448#define IRQ2_IPR_POS 2
449#define IRQ3_IPR_POS 3
450#define IRQ4_IPR_POS 0
451#define IRQ5_IPR_POS 1
452
453#define IRQ0_PRIORITY 1
454#define IRQ1_PRIORITY 1
455#define IRQ2_PRIORITY 1
456#define IRQ3_PRIORITY 1
457#define IRQ4_PRIORITY 1
458#define IRQ5_PRIORITY 1
459
460extern int ipr_irq_demux(int irq);
461#define __irq_demux(irq) ipr_irq_demux(irq)
462
463#elif defined(CONFIG_CPU_SUBTYPE_SH7604)
464#define INTC_IPRA 0xfffffee2UL
465#define INTC_IPRB 0xfffffe60UL
466
467#define INTC_VCRA 0xfffffe62UL
468#define INTC_VCRB 0xfffffe64UL
469#define INTC_VCRC 0xfffffe66UL
470#define INTC_VCRD 0xfffffe68UL
471
472#define INTC_VCRWDT 0xfffffee4UL
473#define INTC_VCRDIV 0xffffff0cUL
474#define INTC_VCRDMA0 0xffffffa0UL
475#define INTC_VCRDMA1 0xffffffa8UL
476
477#define INTC_ICR 0xfffffee0UL
478#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
479 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
480 defined(CONFIG_CPU_SUBTYPE_SH7709)
481#define INTC_IRR0 0xa4000004UL
482#define INTC_IRR1 0xa4000006UL
483#define INTC_IRR2 0xa4000008UL
484
485#define INTC_ICR0 0xfffffee0UL
486#define INTC_ICR1 0xa4000010UL
487#define INTC_ICR2 0xa4000012UL
488#define INTC_INTER 0xa4000014UL
489
490#define INTC_IPRC 0xa4000016UL
491#define INTC_IPRD 0xa4000018UL
492#define INTC_IPRE 0xa400001aUL
493#if defined(CONFIG_CPU_SUBTYPE_SH7707)
494#define INTC_IPRF 0xa400001cUL
495#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
496#define INTC_IPRF 0xa4080000UL
497#define INTC_IPRG 0xa4080002UL
498#define INTC_IPRH 0xa4080004UL
499#endif
500
501#define PORT_PACR 0xa4000100UL
502#define PORT_PBCR 0xa4000102UL
503#define PORT_PCCR 0xa4000104UL
504#define PORT_PFCR 0xa400010aUL
505#define PORT_PADR 0xa4000120UL
506#define PORT_PBDR 0xa4000122UL
507#define PORT_PCDR 0xa4000124UL
508#define PORT_PFDR 0xa400012aUL
509
510#define IRQ0_IRQ 32
511#define IRQ1_IRQ 33
512#define IRQ2_IRQ 34
513#define IRQ3_IRQ 35
514#define IRQ4_IRQ 36
515#define IRQ5_IRQ 37
516
517#define IRQ0_IPR_ADDR INTC_IPRC
518#define IRQ1_IPR_ADDR INTC_IPRC
519#define IRQ2_IPR_ADDR INTC_IPRC
520#define IRQ3_IPR_ADDR INTC_IPRC
521#define IRQ4_IPR_ADDR INTC_IPRD
522#define IRQ5_IPR_ADDR INTC_IPRD
523
524#define IRQ0_IPR_POS 0
525#define IRQ1_IPR_POS 1
526#define IRQ2_IPR_POS 2
527#define IRQ3_IPR_POS 3
528#define IRQ4_IPR_POS 0
529#define IRQ5_IPR_POS 1
530
531#define IRQ0_PRIORITY 1
532#define IRQ1_PRIORITY 1
533#define IRQ2_PRIORITY 1
534#define IRQ3_PRIORITY 1
535#define IRQ4_PRIORITY 1
536#define IRQ5_PRIORITY 1
537
538#define PINT0_IRQ 40
539#define PINT8_IRQ 41
540
541#define PINT0_IPR_ADDR INTC_IPRD
542#define PINT8_IPR_ADDR INTC_IPRD
543
544#define PINT0_IPR_POS 3
545#define PINT8_IPR_POS 2
546#define PINT0_PRIORITY 2
547#define PINT8_PRIORITY 2
548
549extern int ipr_irq_demux(int irq);
550#define __irq_demux(irq) ipr_irq_demux(irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551#endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */
552
553#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
554 defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
555#define INTC_ICR 0xffd00000
556#define INTC_ICR_NMIL (1<<15)
557#define INTC_ICR_MAI (1<<14)
558#define INTC_ICR_NMIB (1<<9)
559#define INTC_ICR_NMIE (1<<8)
560#define INTC_ICR_IRLM (1<<7)
561#endif
562
Paul Mundt8d27e082006-02-01 03:06:04 -0800563#ifdef CONFIG_CPU_SUBTYPE_SH7780
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800564#include <asm/irq-sh7780.h>
565#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800567/* SH with INTC2-style interrupts */
568#ifdef CONFIG_CPU_HAS_INTC2_IRQ
569#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570#define INTC2_BASE 0xfe080000
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800571#define INTC2_FIRST_IRQ 64
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572#define INTC2_INTREQ_OFFSET 0x20
573#define INTC2_INTMSK_OFFSET 0x40
574#define INTC2_INTMSKCLR_OFFSET 0x60
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800575#define NR_INTC2_IRQS 25
576#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
577#define INTC2_BASE 0xfe080000
578#define INTC2_FIRST_IRQ 48 /* INTEVT 0x800 */
579#define INTC2_INTREQ_OFFSET 0x20
580#define INTC2_INTMSK_OFFSET 0x40
581#define INTC2_INTMSKCLR_OFFSET 0x60
582#define NR_INTC2_IRQS 64
583#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
584#define INTC2_BASE 0xffd40000
Paul Mundt5283ecb2006-09-27 15:59:17 +0900585#define INTC2_FIRST_IRQ 21
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800586#define INTC2_INTMSK_OFFSET (0x38)
587#define INTC2_INTMSKCLR_OFFSET (0x3c)
588#define NR_INTC2_IRQS 60
589#endif
590
591#define INTC2_INTPRI_OFFSET 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592
593void make_intc2_irq(unsigned int irq,
594 unsigned int ipr_offset, unsigned int ipr_shift,
595 unsigned int msk_offset, unsigned int msk_shift,
596 unsigned int priority);
597void init_IRQ_intc2(void);
598void intc2_add_clear_irq(int irq, int (*fn)(int));
599
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800600#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601
602static inline int generic_irq_demux(int irq)
603{
604 return irq;
605}
606
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800607#ifndef __irq_demux
608#define __irq_demux(irq) (irq)
609#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610#define irq_canonicalize(irq) (irq)
611#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq))
612
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613#if defined(CONFIG_CPU_SUBTYPE_SH73180)
614#include <asm/irq-sh73180.h>
615#endif
616
617#endif /* __ASM_SH_IRQ_H */