Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_SH_IRQ_H |
| 2 | #define __ASM_SH_IRQ_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <asm/machvec.h> |
| 5 | #include <asm/ptrace.h> /* for pt_regs */ |
| 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | /* 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 Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 14 | #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 Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 22 | defined(CONFIG_CPU_SUBTYPE_SH7706) || \ |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 23 | defined(CONFIG_CPU_SUBTYPE_SH7705) |
| 24 | # define ONCHIP_NR_IRQS 64 // Actually 61 |
| 25 | # define PINT_NR_IRQS 16 |
Paul Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 26 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) |
| 27 | # define ONCHIP_NR_IRQS 104 |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 28 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | # define ONCHIP_NR_IRQS 144 |
Paul Mundt | 8d27e08 | 2006-02-01 03:06:04 -0800 | [diff] [blame] | 38 | #elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \ |
Paul Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 39 | defined(CONFIG_CPU_SUBTYPE_SH73180) || \ |
| 40 | defined(CONFIG_CPU_SUBTYPE_SH7343) |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 41 | # define ONCHIP_NR_IRQS 109 |
Paul Mundt | 8d27e08 | 2006-02-01 03:06:04 -0800 | [diff] [blame] | 42 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
| 43 | # define ONCHIP_NR_IRQS 111 |
Yoshinori Sato | b229632 | 2006-11-05 16:18:08 +0900 | [diff] [blame] | 44 | #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 Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 48 | #elif defined(CONFIG_SH_UNKNOWN) /* Most be last */ |
| 49 | # define ONCHIP_NR_IRQS 144 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #endif |
| 51 | |
| 52 | /* 2. PINT_NR_IRQS */ |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 53 | #ifdef CONFIG_SH_UNKNOWN |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | # 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 Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 66 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | # define OFFCHIP_NR_IRQS 16 |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 72 | #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 Mundt | 8d27e08 | 2006-02-01 03:06:04 -0800 | [diff] [blame] | 78 | #elif defined(CONFIG_SH_R7780RP) |
| 79 | # define OFFCHIP_NR_IRQS 16 |
Paul Mundt | bc8fb5d | 2006-09-27 18:09:34 +0900 | [diff] [blame] | 80 | #elif defined(CONFIG_SH_7343_SOLUTION_ENGINE) |
| 81 | # define OFFCHIP_NR_IRQS 12 |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 82 | #elif defined(CONFIG_SH_UNKNOWN) |
| 83 | # define OFFCHIP_NR_IRQS 16 /* Must also be last */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | #else |
Paul Mundt | bf3a00f | 2006-01-16 22:14:14 -0800 | [diff] [blame] | 85 | # define OFFCHIP_NR_IRQS 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | /* |
| 96 | * Simple Mask Register Support |
| 97 | */ |
| 98 | extern void make_maskreg_irq(unsigned int irq); |
| 99 | extern unsigned short *irq_mask_register; |
| 100 | |
| 101 | /* |
Paul Mundt | 0f08f33 | 2006-09-27 17:03:56 +0900 | [diff] [blame] | 102 | * PINT IRQs |
| 103 | */ |
| 104 | void init_IRQ_pint(void); |
| 105 | |
Jamie Lenehan | bd71ab8 | 2006-10-31 12:35:02 +0900 | [diff] [blame] | 106 | struct 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 Mundt | 0f08f33 | 2006-09-27 17:03:56 +0900 | [diff] [blame] | 113 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | * Function for "on chip support modules". |
| 115 | */ |
Jamie Lenehan | bd71ab8 | 2006-10-31 12:35:02 +0900 | [diff] [blame] | 116 | extern void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | extern void make_imask_irq(unsigned int irq); |
| 118 | |
Paul Mundt | 525ccc4 | 2006-10-06 17:35:48 +0900 | [diff] [blame] | 119 | struct 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
Paul Mundt | 66a7405 | 2006-10-20 15:30:55 +0900 | [diff] [blame] | 126 | void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs); |
Paul Mundt | 525ccc4 | 2006-10-06 17:35:48 +0900 | [diff] [blame] | 127 | void init_IRQ_intc2(void); |
Paul Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 128 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | static inline int generic_irq_demux(int irq) |
| 130 | { |
| 131 | return irq; |
| 132 | } |
| 133 | |
| 134 | #define irq_canonicalize(irq) (irq) |
Paul Mundt | 9a7ef6d | 2006-11-20 13:55:34 +0900 | [diff] [blame^] | 135 | #define irq_demux(irq) sh_mv.mv_irq_demux(irq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
Paul Mundt | a6a31139 | 2006-09-27 18:22:14 +0900 | [diff] [blame] | 137 | #ifdef CONFIG_4KSTACKS |
| 138 | extern void irq_ctx_init(int cpu); |
| 139 | extern 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | #endif /* __ASM_SH_IRQ_H */ |