0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From ce3d4a4111a5f7e6b4e74bceae5faa6ce388e8ec 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 05/53] 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/ralink/Kconfig | 5 +++++
  9. 1 file changed, 5 insertions(+)
  10. --- a/arch/mips/ralink/Kconfig
  11. +++ b/arch/mips/ralink/Kconfig
  12. @@ -1,11 +1,16 @@
  13. if RALINK
  14. +config CEVT_SYSTICK_QUIRK
  15. + bool
  16. + default n
  17. +
  18. config CLKEVT_RT3352
  19. bool
  20. depends on SOC_RT305X || SOC_MT7620
  21. default y
  22. select CLKSRC_OF
  23. select CLKSRC_MMIO
  24. + select CEVT_SYSTICK_QUIRK
  25. config RALINK_ILL_ACC
  26. bool
  27. --- a/arch/mips/kernel/cevt-r4k.c
  28. +++ b/arch/mips/kernel/cevt-r4k.c
  29. @@ -15,6 +15,26 @@
  30. #include <asm/time.h>
  31. #include <asm/cevt-r4k.h>
  32. +static int mips_state_oneshot(struct clock_event_device *evt)
  33. +{
  34. + if (!cp0_timer_irq_installed) {
  35. + cp0_timer_irq_installed = 1;
  36. + setup_irq(evt->irq, &c0_compare_irqaction);
  37. + }
  38. +
  39. + return 0;
  40. +}
  41. +
  42. +static int mips_state_shutdown(struct clock_event_device *evt)
  43. +{
  44. + if (cp0_timer_irq_installed) {
  45. + cp0_timer_irq_installed = 0;
  46. + remove_irq(evt->irq, &c0_compare_irqaction);
  47. + }
  48. +
  49. + return 0;
  50. +}
  51. +
  52. static int mips_next_event(unsigned long delta,
  53. struct clock_event_device *evt)
  54. {
  55. @@ -208,18 +228,21 @@ int r4k_clockevent_init(void)
  56. cd->rating = 300;
  57. cd->irq = irq;
  58. cd->cpumask = cpumask_of(cpu);
  59. + cd->set_state_shutdown = mips_state_shutdown;
  60. + cd->set_state_oneshot = mips_state_oneshot;
  61. cd->set_next_event = mips_next_event;
  62. cd->event_handler = mips_event_handler;
  63. clockevents_register_device(cd);
  64. +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
  65. if (cp0_timer_irq_installed)
  66. return 0;
  67. cp0_timer_irq_installed = 1;
  68. setup_irq(irq, &c0_compare_irqaction);
  69. -
  70. +#endif
  71. return 0;
  72. }