irq_cpu.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * First-level interrupt controller model for Hexagon.
  3. *
  4. * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 and
  8. * only version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA.
  19. */
  20. #include <linux/interrupt.h>
  21. #include <asm/irq.h>
  22. #include <asm/hexagon_vm.h>
  23. static void mask_irq(struct irq_data *data)
  24. {
  25. __vmintop_locdis((long) data->irq);
  26. }
  27. static void mask_irq_num(unsigned int irq)
  28. {
  29. __vmintop_locdis((long) irq);
  30. }
  31. static void unmask_irq(struct irq_data *data)
  32. {
  33. __vmintop_locen((long) data->irq);
  34. }
  35. /* This is actually all we need for handle_fasteoi_irq */
  36. static void eoi_irq(struct irq_data *data)
  37. {
  38. __vmintop_globen((long) data->irq);
  39. }
  40. /* Power mamangement wake call. We don't need this, however,
  41. * if this is absent, then an -ENXIO error is returned to the
  42. * msm_serial driver, and it fails to correctly initialize.
  43. * This is a bug in the msm_serial driver, but, for now, we
  44. * work around it here, by providing this bogus handler.
  45. * XXX FIXME!!! remove this when msm_serial is fixed.
  46. */
  47. static int set_wake(struct irq_data *data, unsigned int on)
  48. {
  49. return 0;
  50. }
  51. static struct irq_chip hexagon_irq_chip = {
  52. .name = "HEXAGON",
  53. .irq_mask = mask_irq,
  54. .irq_unmask = unmask_irq,
  55. .irq_set_wake = set_wake,
  56. .irq_eoi = eoi_irq
  57. };
  58. /**
  59. * The hexagon core comes with a first-level interrupt controller
  60. * with 32 total possible interrupts. When the core is embedded
  61. * into different systems/platforms, it is typically wrapped by
  62. * macro cells that provide one or more second-level interrupt
  63. * controllers that are cascaded into one or more of the first-level
  64. * interrupts handled here. The precise wiring of these other
  65. * irqs varies from platform to platform, and are set up & configured
  66. * in the platform-specific files.
  67. *
  68. * The first-level interrupt controller is wrapped by the VM, which
  69. * virtualizes the interrupt controller for us. It provides a very
  70. * simple, fast & efficient API, and so the fasteoi handler is
  71. * appropriate for this case.
  72. */
  73. void __init init_IRQ(void)
  74. {
  75. int irq;
  76. for (irq = 0; irq < HEXAGON_CPUINTS; irq++) {
  77. mask_irq_num(irq);
  78. irq_set_chip_and_handler(irq, &hexagon_irq_chip,
  79. handle_fasteoi_irq);
  80. }
  81. }