blob: f10cfc10227e45c3dd72cdd8f86d66ca46076e36 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_IRQ_H
2#define __ASM_SH_IRQ_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <asm/machvec.h>
5#include <asm/ptrace.h> /* for pt_regs */
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007/* NR_IRQS is made from three components:
8 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules
9 * 2. PINT_NR_IRQS - number of PINT interrupts
10 * 3. OFFCHIP_NR_IRQS - numbe of IRQs from off-chip peripherial modules
11 */
12
13/* 1. ONCHIP_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -080014#if defined(CONFIG_CPU_SUBTYPE_SH7604)
15# define ONCHIP_NR_IRQS 24 // Actually 21
16#elif defined(CONFIG_CPU_SUBTYPE_SH7707)
17# define ONCHIP_NR_IRQS 64
18# define PINT_NR_IRQS 16
19#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
20# define ONCHIP_NR_IRQS 32
21#elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
Paul Mundte5723e02006-09-27 17:38:11 +090022 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
Paul Mundtbf3a00f2006-01-16 22:14:14 -080023 defined(CONFIG_CPU_SUBTYPE_SH7705)
24# define ONCHIP_NR_IRQS 64 // Actually 61
25# define PINT_NR_IRQS 16
Paul Mundte5723e02006-09-27 17:38:11 +090026#elif defined(CONFIG_CPU_SUBTYPE_SH7710)
27# define ONCHIP_NR_IRQS 104
Paul Mundtbf3a00f2006-01-16 22:14:14 -080028#elif defined(CONFIG_CPU_SUBTYPE_SH7750)
29# define ONCHIP_NR_IRQS 48 // Actually 44
30#elif defined(CONFIG_CPU_SUBTYPE_SH7751)
31# define ONCHIP_NR_IRQS 72
32#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
33# define ONCHIP_NR_IRQS 112 /* XXX */
34#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
35# define ONCHIP_NR_IRQS 72
36#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037# define ONCHIP_NR_IRQS 144
Paul Mundt8d27e082006-02-01 03:06:04 -080038#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
Paul Mundte5723e02006-09-27 17:38:11 +090039 defined(CONFIG_CPU_SUBTYPE_SH73180) || \
40 defined(CONFIG_CPU_SUBTYPE_SH7343)
Paul Mundtbf3a00f2006-01-16 22:14:14 -080041# define ONCHIP_NR_IRQS 109
Paul Mundt8d27e082006-02-01 03:06:04 -080042#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
43# define ONCHIP_NR_IRQS 111
Yoshinori Satob2296322006-11-05 16:18:08 +090044#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
45# define ONCHIP_NR_IRQS 256
46#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
47# define ONCHIP_NR_IRQS 128
Paul Mundtbf3a00f2006-01-16 22:14:14 -080048#elif defined(CONFIG_SH_UNKNOWN) /* Most be last */
49# define ONCHIP_NR_IRQS 144
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#endif
51
52/* 2. PINT_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -080053#ifdef CONFIG_SH_UNKNOWN
Linus Torvalds1da177e2005-04-16 15:20:36 -070054# define PINT_NR_IRQS 16
55#else
56# ifndef PINT_NR_IRQS
57# define PINT_NR_IRQS 0
58# endif
59#endif
60
61#if PINT_NR_IRQS > 0
62# define PINT_IRQ_BASE ONCHIP_NR_IRQS
63#endif
64
65/* 3. OFFCHIP_NR_IRQS */
Paul Mundtbf3a00f2006-01-16 22:14:14 -080066#if defined(CONFIG_HD64461)
67# define OFFCHIP_NR_IRQS 18
68#elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
69# define OFFCHIP_NR_IRQS 48
70#elif defined(CONFIG_HD64465)
Linus Torvalds1da177e2005-04-16 15:20:36 -070071# define OFFCHIP_NR_IRQS 16
Paul Mundtbf3a00f2006-01-16 22:14:14 -080072#elif defined (CONFIG_SH_EC3104)
73# define OFFCHIP_NR_IRQS 16
74#elif defined (CONFIG_SH_DREAMCAST)
75# define OFFCHIP_NR_IRQS 96
76#elif defined (CONFIG_SH_TITAN)
77# define OFFCHIP_NR_IRQS 4
Paul Mundt8d27e082006-02-01 03:06:04 -080078#elif defined(CONFIG_SH_R7780RP)
79# define OFFCHIP_NR_IRQS 16
Paul Mundtbc8fb5d2006-09-27 18:09:34 +090080#elif defined(CONFIG_SH_7343_SOLUTION_ENGINE)
81# define OFFCHIP_NR_IRQS 12
Paul Mundtbf3a00f2006-01-16 22:14:14 -080082#elif defined(CONFIG_SH_UNKNOWN)
83# define OFFCHIP_NR_IRQS 16 /* Must also be last */
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#else
Paul Mundtbf3a00f2006-01-16 22:14:14 -080085# define OFFCHIP_NR_IRQS 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070086#endif
87
88#if OFFCHIP_NR_IRQS > 0
89# define OFFCHIP_IRQ_BASE (ONCHIP_NR_IRQS + PINT_NR_IRQS)
90#endif
91
92/* NR_IRQS. 1+2+3 */
93#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS)
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095/*
96 * Simple Mask Register Support
97 */
98extern void make_maskreg_irq(unsigned int irq);
99extern unsigned short *irq_mask_register;
100
101/*
Paul Mundt0f08f332006-09-27 17:03:56 +0900102 * PINT IRQs
103 */
104void init_IRQ_pint(void);
105
Jamie Lenehanbd71ab82006-10-31 12:35:02 +0900106struct ipr_data {
107 unsigned int irq;
108 unsigned int addr; /* Address of Interrupt Priority Register */
109 int shift; /* Shifts of the 16-bit data */
110 int priority; /* The priority */
111};
112
Paul Mundt0f08f332006-09-27 17:03:56 +0900113/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 * Function for "on chip support modules".
115 */
Jamie Lenehanbd71ab82006-10-31 12:35:02 +0900116extern void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117extern void make_imask_irq(unsigned int irq);
118
Paul Mundt525ccc42006-10-06 17:35:48 +0900119struct intc2_data {
120 unsigned short irq;
121 unsigned char ipr_offset, ipr_shift;
122 unsigned char msk_offset, msk_shift;
123 unsigned char priority;
124};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
Paul Mundt66a74052006-10-20 15:30:55 +0900126void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs);
Paul Mundt525ccc42006-10-06 17:35:48 +0900127void init_IRQ_intc2(void);
Paul Mundte5723e02006-09-27 17:38:11 +0900128
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129static inline int generic_irq_demux(int irq)
130{
131 return irq;
132}
133
134#define irq_canonicalize(irq) (irq)
Paul Mundt9a7ef6d2006-11-20 13:55:34 +0900135#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
Paul Mundta6a311392006-09-27 18:22:14 +0900137#ifdef CONFIG_4KSTACKS
138extern void irq_ctx_init(int cpu);
139extern void irq_ctx_exit(int cpu);
140# define __ARCH_HAS_DO_SOFTIRQ
141#else
142# define irq_ctx_init(cpu) do { } while (0)
143# define irq_ctx_exit(cpu) do { } while (0)
144#endif
145
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146#endif /* __ASM_SH_IRQ_H */