setup_oaks32r.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * linux/arch/m32r/kernel/setup_oaks32r.c
  3. *
  4. * Setup routines for OAKS32R Board
  5. *
  6. * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata,
  7. * Hitoshi Yamamoto, Mamoru Sakugawa
  8. */
  9. #include <linux/config.h>
  10. #include <linux/irq.h>
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <asm/system.h>
  14. #include <asm/m32r.h>
  15. #include <asm/io.h>
  16. #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
  17. icu_data_t icu_data[NR_IRQS];
  18. static void disable_oaks32r_irq(unsigned int irq)
  19. {
  20. unsigned long port, data;
  21. port = irq2port(irq);
  22. data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
  23. outl(data, port);
  24. }
  25. static void enable_oaks32r_irq(unsigned int irq)
  26. {
  27. unsigned long port, data;
  28. port = irq2port(irq);
  29. data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
  30. outl(data, port);
  31. }
  32. static void mask_and_ack_mappi(unsigned int irq)
  33. {
  34. disable_oaks32r_irq(irq);
  35. }
  36. static void end_oaks32r_irq(unsigned int irq)
  37. {
  38. enable_oaks32r_irq(irq);
  39. }
  40. static unsigned int startup_oaks32r_irq(unsigned int irq)
  41. {
  42. enable_oaks32r_irq(irq);
  43. return (0);
  44. }
  45. static void shutdown_oaks32r_irq(unsigned int irq)
  46. {
  47. unsigned long port;
  48. port = irq2port(irq);
  49. outl(M32R_ICUCR_ILEVEL7, port);
  50. }
  51. static struct hw_interrupt_type oaks32r_irq_type =
  52. {
  53. .typename = "OAKS32R-IRQ",
  54. .startup = startup_oaks32r_irq,
  55. .shutdown = shutdown_oaks32r_irq,
  56. .enable = enable_oaks32r_irq,
  57. .disable = disable_oaks32r_irq,
  58. .ack = mask_and_ack_mappi,
  59. .end = end_oaks32r_irq
  60. };
  61. void __init init_IRQ(void)
  62. {
  63. static int once = 0;
  64. if (once)
  65. return;
  66. else
  67. once++;
  68. #ifdef CONFIG_NE2000
  69. /* INT3 : LAN controller (RTL8019AS) */
  70. irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED;
  71. irq_desc[M32R_IRQ_INT3].handler = &oaks32r_irq_type;
  72. irq_desc[M32R_IRQ_INT3].action = 0;
  73. irq_desc[M32R_IRQ_INT3].depth = 1;
  74. icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  75. disable_oaks32r_irq(M32R_IRQ_INT3);
  76. #endif /* CONFIG_M32R_NE2000 */
  77. /* MFT2 : system timer */
  78. irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
  79. irq_desc[M32R_IRQ_MFT2].handler = &oaks32r_irq_type;
  80. irq_desc[M32R_IRQ_MFT2].action = 0;
  81. irq_desc[M32R_IRQ_MFT2].depth = 1;
  82. icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
  83. disable_oaks32r_irq(M32R_IRQ_MFT2);
  84. #ifdef CONFIG_SERIAL_M32R_SIO
  85. /* SIO0_R : uart receive data */
  86. irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
  87. irq_desc[M32R_IRQ_SIO0_R].handler = &oaks32r_irq_type;
  88. irq_desc[M32R_IRQ_SIO0_R].action = 0;
  89. irq_desc[M32R_IRQ_SIO0_R].depth = 1;
  90. icu_data[M32R_IRQ_SIO0_R].icucr = 0;
  91. disable_oaks32r_irq(M32R_IRQ_SIO0_R);
  92. /* SIO0_S : uart send data */
  93. irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
  94. irq_desc[M32R_IRQ_SIO0_S].handler = &oaks32r_irq_type;
  95. irq_desc[M32R_IRQ_SIO0_S].action = 0;
  96. irq_desc[M32R_IRQ_SIO0_S].depth = 1;
  97. icu_data[M32R_IRQ_SIO0_S].icucr = 0;
  98. disable_oaks32r_irq(M32R_IRQ_SIO0_S);
  99. /* SIO1_R : uart receive data */
  100. irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
  101. irq_desc[M32R_IRQ_SIO1_R].handler = &oaks32r_irq_type;
  102. irq_desc[M32R_IRQ_SIO1_R].action = 0;
  103. irq_desc[M32R_IRQ_SIO1_R].depth = 1;
  104. icu_data[M32R_IRQ_SIO1_R].icucr = 0;
  105. disable_oaks32r_irq(M32R_IRQ_SIO1_R);
  106. /* SIO1_S : uart send data */
  107. irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
  108. irq_desc[M32R_IRQ_SIO1_S].handler = &oaks32r_irq_type;
  109. irq_desc[M32R_IRQ_SIO1_S].action = 0;
  110. irq_desc[M32R_IRQ_SIO1_S].depth = 1;
  111. icu_data[M32R_IRQ_SIO1_S].icucr = 0;
  112. disable_oaks32r_irq(M32R_IRQ_SIO1_S);
  113. #endif /* CONFIG_SERIAL_M32R_SIO */
  114. }