032-MIPS-Provide-a-generic-plat_irq_dispatch.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 85f7cdacbb81db8c4cc8e474837eab1f0e4ff77b Mon Sep 17 00:00:00 2001
  2. From: Andrew Bresticker <abrestic@chromium.org>
  3. Date: Thu, 18 Sep 2014 14:47:09 -0700
  4. Subject: [PATCH 3/3] MIPS: Provide a generic plat_irq_dispatch
  5. For platforms which boot with device-tree or have correctly chained
  6. all external interrupt controllers, a generic plat_irq_dispatch() can
  7. be used. Implement a plat_irq_dispatch() which simply handles all the
  8. pending interrupts as reported by C0_Cause.
  9. Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
  10. Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
  11. Tested-by: Qais Yousef <qais.yousef@imgtec.com>
  12. Cc: Thomas Gleixner <tglx@linutronix.de>
  13. Cc: Jason Cooper <jason@lakedaemon.net>
  14. Cc: Andrew Bresticker <abrestic@chromium.org>
  15. Cc: Jeffrey Deans <jeffrey.deans@imgtec.com>
  16. Cc: Markos Chandras <markos.chandras@imgtec.com>
  17. Cc: Paul Burton <paul.burton@imgtec.com>
  18. Cc: Qais Yousef <qais.yousef@imgtec.com>
  19. Cc: Jonas Gorski <jogo@openwrt.org>
  20. Cc: John Crispin <blogic@openwrt.org>
  21. Cc: David Daney <ddaney.cavm@gmail.com>
  22. Cc: linux-mips@linux-mips.org
  23. Cc: linux-kernel@vger.kernel.org
  24. Patchwork: https://patchwork.linux-mips.org/patch/7801/
  25. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  26. ---
  27. arch/mips/kernel/irq_cpu.c | 18 ++++++++++++++++++
  28. 1 file changed, 18 insertions(+)
  29. --- a/arch/mips/kernel/irq_cpu.c
  30. +++ b/arch/mips/kernel/irq_cpu.c
  31. @@ -98,6 +98,24 @@ static struct irq_chip mips_mt_cpu_irq_c
  32. .irq_enable = unmask_mips_irq,
  33. };
  34. +asmlinkage void __weak plat_irq_dispatch(void)
  35. +{
  36. + unsigned long pending = read_c0_cause() & read_c0_status() & ST0_IM;
  37. + int irq;
  38. +
  39. + if (!pending) {
  40. + spurious_interrupt();
  41. + return;
  42. + }
  43. +
  44. + pending >>= CAUSEB_IP;
  45. + while (pending) {
  46. + irq = fls(pending) - 1;
  47. + do_IRQ(MIPS_CPU_IRQ_BASE + irq);
  48. + pending &= ~BIT(irq);
  49. + }
  50. +}
  51. +
  52. static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq,
  53. irq_hw_number_t hw)
  54. {