irq.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * arch/mips/ddb5074/irq.c -- NEC DDB Vrc-5074 interrupt routines
  3. *
  4. * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
  5. * Sony Software Development Center Europe (SDCE), Brussels
  6. */
  7. #include <linux/init.h>
  8. #include <linux/irq.h>
  9. #include <linux/signal.h>
  10. #include <linux/sched.h>
  11. #include <linux/types.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/ioport.h>
  14. #include <asm/i8259.h>
  15. #include <asm/io.h>
  16. #include <asm/irq_cpu.h>
  17. #include <asm/ptrace.h>
  18. #include <asm/nile4.h>
  19. #include <asm/ddb5xxx/ddb5xxx.h>
  20. #include <asm/ddb5xxx/ddb5074.h>
  21. extern asmlinkage void ddbIRQ(void);
  22. static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
  23. #define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */
  24. #define M1543_PNP_INDEX 0x03f0 /* PnP Index Port */
  25. #define M1543_PNP_DATA 0x03f1 /* PnP Data Port */
  26. #define M1543_PNP_ALT_CONFIG 0x0370 /* Alternative PnP Config Port */
  27. #define M1543_PNP_ALT_INDEX 0x0370 /* Alternative PnP Index Port */
  28. #define M1543_PNP_ALT_DATA 0x0371 /* Alternative PnP Data Port */
  29. #define M1543_INT1_MASTER_CTRL 0x0020 /* INT_1 (master) Control Register */
  30. #define M1543_INT1_MASTER_MASK 0x0021 /* INT_1 (master) Mask Register */
  31. #define M1543_INT1_SLAVE_CTRL 0x00a0 /* INT_1 (slave) Control Register */
  32. #define M1543_INT1_SLAVE_MASK 0x00a1 /* INT_1 (slave) Mask Register */
  33. #define M1543_INT1_MASTER_ELCR 0x04d0 /* INT_1 (master) Edge/Level Control */
  34. #define M1543_INT1_SLAVE_ELCR 0x04d1 /* INT_1 (slave) Edge/Level Control */
  35. static void m1543_irq_setup(void)
  36. {
  37. /*
  38. * The ALI M1543 has 13 interrupt inputs, IRQ1..IRQ13. Not all
  39. * the possible IO sources in the M1543 are in use by us. We will
  40. * use the following mapping:
  41. *
  42. * IRQ1 - keyboard (default set by M1543)
  43. * IRQ3 - reserved for UART B (default set by M1543) (note that
  44. * the schematics for the DDB Vrc-5074 board seem to
  45. * indicate that IRQ3 is connected to the DS1386
  46. * watchdog timer interrupt output so we might have
  47. * a conflict)
  48. * IRQ4 - reserved for UART A (default set by M1543)
  49. * IRQ5 - parallel (default set by M1543)
  50. * IRQ8 - DS1386 time of day (RTC) interrupt
  51. * IRQ12 - mouse
  52. */
  53. /*
  54. * Assing mouse interrupt to IRQ12
  55. */
  56. /* Enter configuration mode */
  57. outb(0x51, M1543_PNP_CONFIG);
  58. outb(0x23, M1543_PNP_CONFIG);
  59. /* Select logical device 7 (Keyboard) */
  60. outb(0x07, M1543_PNP_INDEX);
  61. outb(0x07, M1543_PNP_DATA);
  62. /* Select IRQ12 */
  63. outb(0x72, M1543_PNP_INDEX);
  64. outb(0x0c, M1543_PNP_DATA);
  65. outb(0x30, M1543_PNP_INDEX);
  66. printk("device 7, 0x30: %02x\n",inb(M1543_PNP_DATA));
  67. outb(0x70, M1543_PNP_INDEX);
  68. printk("device 7, 0x70: %02x\n",inb(M1543_PNP_DATA));
  69. /* Leave configration mode */
  70. outb(0xbb, M1543_PNP_CONFIG);
  71. }
  72. void ddb_local0_irqdispatch(struct pt_regs *regs)
  73. {
  74. u32 mask;
  75. int nile4_irq;
  76. mask = nile4_get_irq_stat(0);
  77. /* Handle the timer interrupt first */
  78. #if 0
  79. if (mask & (1 << NILE4_INT_GPT)) {
  80. do_IRQ(nile4_to_irq(NILE4_INT_GPT), regs);
  81. mask &= ~(1 << NILE4_INT_GPT);
  82. }
  83. #endif
  84. for (nile4_irq = 0; mask; nile4_irq++, mask >>= 1)
  85. if (mask & 1) {
  86. if (nile4_irq == NILE4_INT_INTE) {
  87. int i8259_irq;
  88. nile4_clear_irq(NILE4_INT_INTE);
  89. i8259_irq = nile4_i8259_iack();
  90. do_IRQ(i8259_irq, regs);
  91. } else
  92. do_IRQ(nile4_to_irq(nile4_irq), regs);
  93. }
  94. }
  95. void ddb_local1_irqdispatch(void)
  96. {
  97. printk("ddb_local1_irqdispatch called\n");
  98. }
  99. void ddb_buserror_irq(void)
  100. {
  101. printk("ddb_buserror_irq called\n");
  102. }
  103. void ddb_8254timer_irq(void)
  104. {
  105. printk("ddb_8254timer_irq called\n");
  106. }
  107. void __init arch_init_irq(void)
  108. {
  109. /* setup cascade interrupts */
  110. setup_irq(NILE4_IRQ_BASE + NILE4_INT_INTE, &irq_cascade);
  111. setup_irq(CPU_IRQ_BASE + CPU_NILE4_CASCADE, &irq_cascade);
  112. set_except_vector(0, ddbIRQ);
  113. nile4_irq_setup(NILE4_IRQ_BASE);
  114. m1543_irq_setup();
  115. init_i8259_irqs();
  116. printk("CPU_IRQ_BASE: %d\n",CPU_IRQ_BASE);
  117. mips_cpu_irq_init(CPU_IRQ_BASE);
  118. printk("enabling 8259 cascade\n");
  119. ddb5074_led_hex(0);
  120. /* Enable the interrupt cascade */
  121. nile4_enable_irq(NILE4_IRQ_BASE+IRQ_I8259_CASCADE);
  122. }