entry-macro.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * include/asm-arm/arch-s3c2410/entry-macro.S
  3. *
  4. * Low-level IRQ helper macros for S3C2410-based 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. * Modifications:
  10. * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
  11. */
  12. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  13. mov \tmp, #S3C24XX_VA_IRQ
  14. ldr \irqnr, [ \tmp, #0x14 ] @ get irq no
  15. 30000:
  16. teq \irqnr, #4
  17. teqne \irqnr, #5
  18. beq 1002f @ external irq reg
  19. @ debug check to see if interrupt reported is the same
  20. @ as the offset....
  21. teq \irqnr, #0
  22. beq 20002f
  23. ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
  24. mov \irqstat, \irqstat, lsr \irqnr
  25. tst \irqstat, #1
  26. bne 20002f
  27. /* debug/warning if we get an invalud response from the
  28. * INTOFFSET register */
  29. #if 1
  30. stmfd r13!, { r0 - r4 , r8-r12, r14 }
  31. ldr r1, [ \tmp, #0x14 ] @ INTOFFSET
  32. ldr r2, [ \tmp, #0x10 ] @ INTPND
  33. ldr r3, [ \tmp, #0x00 ] @ SRCPND
  34. adr r0, 20003f
  35. bl printk
  36. b 20004f
  37. 20003:
  38. .ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n"
  39. .byte 0
  40. .align 4
  41. 20004:
  42. mov r1, #1
  43. mov \tmp, #S3C24XX_VA_IRQ
  44. ldmfd r13!, { r0 - r4 , r8-r12, r14 }
  45. #endif
  46. @ try working out interrupt number for ourselves
  47. mov \irqnr, #0
  48. ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
  49. 10021:
  50. movs \irqstat, \irqstat, lsr#1
  51. bcs 30000b @ try and re-start the proccess
  52. add \irqnr, \irqnr, #1
  53. cmp \irqnr, #32
  54. ble 10021b
  55. @ found no interrupt, set Z flag and leave
  56. movs \irqnr, #0
  57. b 1001f
  58. 20005:
  59. 20002: @ exit
  60. @ we base the s3c2410x interrupts at 16 and above to allow
  61. @ isa peripherals to have their standard interrupts, also
  62. @ ensure that Z flag is un-set on exit
  63. @ note, we cannot be sure if we get IRQ_EINT0 (0) that
  64. @ there is simply no interrupt pending, so in all other
  65. @ cases we jump to say we have found something, otherwise
  66. @ we check to see if the interrupt really is assrted
  67. adds \irqnr, \irqnr, #IRQ_EINT0
  68. teq \irqnr, #IRQ_EINT0
  69. bne 1001f @ exit
  70. ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
  71. teq \irqstat, #0
  72. moveq \irqnr, #0
  73. b 1001f
  74. @ we get here from no main or external interrupts pending
  75. 1002:
  76. add \tmp, \tmp, #S3C24XX_VA_GPIO - S3C24XX_VA_IRQ
  77. ldr \irqstat, [ \tmp, # 0xa8 ] @ EXTINTPEND
  78. ldr \irqnr, [ \tmp, # 0xa4 ] @ EXTINTMASK
  79. bic \irqstat, \irqstat, \irqnr @ clear masked irqs
  80. mov \irqnr, #IRQ_EINT4 @ start extint nos
  81. mov \irqstat, \irqstat, lsr#4 @ ignore bottom 4 bits
  82. 10021:
  83. movs \irqstat, \irqstat, lsr#1
  84. bcs 1004f
  85. add \irqnr, \irqnr, #1
  86. cmp \irqnr, #IRQ_EINT23
  87. ble 10021b
  88. @ found no interrupt, set Z flag and leave
  89. movs \irqnr, #0
  90. 1004: @ ensure Z flag clear in case our MOVS shifted out the last bit
  91. teq \irqnr, #0
  92. 1001:
  93. @ exit irq routine
  94. .endm
  95. /* currently don't need an disable_fiq macro */
  96. .macro disable_fiq
  97. .endm