irq.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2016 Imagination Technologies
  4. * Author: Paul Burton <[email protected]>
  5. */
  6. #include <linux/clk.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/clocksource.h>
  9. #include <linux/init.h>
  10. #include <linux/types.h>
  11. #include <asm/irq.h>
  12. #include <asm/mips-cps.h>
  13. #include <asm/time.h>
  14. int get_c0_fdc_int(void)
  15. {
  16. int mips_cpu_fdc_irq;
  17. if (mips_gic_present())
  18. mips_cpu_fdc_irq = gic_get_c0_fdc_int();
  19. else if (cpu_has_veic)
  20. panic("Unimplemented!");
  21. else if (cp0_fdc_irq >= 0)
  22. mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
  23. else
  24. mips_cpu_fdc_irq = -1;
  25. return mips_cpu_fdc_irq;
  26. }
  27. int get_c0_perfcount_int(void)
  28. {
  29. int mips_cpu_perf_irq;
  30. if (mips_gic_present())
  31. mips_cpu_perf_irq = gic_get_c0_perfcount_int();
  32. else if (cpu_has_veic)
  33. panic("Unimplemented!");
  34. else if (cp0_perfcount_irq >= 0)
  35. mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
  36. else
  37. mips_cpu_perf_irq = -1;
  38. return mips_cpu_perf_irq;
  39. }
  40. unsigned int get_c0_compare_int(void)
  41. {
  42. int mips_cpu_timer_irq;
  43. if (mips_gic_present())
  44. mips_cpu_timer_irq = gic_get_c0_compare_int();
  45. else if (cpu_has_veic)
  46. panic("Unimplemented!");
  47. else
  48. mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
  49. return mips_cpu_timer_irq;
  50. }