irq.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Renesas Solutions Highlander R7780RP-1 Support.
  3. *
  4. * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
  5. * Copyright (C) 2006 Paul Mundt
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/irq.h>
  13. #include <asm/io.h>
  14. #ifdef CONFIG_SH_R7780MP
  15. static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
  16. #else
  17. static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0};
  18. #endif
  19. static void enable_r7780rp_irq(unsigned int irq)
  20. {
  21. /* Set priority in IPR back to original value */
  22. ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
  23. }
  24. static void disable_r7780rp_irq(unsigned int irq)
  25. {
  26. /* Set the priority in IPR to 0 */
  27. ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])),
  28. IRLCNTR1);
  29. }
  30. static struct irq_chip r7780rp_irq_chip __read_mostly = {
  31. .name = "r7780rp",
  32. .mask = disable_r7780rp_irq,
  33. .unmask = enable_r7780rp_irq,
  34. .mask_ack = disable_r7780rp_irq,
  35. };
  36. /*
  37. * Initialize IRQ setting
  38. */
  39. void __init init_r7780rp_IRQ(void)
  40. {
  41. int i;
  42. for (i = 0; i < 15; i++) {
  43. disable_irq_nosync(i);
  44. set_irq_chip_and_handler(i, &r7780rp_irq_chip,
  45. handle_level_irq);
  46. enable_r7780rp_irq(i);
  47. }
  48. }