ints.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. static void intc_irq_unmask(struct irq_data *d)
  31. {
  32. pquicc->intr_cimr |= (1 << d->irq);
  33. }
  34. static void intc_irq_mask(struct irq_data *d)
  35. {
  36. pquicc->intr_cimr &= ~(1 << d->irq);
  37. }
  38. static void intc_irq_ack(struct irq_data *d)
  39. {
  40. pquicc->intr_cisr = (1 << d->irq);
  41. }
  42. static struct irq_chip intc_irq_chip = {
  43. .name = "M68K-INTC",
  44. .irq_mask = intc_irq_mask,
  45. .irq_unmask = intc_irq_unmask,
  46. .irq_ack = intc_irq_ack,
  47. };
  48. /*
  49. * This function should be called during kernel startup to initialize
  50. * the vector table.
  51. */
  52. void __init trap_init(void)
  53. {
  54. int vba = (CPM_VECTOR_BASE<<4);
  55. /* set up the vectors */
  56. _ramvec[2] = buserr;
  57. _ramvec[3] = trap;
  58. _ramvec[4] = trap;
  59. _ramvec[5] = trap;
  60. _ramvec[6] = trap;
  61. _ramvec[7] = trap;
  62. _ramvec[8] = trap;
  63. _ramvec[9] = trap;
  64. _ramvec[10] = trap;
  65. _ramvec[11] = trap;
  66. _ramvec[12] = trap;
  67. _ramvec[13] = trap;
  68. _ramvec[14] = trap;
  69. _ramvec[15] = trap;
  70. _ramvec[32] = system_call;
  71. _ramvec[33] = trap;
  72. cpm_interrupt_init();
  73. /* set up CICR for vector base address and irq level */
  74. /* irl = 4, hp = 1f - see MC68360UM p 7-377 */
  75. pquicc->intr_cicr = 0x00e49f00 | vba;
  76. /* CPM interrupt vectors: (p 7-376) */
  77. _ramvec[vba+CPMVEC_ERROR] = bad_interrupt; /* Error */
  78. _ramvec[vba+CPMVEC_PIO_PC11] = inthandler; /* pio - pc11 */
  79. _ramvec[vba+CPMVEC_PIO_PC10] = inthandler; /* pio - pc10 */
  80. _ramvec[vba+CPMVEC_SMC2] = inthandler; /* smc2/pip */
  81. _ramvec[vba+CPMVEC_SMC1] = inthandler; /* smc1 */
  82. _ramvec[vba+CPMVEC_SPI] = inthandler; /* spi */
  83. _ramvec[vba+CPMVEC_PIO_PC9] = inthandler; /* pio - pc9 */
  84. _ramvec[vba+CPMVEC_TIMER4] = inthandler; /* timer 4 */
  85. _ramvec[vba+CPMVEC_RESERVED1] = inthandler; /* reserved */
  86. _ramvec[vba+CPMVEC_PIO_PC8] = inthandler; /* pio - pc8 */
  87. _ramvec[vba+CPMVEC_PIO_PC7] = inthandler; /* pio - pc7 */
  88. _ramvec[vba+CPMVEC_PIO_PC6] = inthandler; /* pio - pc6 */
  89. _ramvec[vba+CPMVEC_TIMER3] = inthandler; /* timer 3 */
  90. _ramvec[vba+CPMVEC_PIO_PC5] = inthandler; /* pio - pc5 */
  91. _ramvec[vba+CPMVEC_PIO_PC4] = inthandler; /* pio - pc4 */
  92. _ramvec[vba+CPMVEC_RESERVED2] = inthandler; /* reserved */
  93. _ramvec[vba+CPMVEC_RISCTIMER] = inthandler; /* timer table */
  94. _ramvec[vba+CPMVEC_TIMER2] = inthandler; /* timer 2 */
  95. _ramvec[vba+CPMVEC_RESERVED3] = inthandler; /* reserved */
  96. _ramvec[vba+CPMVEC_IDMA2] = inthandler; /* idma 2 */
  97. _ramvec[vba+CPMVEC_IDMA1] = inthandler; /* idma 1 */
  98. _ramvec[vba+CPMVEC_SDMA_CB_ERR] = inthandler; /* sdma channel bus error */
  99. _ramvec[vba+CPMVEC_PIO_PC3] = inthandler; /* pio - pc3 */
  100. _ramvec[vba+CPMVEC_PIO_PC2] = inthandler; /* pio - pc2 */
  101. /* _ramvec[vba+CPMVEC_TIMER1] = cpm_isr_timer1; */ /* timer 1 */
  102. _ramvec[vba+CPMVEC_TIMER1] = inthandler; /* timer 1 */
  103. _ramvec[vba+CPMVEC_PIO_PC1] = inthandler; /* pio - pc1 */
  104. _ramvec[vba+CPMVEC_SCC4] = inthandler; /* scc 4 */
  105. _ramvec[vba+CPMVEC_SCC3] = inthandler; /* scc 3 */
  106. _ramvec[vba+CPMVEC_SCC2] = inthandler; /* scc 2 */
  107. _ramvec[vba+CPMVEC_SCC1] = inthandler; /* scc 1 */
  108. _ramvec[vba+CPMVEC_PIO_PC0] = inthandler; /* pio - pc0 */
  109. /* turn off all CPM interrupts */
  110. pquicc->intr_cimr = 0x00000000;
  111. }
  112. void init_IRQ(void)
  113. {
  114. int i;
  115. for (i = 0; (i < NR_IRQS); i++) {
  116. irq_set_chip(i, &intc_irq_chip);
  117. irq_set_handler(i, handle_level_irq);
  118. }
  119. }