blob: d71326b3c90c6e5908dbedfdaa9d033f26e1720b [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
Yoshinori Satob2296322006-11-05 16:18:08 +090017#if defined(CONFIG_CPU_SH2)
18#include <asm/cpu/irq.h>
19#endif
20
Paul Mundtbf3a00f2006-01-16 22:14:14 -080021#ifndef CONFIG_CPU_SUBTYPE_SH7780
22
23#define INTC_DMAC0_MSK 0
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#if defined(CONFIG_CPU_SH3)
26#define INTC_IPRA 0xfffffee2UL
27#define INTC_IPRB 0xfffffee4UL
28#elif defined(CONFIG_CPU_SH4)
29#define INTC_IPRA 0xffd00004UL
30#define INTC_IPRB 0xffd00008UL
31#define INTC_IPRC 0xffd0000cUL
32#define INTC_IPRD 0xffd00010UL
33#endif
34
Yoshinori Satob2296322006-11-05 16:18:08 +090035#if defined(CONFIG_CPU_SUBTYPE_SH7206)
36#ifdef CONFIG_SH_CMT
37#define TIMER_IRQ CMI0_IRQ
38#define TIMER_IPR_ADDR INTC_IPR08
39#define TIMER_IPR_POS 3
40#define TIMER_PRIORITY 2
41
42#define TIMER1_IRQ CMI1_IRQ
43#define TIMER1_IPR_ADDR INTC_IPR08
44#define TIMER1_IPR_POS 2
45#define TIMER1_PRIORITY 2
46#endif
47
48#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
49#define TIMER_IRQ CMI0_IRQ
50#define TIMER_IPR_ADDR INTC_IPRC
51#define TIMER_IPR_POS 1
52#define TIMER_PRIORITY 2
53
54#define TIMER1_IRQ CMI1_IRQ
55#define TIMER1_IPR_ADDR INTC_IPRC
56#define TIMER1_IPR_POS 0
57#define TIMER1_PRIORITY 4
58
59#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070060#define TIMER_IRQ 16
61#define TIMER_IPR_ADDR INTC_IPRA
62#define TIMER_IPR_POS 3
63#define TIMER_PRIORITY 2
64
65#define TIMER1_IRQ 17
66#define TIMER1_IPR_ADDR INTC_IPRA
67#define TIMER1_IPR_POS 2
68#define TIMER1_PRIORITY 4
Yoshinori Satob2296322006-11-05 16:18:08 +090069#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Yoshinori Satob2296322006-11-05 16:18:08 +090071#if !defined(CONFIG_CPU_SH2)
Linus Torvalds1da177e2005-04-16 15:20:36 -070072#define RTC_IRQ 22
73#define RTC_IPR_ADDR INTC_IPRA
74#define RTC_IPR_POS 0
75#define RTC_PRIORITY TIMER_PRIORITY
Yoshinori Satob2296322006-11-05 16:18:08 +090076#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
78#if defined(CONFIG_CPU_SH3)
79#define DMTE0_IRQ 48
80#define DMTE1_IRQ 49
81#define DMTE2_IRQ 50
82#define DMTE3_IRQ 51
83#define DMA_IPR_ADDR INTC_IPRE
84#define DMA_IPR_POS 3
85#define DMA_PRIORITY 7
86#if defined(CONFIG_CPU_SUBTYPE_SH7300)
87/* TMU2 */
88#define TIMER2_IRQ 18
89#define TIMER2_IPR_ADDR INTC_IPRA
90#define TIMER2_IPR_POS 1
91#define TIMER2_PRIORITY 2
92
93/* WDT */
94#define WDT_IRQ 27
95#define WDT_IPR_ADDR INTC_IPRB
96#define WDT_IPR_POS 3
97#define WDT_PRIORITY 2
98
99/* SIM (SIM Card Module) */
100#define SIM_ERI_IRQ 23
101#define SIM_RXI_IRQ 24
102#define SIM_TXI_IRQ 25
103#define SIM_TEND_IRQ 26
104#define SIM_IPR_ADDR INTC_IPRB
105#define SIM_IPR_POS 1
106#define SIM_PRIORITY 2
107
108/* VIO (Video I/O) */
109#define VIO_IRQ 52
110#define VIO_IPR_ADDR INTC_IPRE
111#define VIO_IPR_POS 2
112#define VIO_PRIORITY 2
113
114/* MFI (Multi Functional Interface) */
115#define MFI_IRQ 56
116#define MFI_IPR_ADDR INTC_IPRE
117#define MFI_IPR_POS 1
118#define MFI_PRIORITY 2
119
120/* VPU (Video Processing Unit) */
121#define VPU_IRQ 60
122#define VPU_IPR_ADDR INTC_IPRE
123#define VPU_IPR_POS 0
124#define VPU_PRIORITY 2
125
126/* KEY (Key Scan Interface) */
127#define KEY_IRQ 79
128#define KEY_IPR_ADDR INTC_IPRF
129#define KEY_IPR_POS 3
130#define KEY_PRIORITY 2
131
132/* CMT (Compare Match Timer) */
133#define CMT_IRQ 104
134#define CMT_IPR_ADDR INTC_IPRF
135#define CMT_IPR_POS 0
136#define CMT_PRIORITY 2
137
138/* DMAC(1) */
139#define DMTE0_IRQ 48
140#define DMTE1_IRQ 49
141#define DMTE2_IRQ 50
142#define DMTE3_IRQ 51
143#define DMA1_IPR_ADDR INTC_IPRE
144#define DMA1_IPR_POS 3
145#define DMA1_PRIORITY 7
146
147/* DMAC(2) */
148#define DMTE4_IRQ 76
149#define DMTE5_IRQ 77
150#define DMA2_IPR_ADDR INTC_IPRF
151#define DMA2_IPR_POS 2
152#define DMA2_PRIORITY 7
153
154/* SIOF0 */
155#define SIOF0_IRQ 84
156#define SIOF0_IPR_ADDR INTC_IPRH
157#define SIOF0_IPR_POS 3
158#define SIOF0_PRIORITY 3
159
160/* FLCTL (Flash Memory Controller) */
161#define FLSTE_IRQ 92
162#define FLTEND_IRQ 93
163#define FLTRQ0_IRQ 94
164#define FLTRQ1_IRQ 95
165#define FLCTL_IPR_ADDR INTC_IPRH
166#define FLCTL_IPR_POS 1
167#define FLCTL_PRIORITY 3
168
169/* IIC (IIC Bus Interface) */
170#define IIC_ALI_IRQ 96
171#define IIC_TACKI_IRQ 97
172#define IIC_WAITI_IRQ 98
173#define IIC_DTEI_IRQ 99
174#define IIC_IPR_ADDR INTC_IPRH
175#define IIC_IPR_POS 0
176#define IIC_PRIORITY 3
177
178/* SIO0 */
179#define SIO0_IRQ 88
180#define SIO0_IPR_ADDR INTC_IPRI
181#define SIO0_IPR_POS 3
182#define SIO0_PRIORITY 3
183
184/* SIU (Sound Interface Unit) */
185#define SIU_IRQ 108
186#define SIU_IPR_ADDR INTC_IPRJ
187#define SIU_IPR_POS 1
188#define SIU_PRIORITY 3
189
190#endif
191#elif defined(CONFIG_CPU_SH4)
192#define DMTE0_IRQ 34
193#define DMTE1_IRQ 35
194#define DMTE2_IRQ 36
195#define DMTE3_IRQ 37
196#define DMTE4_IRQ 44 /* 7751R only */
197#define DMTE5_IRQ 45 /* 7751R only */
198#define DMTE6_IRQ 46 /* 7751R only */
199#define DMTE7_IRQ 47 /* 7751R only */
200#define DMAE_IRQ 38
201#define DMA_IPR_ADDR INTC_IPRC
202#define DMA_IPR_POS 2
203#define DMA_PRIORITY 7
204#endif
205
206#if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \
207 defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \
Paul Mundte5723e02006-09-27 17:38:11 +0900208 defined (CONFIG_CPU_SUBTYPE_SH7751) || defined (CONFIG_CPU_SUBTYPE_SH7706)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209#define SCI_ERI_IRQ 23
210#define SCI_RXI_IRQ 24
211#define SCI_TXI_IRQ 25
212#define SCI_IPR_ADDR INTC_IPRB
213#define SCI_IPR_POS 1
214#define SCI_PRIORITY 3
215#endif
216
217#if defined(CONFIG_CPU_SUBTYPE_SH7300)
218#define SCIF0_IRQ 80
219#define SCIF0_IPR_ADDR INTC_IPRG
220#define SCIF0_IPR_POS 3
221#define SCIF0_PRIORITY 3
222#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
Paul Mundte5723e02006-09-27 17:38:11 +0900223 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
225 defined(CONFIG_CPU_SUBTYPE_SH7709)
226#define SCIF_ERI_IRQ 56
227#define SCIF_RXI_IRQ 57
228#define SCIF_BRI_IRQ 58
229#define SCIF_TXI_IRQ 59
230#define SCIF_IPR_ADDR INTC_IPRE
231#define SCIF_IPR_POS 1
232#define SCIF_PRIORITY 3
233
234#define IRDA_ERI_IRQ 52
235#define IRDA_RXI_IRQ 53
236#define IRDA_BRI_IRQ 54
237#define IRDA_TXI_IRQ 55
238#define IRDA_IPR_ADDR INTC_IPRE
239#define IRDA_IPR_POS 2
240#define IRDA_PRIORITY 3
241#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
242 defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
243#define SCIF_ERI_IRQ 40
244#define SCIF_RXI_IRQ 41
245#define SCIF_BRI_IRQ 42
246#define SCIF_TXI_IRQ 43
247#define SCIF_IPR_ADDR INTC_IPRC
248#define SCIF_IPR_POS 1
249#define SCIF_PRIORITY 3
250#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
251#define SCIF1_ERI_IRQ 23
252#define SCIF1_RXI_IRQ 24
253#define SCIF1_BRI_IRQ 25
254#define SCIF1_TXI_IRQ 26
255#define SCIF1_IPR_ADDR INTC_IPRB
256#define SCIF1_IPR_POS 1
257#define SCIF1_PRIORITY 3
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800258#endif /* ST40STB1 */
259
260#endif /* 775x / SH4-202 / ST40STB1 */
Paul Mundt8d27e082006-02-01 03:06:04 -0800261#endif /* 7780 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
263/* NR_IRQS is made from three components:
264 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules
265 * 2. PINT_NR_IRQS - number of PINT interrupts
266 * 3. OFFCHIP_NR_IRQS - numbe of IRQs from off-chip peripherial modules
267 */
268
269/* 1. ONCHIP_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800270#if defined(CONFIG_CPU_SUBTYPE_SH7604)
271# define ONCHIP_NR_IRQS 24 // Actually 21
272#elif defined(CONFIG_CPU_SUBTYPE_SH7707)
273# define ONCHIP_NR_IRQS 64
274# define PINT_NR_IRQS 16
275#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
276# define ONCHIP_NR_IRQS 32
277#elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
Paul Mundte5723e02006-09-27 17:38:11 +0900278 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800279 defined(CONFIG_CPU_SUBTYPE_SH7705)
280# define ONCHIP_NR_IRQS 64 // Actually 61
281# define PINT_NR_IRQS 16
Paul Mundte5723e02006-09-27 17:38:11 +0900282#elif defined(CONFIG_CPU_SUBTYPE_SH7710)
283# define ONCHIP_NR_IRQS 104
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800284#elif defined(CONFIG_CPU_SUBTYPE_SH7750)
285# define ONCHIP_NR_IRQS 48 // Actually 44
286#elif defined(CONFIG_CPU_SUBTYPE_SH7751)
287# define ONCHIP_NR_IRQS 72
288#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
289# define ONCHIP_NR_IRQS 112 /* XXX */
290#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
291# define ONCHIP_NR_IRQS 72
292#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293# define ONCHIP_NR_IRQS 144
Paul Mundt8d27e082006-02-01 03:06:04 -0800294#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
Paul Mundte5723e02006-09-27 17:38:11 +0900295 defined(CONFIG_CPU_SUBTYPE_SH73180) || \
296 defined(CONFIG_CPU_SUBTYPE_SH7343)
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800297# define ONCHIP_NR_IRQS 109
Paul Mundt8d27e082006-02-01 03:06:04 -0800298#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
299# define ONCHIP_NR_IRQS 111
Yoshinori Satob2296322006-11-05 16:18:08 +0900300#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
301# define ONCHIP_NR_IRQS 256
302#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
303# define ONCHIP_NR_IRQS 128
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800304#elif defined(CONFIG_SH_UNKNOWN) /* Most be last */
305# define ONCHIP_NR_IRQS 144
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306#endif
307
308/* 2. PINT_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800309#ifdef CONFIG_SH_UNKNOWN
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310# define PINT_NR_IRQS 16
311#else
312# ifndef PINT_NR_IRQS
313# define PINT_NR_IRQS 0
314# endif
315#endif
316
317#if PINT_NR_IRQS > 0
318# define PINT_IRQ_BASE ONCHIP_NR_IRQS
319#endif
320
321/* 3. OFFCHIP_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800322#if defined(CONFIG_HD64461)
323# define OFFCHIP_NR_IRQS 18
324#elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
325# define OFFCHIP_NR_IRQS 48
326#elif defined(CONFIG_HD64465)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327# define OFFCHIP_NR_IRQS 16
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800328#elif defined (CONFIG_SH_EC3104)
329# define OFFCHIP_NR_IRQS 16
330#elif defined (CONFIG_SH_DREAMCAST)
331# define OFFCHIP_NR_IRQS 96
332#elif defined (CONFIG_SH_TITAN)
333# define OFFCHIP_NR_IRQS 4
Paul Mundt8d27e082006-02-01 03:06:04 -0800334#elif defined(CONFIG_SH_R7780RP)
335# define OFFCHIP_NR_IRQS 16
Paul Mundtbc8fb5d2006-09-27 18:09:34 +0900336#elif defined(CONFIG_SH_7343_SOLUTION_ENGINE)
337# define OFFCHIP_NR_IRQS 12
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800338#elif defined(CONFIG_SH_UNKNOWN)
339# define OFFCHIP_NR_IRQS 16 /* Must also be last */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340#else
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800341# define OFFCHIP_NR_IRQS 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342#endif
343
344#if OFFCHIP_NR_IRQS > 0
345# define OFFCHIP_IRQ_BASE (ONCHIP_NR_IRQS + PINT_NR_IRQS)
346#endif
347
348/* NR_IRQS. 1+2+3 */
349#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS)
350
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351extern void disable_irq(unsigned int);
352extern void disable_irq_nosync(unsigned int);
353extern void enable_irq(unsigned int);
354
355/*
356 * Simple Mask Register Support
357 */
358extern void make_maskreg_irq(unsigned int irq);
359extern unsigned short *irq_mask_register;
360
Yoshinori Satob2296322006-11-05 16:18:08 +0900361#if defined(CONFIG_CPU_SUBTYPE_SH7619)
362#define IRQ0_IRQ 16
363#define IRQ1_IRQ 17
364#define IRQ2_IRQ 18
365#define IRQ3_IRQ 19
366#define IRQ4_IRQ 32
367#define IRQ5_IRQ 33
368#define IRQ6_IRQ 34
369#define IRQ7_IRQ 35
370#elif !defined(CONFIG_CPU_SUBTYPE_SH7206)
371#define IRQ0_IRQ 32
372#define IRQ1_IRQ 33
373#define IRQ2_IRQ 34
374#define IRQ3_IRQ 35
375#define IRQ4_IRQ 36
376#define IRQ5_IRQ 37
377#endif
378
379#define IRQ0_PRIORITY 1
380#define IRQ1_PRIORITY 1
381#define IRQ2_PRIORITY 1
382#define IRQ3_PRIORITY 1
383#define IRQ4_PRIORITY 1
384#define IRQ5_PRIORITY 1
385
386#ifndef IRQ0_IPR_POS
387#define IRQ0_IPR_POS 0
388#define IRQ1_IPR_POS 1
389#define IRQ2_IPR_POS 2
390#define IRQ3_IPR_POS 3
391#define IRQ4_IPR_POS 0
392#define IRQ5_IPR_POS 1
393#endif
394
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395/*
Paul Mundt0f08f332006-09-27 17:03:56 +0900396 * PINT IRQs
397 */
398void init_IRQ_pint(void);
399
Jamie Lenehanbd71ab82006-10-31 12:35:02 +0900400struct ipr_data {
401 unsigned int irq;
402 unsigned int addr; /* Address of Interrupt Priority Register */
403 int shift; /* Shifts of the 16-bit data */
404 int priority; /* The priority */
405};
406
Paul Mundt0f08f332006-09-27 17:03:56 +0900407/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 * Function for "on chip support modules".
409 */
Jamie Lenehanbd71ab82006-10-31 12:35:02 +0900410extern void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411extern void make_imask_irq(unsigned int irq);
412
413#if defined(CONFIG_CPU_SUBTYPE_SH7300)
414#undef INTC_IPRA
415#undef INTC_IPRB
416#define INTC_IPRA 0xA414FEE2UL
417#define INTC_IPRB 0xA414FEE4UL
418#define INTC_IPRC 0xA4140016UL
419#define INTC_IPRD 0xA4140018UL
420#define INTC_IPRE 0xA414001AUL
421#define INTC_IPRF 0xA4080000UL
422#define INTC_IPRG 0xA4080002UL
423#define INTC_IPRH 0xA4080004UL
424#define INTC_IPRI 0xA4080006UL
425#define INTC_IPRJ 0xA4080008UL
426
427#define INTC_IMR0 0xA4080040UL
428#define INTC_IMR1 0xA4080042UL
429#define INTC_IMR2 0xA4080044UL
430#define INTC_IMR3 0xA4080046UL
431#define INTC_IMR4 0xA4080048UL
432#define INTC_IMR5 0xA408004AUL
433#define INTC_IMR6 0xA408004CUL
434#define INTC_IMR7 0xA408004EUL
435#define INTC_IMR8 0xA4080050UL
436#define INTC_IMR9 0xA4080052UL
437#define INTC_IMR10 0xA4080054UL
438
439#define INTC_IMCR0 0xA4080060UL
440#define INTC_IMCR1 0xA4080062UL
441#define INTC_IMCR2 0xA4080064UL
442#define INTC_IMCR3 0xA4080066UL
443#define INTC_IMCR4 0xA4080068UL
444#define INTC_IMCR5 0xA408006AUL
445#define INTC_IMCR6 0xA408006CUL
446#define INTC_IMCR7 0xA408006EUL
447#define INTC_IMCR8 0xA4080070UL
448#define INTC_IMCR9 0xA4080072UL
449#define INTC_IMCR10 0xA4080074UL
450
451#define INTC_ICR0 0xA414FEE0UL
452#define INTC_ICR1 0xA4140010UL
453
454#define INTC_IRR0 0xA4140004UL
455
456#define PORT_PACR 0xA4050100UL
457#define PORT_PBCR 0xA4050102UL
458#define PORT_PCCR 0xA4050104UL
459#define PORT_PDCR 0xA4050106UL
460#define PORT_PECR 0xA4050108UL
461#define PORT_PFCR 0xA405010AUL
462#define PORT_PGCR 0xA405010CUL
463#define PORT_PHCR 0xA405010EUL
464#define PORT_PJCR 0xA4050110UL
465#define PORT_PKCR 0xA4050112UL
466#define PORT_PLCR 0xA4050114UL
467#define PORT_SCPCR 0xA4050116UL
468#define PORT_PMCR 0xA4050118UL
469#define PORT_PNCR 0xA405011AUL
470#define PORT_PQCR 0xA405011CUL
471
472#define PORT_PSELA 0xA4050140UL
473#define PORT_PSELB 0xA4050142UL
474#define PORT_PSELC 0xA4050144UL
475
476#define PORT_HIZCRA 0xA4050146UL
477#define PORT_HIZCRB 0xA4050148UL
478#define PORT_DRVCR 0xA4050150UL
479
480#define PORT_PADR 0xA4050120UL
481#define PORT_PBDR 0xA4050122UL
482#define PORT_PCDR 0xA4050124UL
483#define PORT_PDDR 0xA4050126UL
484#define PORT_PEDR 0xA4050128UL
485#define PORT_PFDR 0xA405012AUL
486#define PORT_PGDR 0xA405012CUL
487#define PORT_PHDR 0xA405012EUL
488#define PORT_PJDR 0xA4050130UL
489#define PORT_PKDR 0xA4050132UL
490#define PORT_PLDR 0xA4050134UL
491#define PORT_SCPDR 0xA4050136UL
492#define PORT_PMDR 0xA4050138UL
493#define PORT_PNDR 0xA405013AUL
494#define PORT_PQDR 0xA405013CUL
495
496#define IRQ0_IRQ 32
497#define IRQ1_IRQ 33
498#define IRQ2_IRQ 34
499#define IRQ3_IRQ 35
500#define IRQ4_IRQ 36
501#define IRQ5_IRQ 37
502
503#define IRQ0_IPR_ADDR INTC_IPRC
504#define IRQ1_IPR_ADDR INTC_IPRC
505#define IRQ2_IPR_ADDR INTC_IPRC
506#define IRQ3_IPR_ADDR INTC_IPRC
507#define IRQ4_IPR_ADDR INTC_IPRD
508#define IRQ5_IPR_ADDR INTC_IPRD
509
510#define IRQ0_IPR_POS 0
511#define IRQ1_IPR_POS 1
512#define IRQ2_IPR_POS 2
513#define IRQ3_IPR_POS 3
514#define IRQ4_IPR_POS 0
515#define IRQ5_IPR_POS 1
516
517#define IRQ0_PRIORITY 1
518#define IRQ1_PRIORITY 1
519#define IRQ2_PRIORITY 1
520#define IRQ3_PRIORITY 1
521#define IRQ4_PRIORITY 1
522#define IRQ5_PRIORITY 1
523
524extern int ipr_irq_demux(int irq);
525#define __irq_demux(irq) ipr_irq_demux(irq)
526
527#elif defined(CONFIG_CPU_SUBTYPE_SH7604)
528#define INTC_IPRA 0xfffffee2UL
529#define INTC_IPRB 0xfffffe60UL
530
531#define INTC_VCRA 0xfffffe62UL
532#define INTC_VCRB 0xfffffe64UL
533#define INTC_VCRC 0xfffffe66UL
534#define INTC_VCRD 0xfffffe68UL
535
536#define INTC_VCRWDT 0xfffffee4UL
537#define INTC_VCRDIV 0xffffff0cUL
538#define INTC_VCRDMA0 0xffffffa0UL
539#define INTC_VCRDMA1 0xffffffa8UL
540
541#define INTC_ICR 0xfffffee0UL
542#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
Paul Mundte5723e02006-09-27 17:38:11 +0900543 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
Paul Mundte5723e02006-09-27 17:38:11 +0900545 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
546 defined(CONFIG_CPU_SUBTYPE_SH7710)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547#define INTC_IRR0 0xa4000004UL
548#define INTC_IRR1 0xa4000006UL
549#define INTC_IRR2 0xa4000008UL
550
551#define INTC_ICR0 0xfffffee0UL
552#define INTC_ICR1 0xa4000010UL
553#define INTC_ICR2 0xa4000012UL
554#define INTC_INTER 0xa4000014UL
555
556#define INTC_IPRC 0xa4000016UL
557#define INTC_IPRD 0xa4000018UL
558#define INTC_IPRE 0xa400001aUL
559#if defined(CONFIG_CPU_SUBTYPE_SH7707)
560#define INTC_IPRF 0xa400001cUL
561#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
562#define INTC_IPRF 0xa4080000UL
563#define INTC_IPRG 0xa4080002UL
564#define INTC_IPRH 0xa4080004UL
Paul Mundte5723e02006-09-27 17:38:11 +0900565#elif defined(CONFIG_CPU_SUBTYPE_SH7710)
566/* Interrupt Controller Registers */
567#undef INTC_IPRA
568#undef INTC_IPRB
569#define INTC_IPRA 0xA414FEE2UL
570#define INTC_IPRB 0xA414FEE4UL
571#define INTC_IPRF 0xA4080000UL
572#define INTC_IPRG 0xA4080002UL
573#define INTC_IPRH 0xA4080004UL
574#define INTC_IPRI 0xA4080006UL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575
Paul Mundte5723e02006-09-27 17:38:11 +0900576#undef INTC_ICR0
577#undef INTC_ICR1
578#define INTC_ICR0 0xA414FEE0UL
579#define INTC_ICR1 0xA4140010UL
580
581#define INTC_IRR0 0xa4000004UL
582#define INTC_IRR1 0xa4000006UL
583#define INTC_IRR2 0xa4000008UL
584#define INTC_IRR3 0xa400000AUL
585#define INTC_IRR4 0xa400000CUL
586#define INTC_IRR5 0xa4080020UL
587#define INTC_IRR7 0xa4080024UL
588#define INTC_IRR8 0xa4080026UL
589
590/* Interrupt numbers */
591#define TIMER2_IRQ 18
592#define TIMER2_IPR_ADDR INTC_IPRA
593#define TIMER2_IPR_POS 1
594#define TIMER2_PRIORITY 2
595
596/* WDT */
597#define WDT_IRQ 27
598#define WDT_IPR_ADDR INTC_IPRB
599#define WDT_IPR_POS 3
600#define WDT_PRIORITY 2
601
602#define SCIF0_ERI_IRQ 52
603#define SCIF0_RXI_IRQ 53
604#define SCIF0_BRI_IRQ 54
605#define SCIF0_TXI_IRQ 55
606#define SCIF0_IPR_ADDR INTC_IPRE
607#define SCIF0_IPR_POS 2
608#define SCIF0_PRIORITY 3
609
610#define DMTE4_IRQ 76
611#define DMTE5_IRQ 77
612#define DMA2_IPR_ADDR INTC_IPRF
613#define DMA2_IPR_POS 2
614#define DMA2_PRIORITY 7
615
616#define IPSEC_IRQ 79
617#define IPSEC_IPR_ADDR INTC_IPRF
618#define IPSEC_IPR_POS 3
619#define IPSEC_PRIORITY 3
620
621/* EDMAC */
622#define EDMAC0_IRQ 80
623#define EDMAC0_IPR_ADDR INTC_IPRG
624#define EDMAC0_IPR_POS 3
625#define EDMAC0_PRIORITY 3
626
627#define EDMAC1_IRQ 81
628#define EDMAC1_IPR_ADDR INTC_IPRG
629#define EDMAC1_IPR_POS 2
630#define EDMAC1_PRIORITY 3
631
632#define EDMAC2_IRQ 82
633#define EDMAC2_IPR_ADDR INTC_IPRG
634#define EDMAC2_IPR_POS 1
635#define EDMAC2_PRIORITY 3
636
637/* SIOF */
638#define SIOF0_ERI_IRQ 96
639#define SIOF0_TXI_IRQ 97
640#define SIOF0_RXI_IRQ 98
641#define SIOF0_CCI_IRQ 99
642#define SIOF0_IPR_ADDR INTC_IPRH
643#define SIOF0_IPR_POS 0
644#define SIOF0_PRIORITY 7
645
646#define SIOF1_ERI_IRQ 100
647#define SIOF1_TXI_IRQ 101
648#define SIOF1_RXI_IRQ 102
649#define SIOF1_CCI_IRQ 103
650#define SIOF1_IPR_ADDR INTC_IPRI
651#define SIOF1_IPR_POS 1
652#define SIOF1_PRIORITY 7
653#endif /* CONFIG_CPU_SUBTYPE_SH7710 */
654
655#if defined(CONFIG_CPU_SUBTYPE_SH7710)
656#define PORT_PACR 0xa4050100UL
657#define PORT_PBCR 0xa4050102UL
658#define PORT_PCCR 0xa4050104UL
659#define PORT_PETCR 0xa4050106UL
660#define PORT_PADR 0xa4050120UL
661#define PORT_PBDR 0xa4050122UL
662#define PORT_PCDR 0xa4050124UL
663#else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664#define PORT_PACR 0xa4000100UL
665#define PORT_PBCR 0xa4000102UL
666#define PORT_PCCR 0xa4000104UL
667#define PORT_PFCR 0xa400010aUL
668#define PORT_PADR 0xa4000120UL
669#define PORT_PBDR 0xa4000122UL
670#define PORT_PCDR 0xa4000124UL
671#define PORT_PFDR 0xa400012aUL
Paul Mundte5723e02006-09-27 17:38:11 +0900672#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673
674#define IRQ0_IRQ 32
675#define IRQ1_IRQ 33
676#define IRQ2_IRQ 34
677#define IRQ3_IRQ 35
678#define IRQ4_IRQ 36
679#define IRQ5_IRQ 37
680
681#define IRQ0_IPR_ADDR INTC_IPRC
682#define IRQ1_IPR_ADDR INTC_IPRC
683#define IRQ2_IPR_ADDR INTC_IPRC
684#define IRQ3_IPR_ADDR INTC_IPRC
685#define IRQ4_IPR_ADDR INTC_IPRD
686#define IRQ5_IPR_ADDR INTC_IPRD
687
688#define IRQ0_IPR_POS 0
689#define IRQ1_IPR_POS 1
690#define IRQ2_IPR_POS 2
691#define IRQ3_IPR_POS 3
692#define IRQ4_IPR_POS 0
693#define IRQ5_IPR_POS 1
694
695#define IRQ0_PRIORITY 1
696#define IRQ1_PRIORITY 1
697#define IRQ2_PRIORITY 1
698#define IRQ3_PRIORITY 1
699#define IRQ4_PRIORITY 1
700#define IRQ5_PRIORITY 1
701
702#define PINT0_IRQ 40
703#define PINT8_IRQ 41
704
705#define PINT0_IPR_ADDR INTC_IPRD
706#define PINT8_IPR_ADDR INTC_IPRD
707
708#define PINT0_IPR_POS 3
709#define PINT8_IPR_POS 2
710#define PINT0_PRIORITY 2
711#define PINT8_PRIORITY 2
712
713extern int ipr_irq_demux(int irq);
714#define __irq_demux(irq) ipr_irq_demux(irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715#endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */
716
717#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
718 defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
719#define INTC_ICR 0xffd00000
720#define INTC_ICR_NMIL (1<<15)
721#define INTC_ICR_MAI (1<<14)
722#define INTC_ICR_NMIB (1<<9)
723#define INTC_ICR_NMIE (1<<8)
724#define INTC_ICR_IRLM (1<<7)
725#endif
726
Paul Mundt8d27e082006-02-01 03:06:04 -0800727#ifdef CONFIG_CPU_SUBTYPE_SH7780
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800728#include <asm/irq-sh7780.h>
729#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800731/* SH with INTC2-style interrupts */
732#ifdef CONFIG_CPU_HAS_INTC2_IRQ
733#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734#define INTC2_BASE 0xfe080000
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800735#define INTC2_FIRST_IRQ 64
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736#define INTC2_INTREQ_OFFSET 0x20
737#define INTC2_INTMSK_OFFSET 0x40
738#define INTC2_INTMSKCLR_OFFSET 0x60
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800739#define NR_INTC2_IRQS 25
740#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
741#define INTC2_BASE 0xfe080000
742#define INTC2_FIRST_IRQ 48 /* INTEVT 0x800 */
743#define INTC2_INTREQ_OFFSET 0x20
744#define INTC2_INTMSK_OFFSET 0x40
745#define INTC2_INTMSKCLR_OFFSET 0x60
746#define NR_INTC2_IRQS 64
747#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
748#define INTC2_BASE 0xffd40000
Paul Mundt5283ecb2006-09-27 15:59:17 +0900749#define INTC2_FIRST_IRQ 21
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800750#define INTC2_INTMSK_OFFSET (0x38)
751#define INTC2_INTMSKCLR_OFFSET (0x3c)
752#define NR_INTC2_IRQS 60
753#endif
754
755#define INTC2_INTPRI_OFFSET 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756
Paul Mundt525ccc42006-10-06 17:35:48 +0900757struct intc2_data {
758 unsigned short irq;
759 unsigned char ipr_offset, ipr_shift;
760 unsigned char msk_offset, msk_shift;
761 unsigned char priority;
762};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763
Paul Mundt66a74052006-10-20 15:30:55 +0900764void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs);
Paul Mundt525ccc42006-10-06 17:35:48 +0900765void init_IRQ_intc2(void);
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800766#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767
Paul Mundte5723e02006-09-27 17:38:11 +0900768extern int shmse_irq_demux(int irq);
769
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770static inline int generic_irq_demux(int irq)
771{
772 return irq;
773}
774
Paul Mundtbf3a00f2006-01-16 22:14:14 -0800775#ifndef __irq_demux
776#define __irq_demux(irq) (irq)
777#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778#define irq_canonicalize(irq) (irq)
779#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq))
780
Paul Mundta6a311392006-09-27 18:22:14 +0900781#ifdef CONFIG_4KSTACKS
782extern void irq_ctx_init(int cpu);
783extern void irq_ctx_exit(int cpu);
784# define __ARCH_HAS_DO_SOFTIRQ
785#else
786# define irq_ctx_init(cpu) do { } while (0)
787# define irq_ctx_exit(cpu) do { } while (0)
788#endif
789
Linus Torvalds1da177e2005-04-16 15:20:36 -0700790#if defined(CONFIG_CPU_SUBTYPE_SH73180)
791#include <asm/irq-sh73180.h>
792#endif
793
Paul Mundte5723e02006-09-27 17:38:11 +0900794#if defined(CONFIG_CPU_SUBTYPE_SH7343)
795#include <asm/irq-sh7343.h>
796#endif
797
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798#endif /* __ASM_SH_IRQ_H */