2 * arch/arm/plat-omap/include/mach/entry-macro.S
4 * Low-level IRQ helper macros for OMAP-based platforms
6 * Copyright (C) 2009 Texas Instruments
7 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
13 #include <mach/hardware.h>
15 #include <mach/irqs.h>
16 #include <asm/hardware/gic.h>
18 #include <plat/omap24xx.h>
19 #include <plat/omap34xx.h>
21 /* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
22 #if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
23 #define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
24 #elif defined(CONFIG_ARCH_OMAP34XX)
25 #define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
27 #if defined(CONFIG_ARCH_OMAP4)
28 #include <plat/omap44xx.h>
30 #define INTCPS_SIR_IRQ_OFFSET 0x0040 /* Active interrupt offset */
31 #define ACTIVEIRQ_MASK 0x7f /* Active interrupt bits */
36 .macro get_irqnr_preamble, base, tmp
39 .macro arch_ret_to_user, tmp1, tmp2
42 #ifndef CONFIG_ARCH_OMAP4
43 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
44 ldr \base, =OMAP2_VA_IC_BASE
45 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
48 ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
51 ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
54 ldrne \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
55 and \irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
59 #define OMAP44XX_VA_GIC_CPU_BASE OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
62 * The interrupt numbering scheme is defined in the
63 * interrupt controller spec. To wit:
65 * Interrupts 0-15 are IPI
67 * 29-31 are local. We allow 30 to be used for the watchdog.
69 * 1021-1022 are reserved
70 * 1023 is "spurious" (no interrupt)
72 * For now, we ignore all local interrupts so only return an
73 * interrupt if it's between 30 and 1020. The test_for_ipi
74 * routine below will pick up on IPIs.
75 * A simple read from the controller will tell us the number
76 * of the highest priority enabled interrupt.
77 * We then just need to check whether it is in the
78 * valid range for an IRQ (30-1020 inclusive).
80 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
81 ldr \base, =OMAP44XX_VA_GIC_CPU_BASE
82 ldr \irqstat, [\base, #GIC_CPU_INTACK]
86 bic \irqnr, \irqstat, #0x1c00
94 /* We assume that irqstat (the raw value of the IRQ acknowledge
95 * register) is preserved from the macro above.
96 * If there is an IPI, we immediately signal end of interrupt
97 * on the controller, since this requires the original irqstat
98 * value which we won't easily be able to recreate later.
101 .macro test_for_ipi, irqnr, irqstat, base, tmp
102 bic \irqnr, \irqstat, #0x1c00
105 strcc \irqstat, [\base, #GIC_CPU_EOI]
110 /* As above, this assumes that irqstat and base are preserved */
112 .macro test_for_ltirq, irqnr, irqstat, base, tmp
113 bic \irqnr, \irqstat, #0x1c00
118 streq \irqstat, [\base, #GIC_CPU_EOI]
123 .macro irq_prio_table