msp_irq.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 <msp_int.h>
  18. extern void msp_int_handle(void);
  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. /*
  26. * The PMC-Sierra MSP interrupts are arranged in a 3 level cascaded
  27. * hierarchical system. The first level are the direct MIPS interrupts
  28. * and are assigned the interrupt range 0-7. The second level is the SLM
  29. * interrupt controller and is assigned the range 8-39. The third level
  30. * comprises the Peripherial block, the PCI block, the PCI MSI block and
  31. * the SLP. The PCI interrupts and the SLP errors are handled by the
  32. * relevant subsystems so the core interrupt code needs only concern
  33. * itself with the Peripheral block. These are assigned interrupts in
  34. * the range 40-71.
  35. */
  36. asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
  37. {
  38. u32 pending;
  39. pending = read_c0_status() & read_c0_cause();
  40. /*
  41. * jump to the correct interrupt routine
  42. * These are arranged in priority order and the timer
  43. * comes first!
  44. */
  45. #ifdef CONFIG_IRQ_MSP_CIC /* break out the CIC stuff for now */
  46. if (pending & C_IRQ4) /* do the peripherals first, that's the timer */
  47. msp_cic_irq_dispatch();
  48. else if (pending & C_IRQ0)
  49. do_IRQ(MSP_INT_MAC0);
  50. else if (pending & C_IRQ1)
  51. do_IRQ(MSP_INT_MAC1);
  52. else if (pending & C_IRQ2)
  53. do_IRQ(MSP_INT_USB);
  54. else if (pending & C_IRQ3)
  55. do_IRQ(MSP_INT_SAR);
  56. else if (pending & C_IRQ5)
  57. do_IRQ(MSP_INT_SEC);
  58. #else
  59. if (pending & C_IRQ5)
  60. do_IRQ(MSP_INT_TIMER);
  61. else if (pending & C_IRQ0)
  62. do_IRQ(MSP_INT_MAC0);
  63. else if (pending & C_IRQ1)
  64. do_IRQ(MSP_INT_MAC1);
  65. else if (pending & C_IRQ3)
  66. do_IRQ(MSP_INT_VE);
  67. else if (pending & C_IRQ4)
  68. msp_slp_irq_dispatch();
  69. #endif
  70. else if (pending & C_SW0) /* do software after hardware */
  71. do_IRQ(MSP_INT_SW0);
  72. else if (pending & C_SW1)
  73. do_IRQ(MSP_INT_SW1);
  74. }
  75. static struct irqaction cascade_msp = {
  76. .handler = no_action,
  77. .name = "MSP cascade"
  78. };
  79. void __init arch_init_irq(void)
  80. {
  81. /* initialize the 1st-level CPU based interrupt controller */
  82. mips_cpu_irq_init();
  83. #ifdef CONFIG_IRQ_MSP_CIC
  84. msp_cic_irq_init();
  85. /* setup the cascaded interrupts */
  86. setup_irq(MSP_INT_CIC, &cascade_msp);
  87. setup_irq(MSP_INT_PER, &cascade_msp);
  88. #else
  89. /* setup the 2nd-level SLP register based interrupt controller */
  90. msp_slp_irq_init();
  91. /* setup the cascaded SLP/PER interrupts */
  92. setup_irq(MSP_INT_SLP, &cascade_msp);
  93. setup_irq(MSP_INT_PER, &cascade_msp);
  94. #endif
  95. }