msp_irq.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * IRQ vector handles
  3. *
  4. * Copyright (C) 1995, 1996, 1997, 2003 by Ralf Baechle
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/irq.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/ptrace.h>
  15. #include <linux/time.h>
  16. #include <asm/irq_cpu.h>
  17. #include <asm/setup.h>
  18. #include <msp_int.h>
  19. /* SLP bases systems */
  20. extern void msp_slp_irq_init(void);
  21. extern void msp_slp_irq_dispatch(void);
  22. /* CIC based systems */
  23. extern void msp_cic_irq_init(void);
  24. extern void msp_cic_irq_dispatch(void);
  25. /* VSMP support init */
  26. extern void msp_vsmp_int_init(void);
  27. /* vectored interrupt implementation */
  28. /* SW0/1 interrupts are used for SMP */
  29. static inline void mac0_int_dispatch(void) { do_IRQ(MSP_INT_MAC0); }
  30. static inline void mac1_int_dispatch(void) { do_IRQ(MSP_INT_MAC1); }
  31. static inline void mac2_int_dispatch(void) { do_IRQ(MSP_INT_SAR); }
  32. static inline void usb_int_dispatch(void) { do_IRQ(MSP_INT_USB); }
  33. static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); }
  34. /*
  35. * The PMC-Sierra MSP interrupts are arranged in a 3 level cascaded
  36. * hierarchical system. The first level are the direct MIPS interrupts
  37. * and are assigned the interrupt range 0-7. The second level is the SLM
  38. * interrupt controller and is assigned the range 8-39. The third level
  39. * comprises the Peripherial block, the PCI block, the PCI MSI block and
  40. * the SLP. The PCI interrupts and the SLP errors are handled by the
  41. * relevant subsystems so the core interrupt code needs only concern
  42. * itself with the Peripheral block. These are assigned interrupts in
  43. * the range 40-71.
  44. */
  45. asmlinkage void plat_irq_dispatch(void)
  46. {
  47. u32 pending;
  48. pending = read_c0_status() & read_c0_cause();
  49. /*
  50. * jump to the correct interrupt routine
  51. * These are arranged in priority order and the timer
  52. * comes first!
  53. */
  54. #ifdef CONFIG_IRQ_MSP_CIC /* break out the CIC stuff for now */
  55. if (pending & C_IRQ4) /* do the peripherals first, that's the timer */
  56. msp_cic_irq_dispatch();
  57. else if (pending & C_IRQ0)
  58. do_IRQ(MSP_INT_MAC0);
  59. else if (pending & C_IRQ1)
  60. do_IRQ(MSP_INT_MAC1);
  61. else if (pending & C_IRQ2)
  62. do_IRQ(MSP_INT_USB);
  63. else if (pending & C_IRQ3)
  64. do_IRQ(MSP_INT_SAR);
  65. else if (pending & C_IRQ5)
  66. do_IRQ(MSP_INT_SEC);
  67. #else
  68. if (pending & C_IRQ5)
  69. do_IRQ(MSP_INT_TIMER);
  70. else if (pending & C_IRQ0)
  71. do_IRQ(MSP_INT_MAC0);
  72. else if (pending & C_IRQ1)
  73. do_IRQ(MSP_INT_MAC1);
  74. else if (pending & C_IRQ3)
  75. do_IRQ(MSP_INT_VE);
  76. else if (pending & C_IRQ4)
  77. msp_slp_irq_dispatch();
  78. #endif
  79. else if (pending & C_SW0) /* do software after hardware */
  80. do_IRQ(MSP_INT_SW0);
  81. else if (pending & C_SW1)
  82. do_IRQ(MSP_INT_SW1);
  83. }
  84. static struct irqaction cic_cascade_msp = {
  85. .handler = no_action,
  86. .name = "MSP CIC cascade",
  87. .flags = IRQF_NO_THREAD,
  88. };
  89. static struct irqaction per_cascade_msp = {
  90. .handler = no_action,
  91. .name = "MSP PER cascade",
  92. .flags = IRQF_NO_THREAD,
  93. };
  94. void __init arch_init_irq(void)
  95. {
  96. /* assume we'll be using vectored interrupt mode except in UP mode*/
  97. #ifdef CONFIG_MIPS_MT
  98. BUG_ON(!cpu_has_vint);
  99. #endif
  100. /* initialize the 1st-level CPU based interrupt controller */
  101. mips_cpu_irq_init();
  102. #ifdef CONFIG_IRQ_MSP_CIC
  103. msp_cic_irq_init();
  104. #ifdef CONFIG_MIPS_MT
  105. set_vi_handler(MSP_INT_CIC, msp_cic_irq_dispatch);
  106. set_vi_handler(MSP_INT_MAC0, mac0_int_dispatch);
  107. set_vi_handler(MSP_INT_MAC1, mac1_int_dispatch);
  108. set_vi_handler(MSP_INT_SAR, mac2_int_dispatch);
  109. set_vi_handler(MSP_INT_USB, usb_int_dispatch);
  110. set_vi_handler(MSP_INT_SEC, sec_int_dispatch);
  111. #ifdef CONFIG_MIPS_MT_SMP
  112. msp_vsmp_int_init();
  113. #endif /* CONFIG_MIPS_MT_SMP */
  114. #endif /* CONFIG_MIPS_MT */
  115. /* setup the cascaded interrupts */
  116. setup_irq(MSP_INT_CIC, &cic_cascade_msp);
  117. setup_irq(MSP_INT_PER, &per_cascade_msp);
  118. #else
  119. /*
  120. * Setup the 2nd-level SLP register based interrupt controller.
  121. * VSMP support support is not enabled for SLP.
  122. */
  123. msp_slp_irq_init();
  124. /* setup the cascaded SLP/PER interrupts */
  125. setup_irq(MSP_INT_SLP, &cic_cascade_msp);
  126. setup_irq(MSP_INT_PER, &per_cascade_msp);
  127. #endif
  128. }