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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From 1be15a87eea5f26fb24b6aac332530cd3e2d984e Mon Sep 17 00:00:00 2001
  2. From: John Crispin <[email protected]>
  3. Date: Sun, 14 Jul 2013 23:08:11 +0200
  4. Subject: [PATCH 100/133] MIPS: use set_mode() to enable/disable the cevt-r4k
  5. irq
  6. Signed-off-by: John Crispin <[email protected]>
  7. ---
  8. arch/mips/kernel/cevt-r4k.c | 39 ++++++++++++++++++++++++++-------------
  9. 1 file changed, 26 insertions(+), 13 deletions(-)
  10. --- a/arch/mips/kernel/cevt-r4k.c
  11. +++ b/arch/mips/kernel/cevt-r4k.c
  12. @@ -38,12 +38,6 @@ static int mips_next_event(unsigned long
  13. #endif /* CONFIG_MIPS_MT_SMTC */
  14. -void mips_set_clock_mode(enum clock_event_mode mode,
  15. - struct clock_event_device *evt)
  16. -{
  17. - /* Nothing to do ... */
  18. -}
  19. -
  20. DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
  21. int cp0_timer_irq_installed;
  22. @@ -90,9 +84,38 @@ struct irqaction c0_compare_irqaction =
  23. .name = "timer",
  24. };
  25. +void mips_set_clock_mode(enum clock_event_mode mode,
  26. + struct clock_event_device *evt)
  27. +{
  28. +#ifdef CONFIG_CEVT_SYSTICK_QUIRK
  29. + switch (mode) {
  30. + case CLOCK_EVT_MODE_ONESHOT:
  31. + if (cp0_timer_irq_installed)
  32. + break;
  33. +
  34. + cp0_timer_irq_installed = 1;
  35. +
  36. + setup_irq(evt->irq, &c0_compare_irqaction);
  37. + break;
  38. +
  39. + case CLOCK_EVT_MODE_SHUTDOWN:
  40. + if (!cp0_timer_irq_installed)
  41. + break;
  42. +
  43. + cp0_timer_irq_installed = 0;
  44. + free_irq(evt->irq, &c0_compare_irqaction);
  45. + break;
  46. +
  47. + default:
  48. + pr_err("Unhandeled mips clock_mode\n");
  49. + break;
  50. + }
  51. +#endif
  52. +}
  53. void mips_event_handler(struct clock_event_device *dev)
  54. {
  55. +
  56. }
  57. /*
  58. @@ -215,12 +238,14 @@ int __cpuinit r4k_clockevent_init(void)
  59. #endif
  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. }