ints.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * linux/arch/$(ARCH)/platform/$(PLATFORM)/ints.c
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file COPYING in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (c) 2000 Michael Leslie <mleslie@lineo.com>
  9. * Copyright (c) 1996 Roman Zippel
  10. * Copyright (c) 1999 D. Jeff Dionne <jeff@uclinux.org>
  11. */
  12. #include <linux/types.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/irq.h>
  17. #include <asm/traps.h>
  18. #include <asm/machdep.h>
  19. #include <asm/m68360.h>
  20. /* from quicc/commproc.c: */
  21. extern QUICC *pquicc;
  22. extern void cpm_interrupt_init(void);
  23. #define INTERNAL_IRQS (96)
  24. /* assembler routines */
  25. asmlinkage void system_call(void);
  26. asmlinkage void buserr(void);
  27. asmlinkage void trap(void);
  28. asmlinkage void bad_interrupt(void);
  29. asmlinkage void inthandler(void);
  30. extern void *_ramvec[];
  31. /* The number of spurious interrupts */
  32. volatile unsigned int num_spurious;
  33. static void intc_irq_unmask(unsigned int irq)
  34. {
  35. pquicc->intr_cimr |= (1 << irq);
  36. }
  37. static void intc_irq_mask(unsigned int irq)
  38. {
  39. pquicc->intr_cimr &= ~(1 << irq);
  40. }
  41. static void intc_irq_ack(unsigned int irq)
  42. {
  43. pquicc->intr_cisr = (1 << irq);
  44. }
  45. static struct irq_chip intc_irq_chip = {
  46. .name = "M68K-INTC",
  47. .mask = intc_irq_mask,
  48. .unmask = intc_irq_unmask,
  49. .ack = intc_irq_ack,
  50. };
  51. /*
  52. * This function should be called during kernel startup to initialize
  53. * the vector table.
  54. */
  55. void init_IRQ(void)
  56. {
  57. int i;
  58. int vba = (CPM_VECTOR_BASE<<4);
  59. /* set up the vectors */
  60. _ramvec[2] = buserr;
  61. _ramvec[3] = trap;
  62. _ramvec[4] = trap;
  63. _ramvec[5] = trap;
  64. _ramvec[6] = trap;
  65. _ramvec[7] = trap;
  66. _ramvec[8] = trap;
  67. _ramvec[9] = trap;
  68. _ramvec[10] = trap;
  69. _ramvec[11] = trap;
  70. _ramvec[12] = trap;
  71. _ramvec[13] = trap;
  72. _ramvec[14] = trap;
  73. _ramvec[15] = trap;
  74. _ramvec[32] = system_call;
  75. _ramvec[33] = trap;
  76. cpm_interrupt_init();
  77. /* set up CICR for vector base address and irq level */
  78. /* irl = 4, hp = 1f - see MC68360UM p 7-377 */
  79. pquicc->intr_cicr = 0x00e49f00 | vba;
  80. /* CPM interrupt vectors: (p 7-376) */
  81. _ramvec[vba+CPMVEC_ERROR] = bad_interrupt; /* Error */
  82. _ramvec[vba+CPMVEC_PIO_PC11] = inthandler; /* pio - pc11 */
  83. _ramvec[vba+CPMVEC_PIO_PC10] = inthandler; /* pio - pc10 */
  84. _ramvec[vba+CPMVEC_SMC2] = inthandler; /* smc2/pip */
  85. _ramvec[vba+CPMVEC_SMC1] = inthandler; /* smc1 */
  86. _ramvec[vba+CPMVEC_SPI] = inthandler; /* spi */
  87. _ramvec[vba+CPMVEC_PIO_PC9] = inthandler; /* pio - pc9 */
  88. _ramvec[vba+CPMVEC_TIMER4] = inthandler; /* timer 4 */
  89. _ramvec[vba+CPMVEC_RESERVED1] = inthandler; /* reserved */
  90. _ramvec[vba+CPMVEC_PIO_PC8] = inthandler; /* pio - pc8 */
  91. _ramvec[vba+CPMVEC_PIO_PC7] = inthandler; /* pio - pc7 */
  92. _ramvec[vba+CPMVEC_PIO_PC6] = inthandler; /* pio - pc6 */
  93. _ramvec[vba+CPMVEC_TIMER3] = inthandler; /* timer 3 */
  94. _ramvec[vba+CPMVEC_RISCTIMER] = inthandler; /* reserved */
  95. _ramvec[vba+CPMVEC_PIO_PC5] = inthandler; /* pio - pc5 */
  96. _ramvec[vba+CPMVEC_PIO_PC4] = inthandler; /* pio - pc4 */
  97. _ramvec[vba+CPMVEC_RESERVED2] = inthandler; /* reserved */
  98. _ramvec[vba+CPMVEC_RISCTIMER] = inthandler; /* timer table */
  99. _ramvec[vba+CPMVEC_TIMER2] = inthandler; /* timer 2 */
  100. _ramvec[vba+CPMVEC_RESERVED3] = inthandler; /* reserved */
  101. _ramvec[vba+CPMVEC_IDMA2] = inthandler; /* idma 2 */
  102. _ramvec[vba+CPMVEC_IDMA1] = inthandler; /* idma 1 */
  103. _ramvec[vba+CPMVEC_SDMA_CB_ERR] = inthandler; /* sdma channel bus error */
  104. _ramvec[vba+CPMVEC_PIO_PC3] = inthandler; /* pio - pc3 */
  105. _ramvec[vba+CPMVEC_PIO_PC2] = inthandler; /* pio - pc2 */
  106. /* _ramvec[vba+CPMVEC_TIMER1] = cpm_isr_timer1; */ /* timer 1 */
  107. _ramvec[vba+CPMVEC_TIMER1] = inthandler; /* timer 1 */
  108. _ramvec[vba+CPMVEC_PIO_PC1] = inthandler; /* pio - pc1 */
  109. _ramvec[vba+CPMVEC_SCC4] = inthandler; /* scc 4 */
  110. _ramvec[vba+CPMVEC_SCC3] = inthandler; /* scc 3 */
  111. _ramvec[vba+CPMVEC_SCC2] = inthandler; /* scc 2 */
  112. _ramvec[vba+CPMVEC_SCC1] = inthandler; /* scc 1 */
  113. _ramvec[vba+CPMVEC_PIO_PC0] = inthandler; /* pio - pc0 */
  114. /* turn off all CPM interrupts */
  115. pquicc->intr_cimr = 0x00000000;
  116. for (i = 0; (i < NR_IRQS); i++) {
  117. irq_desc[i].status = IRQ_DISABLED;
  118. irq_desc[i].action = NULL;
  119. irq_desc[i].depth = 1;
  120. irq_desc[i].chip = &intc_irq_chip;
  121. }
  122. }