irq.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * linux/arch/sh/boards/renesas/rts7751r2d/irq.c
  3. *
  4. * Copyright (C) 2000 Kazumoto Kojima
  5. *
  6. * Renesas Technology Sales RTS7751R2D Support.
  7. *
  8. * Modified for RTS7751R2D by
  9. * Atom Create Engineering Co., Ltd. 2002.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/irq.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/io.h>
  16. #include <asm/rts7751r2d.h>
  17. #if defined(CONFIG_RTS7751R2D_REV11)
  18. static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
  19. #else
  20. static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
  21. #endif
  22. extern int voyagergx_irq_demux(int irq);
  23. extern void setup_voyagergx_irq(void);
  24. static void enable_rts7751r2d_irq(unsigned int irq)
  25. {
  26. /* Set priority in IPR back to original value */
  27. ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
  28. }
  29. static void disable_rts7751r2d_irq(unsigned int irq)
  30. {
  31. /* Set the priority in IPR to 0 */
  32. ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])),
  33. IRLCNTR1);
  34. }
  35. int rts7751r2d_irq_demux(int irq)
  36. {
  37. return voyagergx_irq_demux(irq);
  38. }
  39. static struct irq_chip rts7751r2d_irq_chip __read_mostly = {
  40. .name = "rts7751r2d",
  41. .mask = disable_rts7751r2d_irq,
  42. .unmask = enable_rts7751r2d_irq,
  43. .mask_ack = disable_rts7751r2d_irq,
  44. };
  45. /*
  46. * Initialize IRQ setting
  47. */
  48. void __init init_rts7751r2d_IRQ(void)
  49. {
  50. int i;
  51. /* IRL0=KEY Input
  52. * IRL1=Ethernet
  53. * IRL2=CF Card
  54. * IRL3=CF Card Insert
  55. * IRL4=PCMCIA
  56. * IRL5=VOYAGER
  57. * IRL6=RTC Alarm
  58. * IRL7=RTC Timer
  59. * IRL8=SD Card
  60. * IRL9=PCI Slot #1
  61. * IRL10=PCI Slot #2
  62. * IRL11=Extention #0
  63. * IRL12=Extention #1
  64. * IRL13=Extention #2
  65. * IRL14=Extention #3
  66. */
  67. for (i=0; i<15; i++) {
  68. disable_irq_nosync(i);
  69. set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip,
  70. handle_level_irq, "level");
  71. enable_rts7751r2d_irq(i);
  72. }
  73. setup_voyagergx_irq();
  74. }