entry-macro.S 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * include/asm-arm/arch-lh7a40x/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for LH7A40x platforms
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <asm/hardware.h>
  11. #include <asm/arch/irqs.h>
  12. /* In order to allow there to be support for both of the processor
  13. classes at the same time, we make a hack here that isn't very
  14. pretty. At startup, the link pointed to with the
  15. branch_irq_lh7a400 symbol is replaced with a NOP when the CPU is
  16. detected as a lh7a404.
  17. *** FIXME: we should clean this up so that there is only one
  18. implementation for each CPU's design.
  19. */
  20. #if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404)
  21. .macro disable_fiq
  22. .endm
  23. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  24. branch_irq_lh7a400: b 1000f
  25. @ Implementation of the LH7A404 get_irqnr_and_base.
  26. mov \irqnr, #0 @ VIC1 irq base
  27. mov \base, #io_p2v(0x80000000) @ APB registers
  28. add \base, \base, #0x8000
  29. ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR
  30. tst \tmp, #VA_VECTORED @ Direct vectored
  31. bne 1002f
  32. tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1
  33. ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS
  34. bne 1001f
  35. add \base, \base, #(0xa000 - 0x8000)
  36. ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR
  37. tst \tmp, #VA_VECTORED @ Direct vectored
  38. bne 1002f
  39. ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS
  40. mov \irqnr, #32 @ VIC2 irq base
  41. 1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
  42. bcs 1008f @ Bit set; irq found
  43. add \irqnr, \irqnr, #1
  44. bne 1001b @ Until no bits
  45. b 1009f @ Nothing? Hmm.
  46. 1002: and \irqnr, \tmp, #0x3f @ Mask for valid bits
  47. 1008: movs \irqstat, #1 @ Force !Z
  48. str \tmp, [\base, #0x0030] @ Clear vector
  49. b 1009f
  50. @ Implementation of the LH7A400 get_irqnr_and_base.
  51. 1000: mov \irqnr, #0
  52. mov \base, #io_p2v(0x80000000) @ APB registers
  53. ldr \irqstat, [\base, #0x500] @ PIC INTSR
  54. 1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
  55. bcs 1008f @ Bit set; irq found
  56. add \irqnr, \irqnr, #1
  57. bne 1001b @ Until no bits
  58. b 1009f @ Nothing? Hmm.
  59. 1008: movs \irqstat, #1 @ Force !Z
  60. 1009:
  61. .endm
  62. #elif defined (CONFIG_ARCH_LH7A400)
  63. .macro disable_fiq
  64. .endm
  65. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  66. mov \irqnr, #0
  67. mov \base, #io_p2v(0x80000000) @ APB registers
  68. ldr \irqstat, [\base, #0x500] @ PIC INTSR
  69. 1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
  70. bcs 1008f @ Bit set; irq found
  71. add \irqnr, \irqnr, #1
  72. bne 1001b @ Until no bits
  73. b 1009f @ Nothing? Hmm.
  74. 1008: movs \irqstat, #1 @ Force !Z
  75. 1009:
  76. .endm
  77. #elif defined(CONFIG_ARCH_LH7A404)
  78. .macro disable_fiq
  79. .endm
  80. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  81. mov \irqnr, #0 @ VIC1 irq base
  82. mov \base, #io_p2v(0x80000000) @ APB registers
  83. add \base, \base, #0x8000
  84. ldr \tmp, [\base, #0x0030] @ VIC1_VECTADDR
  85. tst \tmp, #VA_VECTORED @ Direct vectored
  86. bne 1002f
  87. tst \tmp, #VA_VIC1DEFAULT @ Default vectored VIC1
  88. ldrne \irqstat, [\base, #0] @ VIC1_IRQSTATUS
  89. bne 1001f
  90. add \base, \base, #(0xa000 - 0x8000)
  91. ldr \tmp, [\base, #0x0030] @ VIC2_VECTADDR
  92. tst \tmp, #VA_VECTORED @ Direct vectored
  93. bne 1002f
  94. ldr \irqstat, [\base, #0] @ VIC2_IRQSTATUS
  95. mov \irqnr, #32 @ VIC2 irq base
  96. 1001: movs \irqstat, \irqstat, lsr #1 @ Shift into carry
  97. bcs 1008f @ Bit set; irq found
  98. add \irqnr, \irqnr, #1
  99. bne 1001b @ Until no bits
  100. b 1009f @ Nothing? Hmm.
  101. 1002: and \irqnr, \tmp, #0x3f @ Mask for valid bits
  102. 1008: movs \irqstat, #1 @ Force !Z
  103. str \tmp, [\base, #0x0030] @ Clear vector
  104. 1009:
  105. .endm
  106. #endif