irq.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2016 Imagination Technologies
  3. * Author: Paul Burton <paul.burton@imgtec.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #include <linux/clk.h>
  11. #include <linux/clk-provider.h>
  12. #include <linux/clocksource.h>
  13. #include <linux/init.h>
  14. #include <linux/irqchip/mips-gic.h>
  15. #include <linux/types.h>
  16. #include <asm/irq.h>
  17. int get_c0_fdc_int(void)
  18. {
  19. int mips_cpu_fdc_irq;
  20. if (cpu_has_veic)
  21. panic("Unimplemented!");
  22. else if (gic_present)
  23. mips_cpu_fdc_irq = gic_get_c0_fdc_int();
  24. else if (cp0_fdc_irq >= 0)
  25. mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
  26. else
  27. mips_cpu_fdc_irq = -1;
  28. return mips_cpu_fdc_irq;
  29. }
  30. int get_c0_perfcount_int(void)
  31. {
  32. int mips_cpu_perf_irq;
  33. if (cpu_has_veic)
  34. panic("Unimplemented!");
  35. else if (gic_present)
  36. mips_cpu_perf_irq = gic_get_c0_perfcount_int();
  37. else if (cp0_perfcount_irq >= 0)
  38. mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
  39. else
  40. mips_cpu_perf_irq = -1;
  41. return mips_cpu_perf_irq;
  42. }
  43. unsigned int get_c0_compare_int(void)
  44. {
  45. int mips_cpu_timer_irq;
  46. if (cpu_has_veic)
  47. panic("Unimplemented!");
  48. else if (gic_present)
  49. mips_cpu_timer_irq = gic_get_c0_compare_int();
  50. else
  51. mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
  52. return mips_cpu_timer_irq;
  53. }