setup_mappi.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * linux/arch/m32r/kernel/setup_mappi.c
  3. *
  4. * Setup routines for Renesas MAPPI Board
  5. *
  6. * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
  7. * Hitoshi Yamamoto
  8. */
  9. #include <linux/config.h>
  10. #include <linux/irq.h>
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <asm/system.h>
  15. #include <asm/m32r.h>
  16. #include <asm/io.h>
  17. #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
  18. icu_data_t icu_data[NR_IRQS];
  19. static void disable_mappi_irq(unsigned int irq)
  20. {
  21. unsigned long port, data;
  22. port = irq2port(irq);
  23. data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
  24. outl(data, port);
  25. }
  26. static void enable_mappi_irq(unsigned int irq)
  27. {
  28. unsigned long port, data;
  29. port = irq2port(irq);
  30. data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
  31. outl(data, port);
  32. }
  33. static void mask_and_ack_mappi(unsigned int irq)
  34. {
  35. disable_mappi_irq(irq);
  36. }
  37. static void end_mappi_irq(unsigned int irq)
  38. {
  39. enable_mappi_irq(irq);
  40. }
  41. static unsigned int startup_mappi_irq(unsigned int irq)
  42. {
  43. enable_mappi_irq(irq);
  44. return (0);
  45. }
  46. static void shutdown_mappi_irq(unsigned int irq)
  47. {
  48. unsigned long port;
  49. port = irq2port(irq);
  50. outl(M32R_ICUCR_ILEVEL7, port);
  51. }
  52. static struct hw_interrupt_type mappi_irq_type =
  53. {
  54. .typename = "MAPPI-IRQ",
  55. .startup = startup_mappi_irq,
  56. .shutdown = shutdown_mappi_irq,
  57. .enable = enable_mappi_irq,
  58. .disable = disable_mappi_irq,
  59. .ack = mask_and_ack_mappi,
  60. .end = end_mappi_irq
  61. };
  62. void __init init_IRQ(void)
  63. {
  64. static int once = 0;
  65. if (once)
  66. return;
  67. else
  68. once++;
  69. #ifdef CONFIG_NE2000
  70. /* INT0 : LAN controller (RTL8019AS) */
  71. irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
  72. irq_desc[M32R_IRQ_INT0].handler = &mappi_irq_type;
  73. irq_desc[M32R_IRQ_INT0].action = 0;
  74. irq_desc[M32R_IRQ_INT0].depth = 1;
  75. icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  76. disable_mappi_irq(M32R_IRQ_INT0);
  77. #endif /* CONFIG_M32R_NE2000 */
  78. /* MFT2 : system timer */
  79. irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
  80. irq_desc[M32R_IRQ_MFT2].handler = &mappi_irq_type;
  81. irq_desc[M32R_IRQ_MFT2].action = 0;
  82. irq_desc[M32R_IRQ_MFT2].depth = 1;
  83. icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
  84. disable_mappi_irq(M32R_IRQ_MFT2);
  85. #ifdef CONFIG_SERIAL_M32R_SIO
  86. /* SIO0_R : uart receive data */
  87. irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
  88. irq_desc[M32R_IRQ_SIO0_R].handler = &mappi_irq_type;
  89. irq_desc[M32R_IRQ_SIO0_R].action = 0;
  90. irq_desc[M32R_IRQ_SIO0_R].depth = 1;
  91. icu_data[M32R_IRQ_SIO0_R].icucr = 0;
  92. disable_mappi_irq(M32R_IRQ_SIO0_R);
  93. /* SIO0_S : uart send data */
  94. irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
  95. irq_desc[M32R_IRQ_SIO0_S].handler = &mappi_irq_type;
  96. irq_desc[M32R_IRQ_SIO0_S].action = 0;
  97. irq_desc[M32R_IRQ_SIO0_S].depth = 1;
  98. icu_data[M32R_IRQ_SIO0_S].icucr = 0;
  99. disable_mappi_irq(M32R_IRQ_SIO0_S);
  100. /* SIO1_R : uart receive data */
  101. irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
  102. irq_desc[M32R_IRQ_SIO1_R].handler = &mappi_irq_type;
  103. irq_desc[M32R_IRQ_SIO1_R].action = 0;
  104. irq_desc[M32R_IRQ_SIO1_R].depth = 1;
  105. icu_data[M32R_IRQ_SIO1_R].icucr = 0;
  106. disable_mappi_irq(M32R_IRQ_SIO1_R);
  107. /* SIO1_S : uart send data */
  108. irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
  109. irq_desc[M32R_IRQ_SIO1_S].handler = &mappi_irq_type;
  110. irq_desc[M32R_IRQ_SIO1_S].action = 0;
  111. irq_desc[M32R_IRQ_SIO1_S].depth = 1;
  112. icu_data[M32R_IRQ_SIO1_S].icucr = 0;
  113. disable_mappi_irq(M32R_IRQ_SIO1_S);
  114. #endif /* CONFIG_SERIAL_M32R_SIO */
  115. #if defined(CONFIG_M32R_PCC)
  116. /* INT1 : pccard0 interrupt */
  117. irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
  118. irq_desc[M32R_IRQ_INT1].handler = &mappi_irq_type;
  119. irq_desc[M32R_IRQ_INT1].action = 0;
  120. irq_desc[M32R_IRQ_INT1].depth = 1;
  121. icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
  122. disable_mappi_irq(M32R_IRQ_INT1);
  123. /* INT2 : pccard1 interrupt */
  124. irq_desc[M32R_IRQ_INT2].status = IRQ_DISABLED;
  125. irq_desc[M32R_IRQ_INT2].handler = &mappi_irq_type;
  126. irq_desc[M32R_IRQ_INT2].action = 0;
  127. irq_desc[M32R_IRQ_INT2].depth = 1;
  128. icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
  129. disable_mappi_irq(M32R_IRQ_INT2);
  130. #endif /* CONFIG_M32RPCC */
  131. }
  132. #if defined(CONFIG_FB_S1D13XXX)
  133. #include <video/s1d13xxxfb.h>
  134. #include <asm/s1d13806.h>
  135. static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
  136. .initregs = s1d13xxxfb_initregs,
  137. .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
  138. .platform_init_video = NULL,
  139. #ifdef CONFIG_PM
  140. .platform_suspend_video = NULL,
  141. .platform_resume_video = NULL,
  142. #endif
  143. };
  144. static struct resource s1d13xxxfb_resources[] = {
  145. [0] = {
  146. .start = 0x10200000UL,
  147. .end = 0x1033FFFFUL,
  148. .flags = IORESOURCE_MEM,
  149. },
  150. [1] = {
  151. .start = 0x10000000UL,
  152. .end = 0x100001FFUL,
  153. .flags = IORESOURCE_MEM,
  154. }
  155. };
  156. static struct platform_device s1d13xxxfb_device = {
  157. .name = S1D_DEVICENAME,
  158. .id = 0,
  159. .dev = {
  160. .platform_data = &s1d13xxxfb_data,
  161. },
  162. .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
  163. .resource = s1d13xxxfb_resources,
  164. };
  165. static int __init platform_init(void)
  166. {
  167. platform_device_register(&s1d13xxxfb_device);
  168. return 0;
  169. }
  170. arch_initcall(platform_init);
  171. #endif