irq.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * linux/arch/sh/boards/se/7780/irq.c
  3. *
  4. * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
  5. *
  6. * Hitachi UL SolutionEngine 7780 Support.
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/irq.h>
  14. #include <linux/interrupt.h>
  15. #include <asm/irq.h>
  16. #include <asm/io.h>
  17. #include <asm/se7780.h>
  18. #define INTC_INTMSK0 0xFFD00044
  19. #define INTC_INTMSKCLR0 0xFFD00064
  20. static void disable_se7780_irq(unsigned int irq)
  21. {
  22. struct intc2_data *p = get_irq_chip_data(irq);
  23. ctrl_outl(1 << p->msk_shift, INTC_INTMSK0 + p->msk_offset);
  24. }
  25. static void enable_se7780_irq(unsigned int irq)
  26. {
  27. struct intc2_data *p = get_irq_chip_data(irq);
  28. ctrl_outl(1 << p->msk_shift, INTC_INTMSKCLR0 + p->msk_offset);
  29. }
  30. static struct irq_chip se7780_irq_chip __read_mostly = {
  31. .name = "SE7780",
  32. .mask = disable_se7780_irq,
  33. .unmask = enable_se7780_irq,
  34. .mask_ack = disable_se7780_irq,
  35. };
  36. static struct intc2_data intc2_irq_table[] = {
  37. { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT1 */
  38. { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT2 */
  39. { 6, 0, 29, 0, 29, 3 }, /* daughter board EXTINT3 */
  40. { 8, 0, 28, 0, 28, 3 }, /* SMC 91C111 (LAN) */
  41. { 10, 0, 27, 0, 27, 3 }, /* daughter board EXTINT4 */
  42. { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT5 */
  43. { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT6 */
  44. { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT7 */
  45. { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT8 */
  46. { 0 , 0, 24, 0, 24, 3 }, /* SM501 */
  47. };
  48. /*
  49. * Initialize IRQ setting
  50. */
  51. void __init init_se7780_IRQ(void)
  52. {
  53. int i ;
  54. /* enable all interrupt at FPGA */
  55. ctrl_outw(0, FPGA_INTMSK1);
  56. /* mask SM501 interrupt */
  57. ctrl_outw((ctrl_inw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1);
  58. /* enable all interrupt at FPGA */
  59. ctrl_outw(0, FPGA_INTMSK2);
  60. /* set FPGA INTSEL register */
  61. /* FPGA + 0x06 */
  62. ctrl_outw( ((IRQPIN_SM501 << IRQPOS_SM501) |
  63. (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1);
  64. /* FPGA + 0x08 */
  65. ctrl_outw(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) |
  66. (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) |
  67. (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) |
  68. (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2);
  69. /* FPGA + 0x0A */
  70. ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
  71. for (i = 0; i < ARRAY_SIZE(intc2_irq_table); i++) {
  72. disable_irq_nosync(intc2_irq_table[i].irq);
  73. set_irq_chip_and_handler_name( intc2_irq_table[i].irq, &se7780_irq_chip,
  74. handle_level_irq, "level");
  75. set_irq_chip_data( intc2_irq_table[i].irq, &intc2_irq_table[i] );
  76. disable_se7780_irq(intc2_irq_table[i].irq);
  77. }
  78. }