0017-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. From f8da5caf65926d44581d4e7914b28ceab3d28a7c Mon Sep 17 00:00:00 2001
  2. From: John Crispin <blogic@openwrt.org>
  3. Date: Sun, 14 Jul 2013 23:08:11 +0200
  4. Subject: [PATCH 17/57] MIPS: use set_mode() to enable/disable the cevt-r4k
  5. irq
  6. Signed-off-by: John Crispin <blogic@openwrt.org>
  7. ---
  8. arch/mips/kernel/cevt-r4k.c | 37 +++++++++++++++++++++++++++++++------
  9. 1 file changed, 31 insertions(+), 6 deletions(-)
  10. --- a/arch/mips/kernel/cevt-r4k.c
  11. +++ b/arch/mips/kernel/cevt-r4k.c
  12. @@ -29,12 +29,6 @@ static int mips_next_event(unsigned long
  13. return res;
  14. }
  15. -void mips_set_clock_mode(enum clock_event_mode mode,
  16. - struct clock_event_device *evt)
  17. -{
  18. - /* Nothing to do ... */
  19. -}
  20. -
  21. DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
  22. int cp0_timer_irq_installed;
  23. @@ -75,9 +69,38 @@ struct irqaction c0_compare_irqaction =
  24. .name = "timer",
  25. };
  26. +void mips_set_clock_mode(enum clock_event_mode mode,
  27. + struct clock_event_device *evt)
  28. +{
  29. +#ifdef CONFIG_CEVT_SYSTICK_QUIRK
  30. + switch (mode) {
  31. + case CLOCK_EVT_MODE_ONESHOT:
  32. + if (cp0_timer_irq_installed)
  33. + break;
  34. +
  35. + cp0_timer_irq_installed = 1;
  36. +
  37. + setup_irq(evt->irq, &c0_compare_irqaction);
  38. + break;
  39. +
  40. + case CLOCK_EVT_MODE_SHUTDOWN:
  41. + if (!cp0_timer_irq_installed)
  42. + break;
  43. +
  44. + cp0_timer_irq_installed = 0;
  45. + free_irq(evt->irq, &c0_compare_irqaction);
  46. + break;
  47. +
  48. + default:
  49. + pr_err("Unhandeled mips clock_mode\n");
  50. + break;
  51. + }
  52. +#endif
  53. +}
  54. void mips_event_handler(struct clock_event_device *dev)
  55. {
  56. +
  57. }
  58. /*
  59. @@ -198,12 +221,14 @@ int r4k_clockevent_init(void)
  60. clockevents_register_device(cd);
  61. +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
  62. if (cp0_timer_irq_installed)
  63. return 0;
  64. cp0_timer_irq_installed = 1;
  65. setup_irq(irq, &c0_compare_irqaction);
  66. +#endif
  67. return 0;
  68. }
  69. --- a/arch/mips/ralink/Kconfig
  70. +++ b/arch/mips/ralink/Kconfig
  71. @@ -1,11 +1,16 @@
  72. if RALINK
  73. +config CEVT_SYSTICK_QUIRK
  74. + bool
  75. + default n
  76. +
  77. config CLKEVT_RT3352
  78. bool
  79. depends on SOC_RT305X || SOC_MT7620
  80. default y
  81. select CLKSRC_OF
  82. select CLKSRC_MMIO
  83. + select CEVT_SYSTICK_QUIRK
  84. config RALINK_ILL_ACC
  85. bool