entry-macro.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. #include <plat/omap44xx.h>
  20. #include <plat/multi.h>
  21. #define OMAP2_IRQ_BASE OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
  22. #define OMAP3_IRQ_BASE OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
  23. #define OMAP4_IRQ_BASE OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
  24. #define INTCPS_SIR_IRQ_OFFSET 0x0040 /* omap2/3 active interrupt offset */
  25. #define ACTIVEIRQ_MASK 0x7f /* omap2/3 active interrupt bits */
  26. .macro disable_fiq
  27. .endm
  28. .macro arch_ret_to_user, tmp1, tmp2
  29. .endm
  30. /*
  31. * Unoptimized irq functions for multi-omap2, 3 and 4
  32. */
  33. #ifdef MULTI_OMAP2
  34. /*
  35. * Configure the interrupt base on the first interrupt.
  36. * See also omap_irq_base_init for setting omap_irq_base.
  37. */
  38. .macro get_irqnr_preamble, base, tmp
  39. ldr \base, =omap_irq_base @ irq base address
  40. ldr \base, [\base, #0] @ irq base value
  41. .endm
  42. /* Check the pending interrupts. Note that base already set */
  43. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  44. tst \base, #0x100 @ gic address?
  45. bne 4401f @ found gic
  46. /* Handle omap2 and omap3 */
  47. ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
  48. cmp \irqnr, #0x0
  49. bne 9998f
  50. ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
  51. cmp \irqnr, #0x0
  52. bne 9998f
  53. ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
  54. cmp \irqnr, #0x0
  55. 9998:
  56. ldrne \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
  57. and \irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
  58. b 9999f
  59. /* Handle omap4 */
  60. 4401: ldr \irqstat, [\base, #GIC_CPU_INTACK]
  61. ldr \tmp, =1021
  62. bic \irqnr, \irqstat, #0x1c00
  63. cmp \irqnr, #29
  64. cmpcc \irqnr, \irqnr
  65. cmpne \irqnr, \tmp
  66. cmpcs \irqnr, \irqnr
  67. 9999:
  68. .endm
  69. #ifdef CONFIG_SMP
  70. /* We assume that irqstat (the raw value of the IRQ acknowledge
  71. * register) is preserved from the macro above.
  72. * If there is an IPI, we immediately signal end of interrupt
  73. * on the controller, since this requires the original irqstat
  74. * value which we won't easily be able to recreate later.
  75. */
  76. .macro test_for_ipi, irqnr, irqstat, base, tmp
  77. bic \irqnr, \irqstat, #0x1c00
  78. cmp \irqnr, #16
  79. it cc
  80. strcc \irqstat, [\base, #GIC_CPU_EOI]
  81. it cs
  82. cmpcs \irqnr, \irqnr
  83. .endm
  84. /* As above, this assumes that irqstat and base are preserved */
  85. .macro test_for_ltirq, irqnr, irqstat, base, tmp
  86. bic \irqnr, \irqstat, #0x1c00
  87. mov \tmp, #0
  88. cmp \irqnr, #29
  89. itt eq
  90. moveq \tmp, #1
  91. streq \irqstat, [\base, #GIC_CPU_EOI]
  92. cmp \tmp, #0
  93. .endm
  94. #endif /* CONFIG_SMP */
  95. #else /* MULTI_OMAP2 */
  96. /*
  97. * Optimized irq functions for omap2, 3 and 4
  98. */
  99. #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
  100. .macro get_irqnr_preamble, base, tmp
  101. #ifdef CONFIG_ARCH_OMAP2
  102. ldr \base, =OMAP2_IRQ_BASE
  103. #else
  104. ldr \base, =OMAP3_IRQ_BASE
  105. #endif
  106. .endm
  107. /* Check the pending interrupts. Note that base already set */
  108. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  109. ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
  110. cmp \irqnr, #0x0
  111. bne 9999f
  112. ldr \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
  113. cmp \irqnr, #0x0
  114. bne 9999f
  115. ldr \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
  116. cmp \irqnr, #0x0
  117. 9999:
  118. ldrne \irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
  119. and \irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
  120. .endm
  121. #endif
  122. #ifdef CONFIG_ARCH_OMAP4
  123. #define HAVE_GET_IRQNR_PREAMBLE
  124. #include <asm/hardware/entry-macro-gic.S>
  125. .macro get_irqnr_preamble, base, tmp
  126. ldr \base, =OMAP4_IRQ_BASE
  127. .endm
  128. #endif
  129. #endif /* MULTI_OMAP2 */
  130. .macro irq_prio_table
  131. .endm