setup_mappi3.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*
  2. * linux/arch/m32r/kernel/setup_mappi3.c
  3. *
  4. * Setup routines for Renesas MAPPI-III(M3A-2170) Board
  5. *
  6. * Copyright (c) 2001-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 <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_mappi3_irq(unsigned int irq)
  20. {
  21. unsigned long port, data;
  22. if ((irq == 0) ||(irq >= NR_IRQS)) {
  23. printk("bad irq 0x%08x\n", irq);
  24. return;
  25. }
  26. port = irq2port(irq);
  27. data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
  28. outl(data, port);
  29. }
  30. static void enable_mappi3_irq(unsigned int irq)
  31. {
  32. unsigned long port, data;
  33. if ((irq == 0) ||(irq >= NR_IRQS)) {
  34. printk("bad irq 0x%08x\n", irq);
  35. return;
  36. }
  37. port = irq2port(irq);
  38. data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
  39. outl(data, port);
  40. }
  41. static void mask_and_ack_mappi3(unsigned int irq)
  42. {
  43. disable_mappi3_irq(irq);
  44. }
  45. static void end_mappi3_irq(unsigned int irq)
  46. {
  47. enable_mappi3_irq(irq);
  48. }
  49. static unsigned int startup_mappi3_irq(unsigned int irq)
  50. {
  51. enable_mappi3_irq(irq);
  52. return (0);
  53. }
  54. static void shutdown_mappi3_irq(unsigned int irq)
  55. {
  56. unsigned long port;
  57. port = irq2port(irq);
  58. outl(M32R_ICUCR_ILEVEL7, port);
  59. }
  60. static struct hw_interrupt_type mappi3_irq_type =
  61. {
  62. .typename = "MAPPI3-IRQ",
  63. .startup = startup_mappi3_irq,
  64. .shutdown = shutdown_mappi3_irq,
  65. .enable = enable_mappi3_irq,
  66. .disable = disable_mappi3_irq,
  67. .ack = mask_and_ack_mappi3,
  68. .end = end_mappi3_irq
  69. };
  70. void __init init_IRQ(void)
  71. {
  72. #if defined(CONFIG_SMC91X)
  73. /* INT0 : LAN controller (SMC91111) */
  74. irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
  75. irq_desc[M32R_IRQ_INT0].handler = &mappi3_irq_type;
  76. irq_desc[M32R_IRQ_INT0].action = 0;
  77. irq_desc[M32R_IRQ_INT0].depth = 1;
  78. icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  79. disable_mappi3_irq(M32R_IRQ_INT0);
  80. #endif /* CONFIG_SMC91X */
  81. /* MFT2 : system timer */
  82. irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
  83. irq_desc[M32R_IRQ_MFT2].handler = &mappi3_irq_type;
  84. irq_desc[M32R_IRQ_MFT2].action = 0;
  85. irq_desc[M32R_IRQ_MFT2].depth = 1;
  86. icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
  87. disable_mappi3_irq(M32R_IRQ_MFT2);
  88. #ifdef CONFIG_SERIAL_M32R_SIO
  89. /* SIO0_R : uart receive data */
  90. irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
  91. irq_desc[M32R_IRQ_SIO0_R].handler = &mappi3_irq_type;
  92. irq_desc[M32R_IRQ_SIO0_R].action = 0;
  93. irq_desc[M32R_IRQ_SIO0_R].depth = 1;
  94. icu_data[M32R_IRQ_SIO0_R].icucr = 0;
  95. disable_mappi3_irq(M32R_IRQ_SIO0_R);
  96. /* SIO0_S : uart send data */
  97. irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
  98. irq_desc[M32R_IRQ_SIO0_S].handler = &mappi3_irq_type;
  99. irq_desc[M32R_IRQ_SIO0_S].action = 0;
  100. irq_desc[M32R_IRQ_SIO0_S].depth = 1;
  101. icu_data[M32R_IRQ_SIO0_S].icucr = 0;
  102. disable_mappi3_irq(M32R_IRQ_SIO0_S);
  103. /* SIO1_R : uart receive data */
  104. irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
  105. irq_desc[M32R_IRQ_SIO1_R].handler = &mappi3_irq_type;
  106. irq_desc[M32R_IRQ_SIO1_R].action = 0;
  107. irq_desc[M32R_IRQ_SIO1_R].depth = 1;
  108. icu_data[M32R_IRQ_SIO1_R].icucr = 0;
  109. disable_mappi3_irq(M32R_IRQ_SIO1_R);
  110. /* SIO1_S : uart send data */
  111. irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
  112. irq_desc[M32R_IRQ_SIO1_S].handler = &mappi3_irq_type;
  113. irq_desc[M32R_IRQ_SIO1_S].action = 0;
  114. irq_desc[M32R_IRQ_SIO1_S].depth = 1;
  115. icu_data[M32R_IRQ_SIO1_S].icucr = 0;
  116. disable_mappi3_irq(M32R_IRQ_SIO1_S);
  117. #endif /* CONFIG_M32R_USE_DBG_CONSOLE */
  118. #if defined(CONFIG_USB)
  119. /* INT1 : USB Host controller interrupt */
  120. irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
  121. irq_desc[M32R_IRQ_INT1].handler = &mappi3_irq_type;
  122. irq_desc[M32R_IRQ_INT1].action = 0;
  123. irq_desc[M32R_IRQ_INT1].depth = 1;
  124. icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
  125. disable_mappi3_irq(M32R_IRQ_INT1);
  126. #endif /* CONFIG_USB */
  127. /* CFC IREQ */
  128. irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
  129. irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type;
  130. irq_desc[PLD_IRQ_CFIREQ].action = 0;
  131. irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
  132. icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
  133. disable_mappi3_irq(PLD_IRQ_CFIREQ);
  134. #if defined(CONFIG_M32R_CFC)
  135. /* ICUCR41: CFC Insert & eject */
  136. irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
  137. irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type;
  138. irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
  139. irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
  140. icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
  141. disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
  142. #endif /* CONFIG_M32R_CFC */
  143. /* IDE IREQ */
  144. irq_desc[PLD_IRQ_IDEIREQ].status = IRQ_DISABLED;
  145. irq_desc[PLD_IRQ_IDEIREQ].handler = &mappi3_irq_type;
  146. irq_desc[PLD_IRQ_IDEIREQ].action = 0;
  147. irq_desc[PLD_IRQ_IDEIREQ].depth = 1; /* disable nested irq */
  148. icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  149. disable_mappi3_irq(PLD_IRQ_IDEIREQ);
  150. }
  151. #if defined(CONFIG_SMC91X)
  152. #define LAN_IOSTART 0x300
  153. #define LAN_IOEND 0x320
  154. static struct resource smc91x_resources[] = {
  155. [0] = {
  156. .start = (LAN_IOSTART),
  157. .end = (LAN_IOEND),
  158. .flags = IORESOURCE_MEM,
  159. },
  160. [1] = {
  161. .start = M32R_IRQ_INT0,
  162. .end = M32R_IRQ_INT0,
  163. .flags = IORESOURCE_IRQ,
  164. }
  165. };
  166. static struct platform_device smc91x_device = {
  167. .name = "smc91x",
  168. .id = 0,
  169. .num_resources = ARRAY_SIZE(smc91x_resources),
  170. .resource = smc91x_resources,
  171. };
  172. #endif
  173. #if defined(CONFIG_FB_S1D13XXX)
  174. #include <video/s1d13xxxfb.h>
  175. #include <asm/s1d13806.h>
  176. static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
  177. .initregs = s1d13xxxfb_initregs,
  178. .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
  179. .platform_init_video = NULL,
  180. #ifdef CONFIG_PM
  181. .platform_suspend_video = NULL,
  182. .platform_resume_video = NULL,
  183. #endif
  184. };
  185. static struct resource s1d13xxxfb_resources[] = {
  186. [0] = {
  187. .start = 0x1d600000UL,
  188. .end = 0x1d73FFFFUL,
  189. .flags = IORESOURCE_MEM,
  190. },
  191. [1] = {
  192. .start = 0x1d400000UL,
  193. .end = 0x1d4001FFUL,
  194. .flags = IORESOURCE_MEM,
  195. }
  196. };
  197. static struct platform_device s1d13xxxfb_device = {
  198. .name = S1D_DEVICENAME,
  199. .id = 0,
  200. .dev = {
  201. .platform_data = &s1d13xxxfb_data,
  202. },
  203. .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
  204. .resource = s1d13xxxfb_resources,
  205. };
  206. #endif
  207. static int __init platform_init(void)
  208. {
  209. #if defined(CONFIG_SMC91X)
  210. platform_device_register(&smc91x_device);
  211. #endif
  212. #if defined(CONFIG_FB_S1D13XXX)
  213. platform_device_register(&s1d13xxxfb_device);
  214. #endif
  215. return 0;
  216. }
  217. arch_initcall(platform_init);