entry-macro.S 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * arch/arm/plat-omap/include/mach/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for OMAP-based platforms
  5. *
  6. * Copyright (C) 2009 Texas Instruments
  7. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  8. *
  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.
  12. */
  13. #include <mach/hardware.h>
  14. #include <mach/io.h>
  15. #include <mach/irqs.h>
  16. #include <asm/hardware/gic.h>
  17. #include <plat/omap24xx.h>
  18. #include <plat/omap34xx.h>
  19. /* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
  20. #if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
  21. #define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
  22. #elif defined(CONFIG_ARCH_OMAP34XX)
  23. #define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
  24. #endif
  25. #if defined(CONFIG_ARCH_OMAP4)
  26. #include <plat/omap44xx.h>
  27. #endif
  28. #define INTCPS_SIR_IRQ_OFFSET 0x0040 /* Active interrupt offset */
  29. #define ACTIVEIRQ_MASK 0x7f /* Active interrupt bits */
  30. .macro disable_fiq
  31. .endm
  32. .macro get_irqnr_preamble, base, tmp
  33. .endm
  34. .macro arch_ret_to_user, tmp1, tmp2
  35. .endm
  36. #ifndef CONFIG_ARCH_OMAP4
  37. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  38. ldr \base, =OMAP2_VA_IC_BASE
  39. ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
  40. cmp \irqnr, #0x0
  41. bne 2222f
  42. ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
  43. cmp \irqnr, #0x0
  44. bne 2222f
  45. ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
  46. cmp \irqnr, #0x0
  47. 2222:
  48. ldrne \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
  49. and \irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
  50. .endm
  51. #else
  52. #define OMAP44XX_VA_GIC_CPU_BASE OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
  53. /*
  54. * The interrupt numbering scheme is defined in the
  55. * interrupt controller spec. To wit:
  56. *
  57. * Interrupts 0-15 are IPI
  58. * 16-28 are reserved
  59. * 29-31 are local. We allow 30 to be used for the watchdog.
  60. * 32-1020 are global
  61. * 1021-1022 are reserved
  62. * 1023 is "spurious" (no interrupt)
  63. *
  64. * For now, we ignore all local interrupts so only return an
  65. * interrupt if it's between 30 and 1020. The test_for_ipi
  66. * routine below will pick up on IPIs.
  67. * A simple read from the controller will tell us the number
  68. * of the highest priority enabled interrupt.
  69. * We then just need to check whether it is in the
  70. * valid range for an IRQ (30-1020 inclusive).
  71. */
  72. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  73. ldr \base, =OMAP44XX_VA_GIC_CPU_BASE
  74. ldr \irqstat, [\base, #GIC_CPU_INTACK]
  75. ldr \tmp, =1021
  76. bic \irqnr, \irqstat, #0x1c00
  77. cmp \irqnr, #29
  78. cmpcc \irqnr, \irqnr
  79. cmpne \irqnr, \tmp
  80. cmpcs \irqnr, \irqnr
  81. .endm
  82. /* We assume that irqstat (the raw value of the IRQ acknowledge
  83. * register) is preserved from the macro above.
  84. * If there is an IPI, we immediately signal end of interrupt
  85. * on the controller, since this requires the original irqstat
  86. * value which we won't easily be able to recreate later.
  87. */
  88. .macro test_for_ipi, irqnr, irqstat, base, tmp
  89. bic \irqnr, \irqstat, #0x1c00
  90. cmp \irqnr, #16
  91. it cc
  92. strcc \irqstat, [\base, #GIC_CPU_EOI]
  93. it cs
  94. cmpcs \irqnr, \irqnr
  95. .endm
  96. /* As above, this assumes that irqstat and base are preserved */
  97. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  98. bic \irqnr, \irqstat, #0x1c00
  99. mov \tmp, #0
  100. cmp \irqnr, #29
  101. itt eq
  102. moveq \tmp, #1
  103. streq \irqstat, [\base, #GIC_CPU_EOI]
  104. cmp \tmp, #0
  105. .endm
  106. #endif
  107. .macro irq_prio_table
  108. .endm