setup.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * linux/arch/m32r/platforms/oaks32r/setup.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/m32r.h>
  13. #include <asm/io.h>
  14. #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
  15. icu_data_t icu_data[NR_IRQS];
  16. static void disable_oaks32r_irq(unsigned int irq)
  17. {
  18. unsigned long port, data;
  19. port = irq2port(irq);
  20. data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
  21. outl(data, port);
  22. }
  23. static void enable_oaks32r_irq(unsigned int irq)
  24. {
  25. unsigned long port, data;
  26. port = irq2port(irq);
  27. data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
  28. outl(data, port);
  29. }
  30. static void mask_oaks32r(struct irq_data *data)
  31. {
  32. disable_oaks32r_irq(data->irq);
  33. }
  34. static void unmask_oaks32r(struct irq_data *data)
  35. {
  36. enable_oaks32r_irq(data->irq);
  37. }
  38. static void shutdown_oaks32r(struct irq_data *data)
  39. {
  40. unsigned long port;
  41. port = irq2port(data->irq);
  42. outl(M32R_ICUCR_ILEVEL7, port);
  43. }
  44. static struct irq_chip oaks32r_irq_type =
  45. {
  46. .name = "OAKS32R-IRQ",
  47. .irq_shutdown = shutdown_oaks32r,
  48. .irq_mask = mask_oaks32r,
  49. .irq_unmask = unmask_oaks32r,
  50. };
  51. void __init init_IRQ(void)
  52. {
  53. static int once = 0;
  54. if (once)
  55. return;
  56. else
  57. once++;
  58. #ifdef CONFIG_NE2000
  59. /* INT3 : LAN controller (RTL8019AS) */
  60. irq_set_chip_and_handler(M32R_IRQ_INT3, &oaks32r_irq_type,
  61. handle_level_irq);
  62. icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  63. disable_oaks32r_irq(M32R_IRQ_INT3);
  64. #endif /* CONFIG_M32R_NE2000 */
  65. /* MFT2 : system timer */
  66. irq_set_chip_and_handler(M32R_IRQ_MFT2, &oaks32r_irq_type,
  67. handle_level_irq);
  68. icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
  69. disable_oaks32r_irq(M32R_IRQ_MFT2);
  70. #ifdef CONFIG_SERIAL_M32R_SIO
  71. /* SIO0_R : uart receive data */
  72. irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &oaks32r_irq_type,
  73. handle_level_irq);
  74. icu_data[M32R_IRQ_SIO0_R].icucr = 0;
  75. disable_oaks32r_irq(M32R_IRQ_SIO0_R);
  76. /* SIO0_S : uart send data */
  77. irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &oaks32r_irq_type,
  78. handle_level_irq);
  79. icu_data[M32R_IRQ_SIO0_S].icucr = 0;
  80. disable_oaks32r_irq(M32R_IRQ_SIO0_S);
  81. /* SIO1_R : uart receive data */
  82. irq_set_chip_and_handler(M32R_IRQ_SIO1_R, &oaks32r_irq_type,
  83. handle_level_irq);
  84. icu_data[M32R_IRQ_SIO1_R].icucr = 0;
  85. disable_oaks32r_irq(M32R_IRQ_SIO1_R);
  86. /* SIO1_S : uart send data */
  87. irq_set_chip_and_handler(M32R_IRQ_SIO1_S, &oaks32r_irq_type,
  88. handle_level_irq);
  89. icu_data[M32R_IRQ_SIO1_S].icucr = 0;
  90. disable_oaks32r_irq(M32R_IRQ_SIO1_S);
  91. #endif /* CONFIG_SERIAL_M32R_SIO */
  92. }