40 #include <linux/module.h>
41 #include <linux/sched.h>
50 #include <mach/hardware.h>
54 #define IRQ_BANK(irq) ((irq) >> 5)
55 #define IRQ_BIT(irq) ((irq) & 0x1f)
64 static unsigned int irq_bank_count;
67 static inline unsigned int irq_bank_readl(
int bank,
int offset)
72 static inline void irq_bank_writel(
unsigned long value,
int bank,
int offset)
77 static void omap_ack_irq(
struct irq_data *
d)
80 omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG_OFFSET);
82 omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG_OFFSET);
85 static void omap_mask_irq(
struct irq_data *d)
95 static void omap_unmask_irq(
struct irq_data *d)
105 static void omap_mask_ack_irq(
struct irq_data *d)
131 static void omap_irq_set_cfg(
int irq,
int fiq,
int priority,
int trigger)
138 fiq = bank ? 0 : (fiq & 0x1);
139 val = fiq | ((priority & 0x1f) << 2) | ((trigger & 0x1) << 1);
140 offset = IRQ_ILR0_REG_OFFSET +
IRQ_BIT(irq) * 0x4;
141 irq_bank_writel(val, bank, offset);
144 #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
146 { .
base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3f8e22f },
147 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb9c1f2 },
148 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0x800040f3 },
152 #ifdef CONFIG_ARCH_OMAP15XX
154 { .
base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3febfff },
155 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xffbfffed },
158 { .
base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3faefc3 },
159 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0x65b3c061 },
163 #if defined(CONFIG_ARCH_OMAP16XX)
166 { .
base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f },
167 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd },
168 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xffffb7ff },
169 { .base_reg = OMAP_IH2_BASE + 0x200, .trigger_map = 0xffffffff },
173 static struct irq_chip omap_irq_chip = {
175 .irq_ack = omap_mask_ack_irq,
176 .irq_mask = omap_mask_irq,
177 .irq_unmask = omap_unmask_irq,
178 .irq_set_wake = omap_wake_irq,
185 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
188 irq_banks = omap7xx_irq_banks;
189 irq_bank_count =
ARRAY_SIZE(omap7xx_irq_banks);
192 #ifdef CONFIG_ARCH_OMAP15XX
195 irq_banks = omap1510_irq_banks;
196 irq_bank_count =
ARRAY_SIZE(omap1510_irq_banks);
200 irq_banks = omap310_irq_banks;
201 irq_bank_count =
ARRAY_SIZE(omap310_irq_banks);
204 #if defined(CONFIG_ARCH_OMAP16XX)
207 irq_banks = omap1610_irq_banks;
208 irq_bank_count =
ARRAY_SIZE(omap1610_irq_banks);
211 printk(
"Total of %i interrupts in %i interrupt banks\n",
212 irq_bank_count * 32, irq_bank_count);
215 for (i = 0; i < irq_bank_count; i++) {
216 irq_bank_writel(~0x0, i, IRQ_MIR_REG_OFFSET);
217 irq_bank_writel(0x0, i, IRQ_ITR_REG_OFFSET);
221 irq_bank_writel(0x03, 0, IRQ_CONTROL_REG_OFFSET);
222 irq_bank_writel(0x03, 1, IRQ_CONTROL_REG_OFFSET);
226 irq_bank_writel(0x0, 0, IRQ_GMR_REG_OFFSET);
229 for (i = 0; i < irq_bank_count; i++) {
230 for (j = i * 32; j < (i + 1) * 32; j++) {
234 omap_irq_set_cfg(j, 0, 0, irq_trigger);
236 irq_set_chip_and_handler(j, &omap_irq_chip,