entry-macro.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. */
  10. /* We have a problem that the INTOFFSET register does not always
  11. * show one interrupt. Occasionally we get two interrupts through
  12. * the prioritiser, and this causes the INTOFFSET register to show
  13. * what looks like the logical-or of the two interrupt numbers.
  14. *
  15. * Thanks to Klaus, Shannon, et al for helping to debug this problem
  16. */
  17. #define INTPND (0x10)
  18. #define INTOFFSET (0x14)
  19. #define EXTINTPEND (0xa8)
  20. #define EXTINTMASK (0xa4)
  21. #include <asm/hardware.h>
  22. #include <asm/arch/irqs.h>
  23. .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
  24. mov \base, #S3C24XX_VA_IRQ
  25. ldr \irqstat, [ \base, #INTPND]
  26. bics \irqnr, \irqstat, #3<<4 @@ only an GPIO IRQ
  27. beq 2000f
  28. @@ try the interrupt offset register, since it is there
  29. ldr \irqnr, [ \base, #INTOFFSET ]
  30. mov \tmp, #1
  31. tst \irqstat, \tmp, lsl \irqnr
  32. addne \irqnr, \irqnr, #IRQ_EINT0
  33. bne 1001f
  34. @@ the number specified is not a valid irq, so try
  35. @@ and work it out for ourselves
  36. mov \irqnr, #IRQ_EINT0 @@ start here
  37. b 3000f
  38. 2000:
  39. @@ load the GPIO interrupt register, and check it
  40. add \tmp, \base, #S3C24XX_VA_GPIO - S3C24XX_VA_IRQ
  41. ldr \irqstat, [ \tmp, # EXTINTPEND ]
  42. ldr \irqnr, [ \tmp, # EXTINTMASK ]
  43. bics \irqstat, \irqstat, \irqnr
  44. beq 1001f
  45. mov \irqnr, #(IRQ_EINT4 - 4)
  46. @@ work out which irq (if any) we got
  47. 3000:
  48. movs \tmp, \irqstat, lsl#16
  49. addeq \irqnr, \irqnr, #16
  50. moveq \irqstat, \irqstat, lsr#16
  51. tst \irqstat, #0xff
  52. addeq \irqnr, \irqnr, #8
  53. moveq \irqstat, \irqstat, lsr#8
  54. tst \irqstat, #0xf
  55. addeq \irqnr, \irqnr, #4
  56. moveq \irqstat, \irqstat, lsr#4
  57. tst \irqstat, #0x3
  58. addeq \irqnr, \irqnr, #2
  59. moveq \irqstat, \irqstat, lsr#2
  60. tst \irqstat, #0x1
  61. addeq \irqnr, \irqnr, #1
  62. @@ we have the value
  63. movs \irqnr, \irqnr
  64. 1001:
  65. @@ exit here, Z flag unset if IRQ
  66. .endm
  67. /* currently don't need an disable_fiq macro */
  68. .macro disable_fiq
  69. .endm