setup_oaks32r.c 3.4 KB

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