VectoredInterruptController 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. README on the Vectored Interrupt Controller of the LH7A404
  2. ==========================================================
  3. The 404 revision of the LH7A40X series comes with two vectored
  4. interrupts controllers. While the kernel does use some of the
  5. features of these devices, it is far from the purpose for which they
  6. were designed.
  7. When this README was written, the implementation of the VICs was in
  8. flux. It is possible that some details, especially with priorities,
  9. will change.
  10. The VIC support code is inspired by routines written by Sharp.
  11. Priority Control
  12. ----------------
  13. The significant reason for using the VIC's vectoring is to control
  14. interrupt priorities. There are two tables in
  15. arch/arm/mach-lh7a40x/irq-lh7a404.c that look something like this.
  16. static unsigned char irq_pri_vic1[] = { IRQ_GPIO3INTR, };
  17. static unsigned char irq_pri_vic2[] = {
  18. IRQ_T3UI, IRQ_GPIO7INTR,
  19. IRQ_UART1INTR, IRQ_UART2INTR, IRQ_UART3INTR, };
  20. The initialization code reads these tables and inserts a vector
  21. address and enable for each indicated IRQ. Vectored interrupts have
  22. higher priority than non-vectored interrupts. So, on VIC1,
  23. IRQ_GPIO3INTR will be served before any other non-FIQ interrupt. Due
  24. to the way that the vectoring works, IRQ_T3UI is the next highest
  25. priority followed by the other vectored interrupts on VIC2. After
  26. that, the non-vectored interrupts are scanned in VIC1 then in VIC2.
  27. ISR
  28. ---
  29. The interrupt service routine macro get_irqnr() in
  30. arch/arm/kernel/entry-armv.S scans the VICs for the next active
  31. interrupt. The vectoring makes this code somewhat larger than it was
  32. before using vectoring (refer to the LH7A400 implementation). In the
  33. case where an interrupt is vectored, the implementation will tend to
  34. be faster than the non-vectored version. However, the worst-case path
  35. is longer.
  36. It is worth noting that at present, there is no need to read
  37. VIC2_VECTADDR because the register appears to be shared between the
  38. controllers. The code is written such that if this changes, it ought
  39. to still work properly.
  40. Vector Addresses
  41. ----------------
  42. The proper use of the vectoring hardware would jump to the ISR
  43. specified by the vectoring address. Linux isn't structured to take
  44. advantage of this feature, though it might be possible to change
  45. things to support it.
  46. In this implementation, the vectoring address is used to speed the
  47. search for the active IRQ. The address is coded such that the lowest
  48. 6 bits store the IRQ number for vectored interrupts. These numbers
  49. correspond to the bits in the interrupt status registers. IRQ zero is
  50. the lowest interrupt bit in VIC1. IRQ 32 is the lowest interrupt bit
  51. in VIC2. Because zero is a valid IRQ number and because we cannot
  52. detect whether or not there is a valid vectoring address if that
  53. address is zero, the eigth bit (0x100) is set for vectored interrupts.
  54. The address for IRQ 0x18 (VIC2) is 0x118. Only the ninth bit is set
  55. for the default handler on VIC1 and only the tenth bit is set for the
  56. default handler on VIC2.
  57. In other words.
  58. 0x000 - no active interrupt
  59. 0x1ii - vectored interrupt 0xii
  60. 0x2xx - unvectored interrupt on VIC1 (xx is don't care)
  61. 0x4xx - unvectored interrupt on VIC2 (xx is don't care)