irq.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2011-12 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. */
  9. #include <linux/interrupt.h>
  10. #include <linux/irqchip.h>
  11. #include <asm/mach_desc.h>
  12. /*
  13. * Late Interrupt system init called from start_kernel for Boot CPU only
  14. *
  15. * Since slab must already be initialized, platforms can start doing any
  16. * needed request_irq( )s
  17. */
  18. void __init init_IRQ(void)
  19. {
  20. /* Any external intc can be setup here */
  21. if (machine_desc->init_irq)
  22. machine_desc->init_irq();
  23. /* process the entire interrupt tree in one go */
  24. irqchip_init();
  25. #ifdef CONFIG_SMP
  26. /* Master CPU can initialize it's side of IPI */
  27. if (machine_desc->init_smp)
  28. machine_desc->init_smp(smp_processor_id());
  29. #endif
  30. }
  31. /*
  32. * "C" Entry point for any ARC ISR, called from low level vector handler
  33. * @irq is the vector number read from ICAUSE reg of on-chip intc
  34. */
  35. void arch_do_IRQ(unsigned int irq, struct pt_regs *regs)
  36. {
  37. struct pt_regs *old_regs = set_irq_regs(regs);
  38. irq_enter();
  39. generic_handle_irq(irq);
  40. irq_exit();
  41. set_irq_regs(old_regs);
  42. }
  43. void arc_request_percpu_irq(int irq, int cpu,
  44. irqreturn_t (*isr)(int irq, void *dev),
  45. const char *irq_nm,
  46. void *percpu_dev)
  47. {
  48. /* Boot cpu calls request, all call enable */
  49. if (!cpu) {
  50. int rc;
  51. /*
  52. * These 2 calls are essential to making percpu IRQ APIs work
  53. * Ideally these details could be hidden in irq chip map function
  54. * but the issue is IPIs IRQs being static (non-DT) and platform
  55. * specific, so we can't identify them there.
  56. */
  57. irq_set_percpu_devid(irq);
  58. irq_modify_status(irq, IRQ_NOAUTOEN, 0); /* @irq, @clr, @set */
  59. rc = request_percpu_irq(irq, isr, irq_nm, percpu_dev);
  60. if (rc)
  61. panic("Percpu IRQ request failed for %d\n", irq);
  62. }
  63. enable_percpu_irq(irq, 0);
  64. }