setup.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * linux/arch/m32r/platforms/mappi3/setup.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/irq.h>
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.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_mappi3_irq(unsigned int irq)
  19. {
  20. unsigned long port, data;
  21. if ((irq == 0) ||(irq >= NR_IRQS)) {
  22. printk("bad irq 0x%08x\n", irq);
  23. return;
  24. }
  25. port = irq2port(irq);
  26. data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
  27. outl(data, port);
  28. }
  29. static void enable_mappi3_irq(unsigned int irq)
  30. {
  31. unsigned long port, data;
  32. if ((irq == 0) ||(irq >= NR_IRQS)) {
  33. printk("bad irq 0x%08x\n", irq);
  34. return;
  35. }
  36. port = irq2port(irq);
  37. data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
  38. outl(data, port);
  39. }
  40. static void mask_mappi3(struct irq_data *data)
  41. {
  42. disable_mappi3_irq(data->irq);
  43. }
  44. static void unmask_mappi3(struct irq_data *data)
  45. {
  46. enable_mappi3_irq(data->irq);
  47. }
  48. static void shutdown_mappi3(struct irq_data *data)
  49. {
  50. unsigned long port;
  51. port = irq2port(data->irq);
  52. outl(M32R_ICUCR_ILEVEL7, port);
  53. }
  54. static struct irq_chip mappi3_irq_type = {
  55. .name = "MAPPI3-IRQ",
  56. .irq_shutdown = shutdown_mappi3,
  57. .irq_mask = mask_mappi3,
  58. .irq_unmask = unmask_mappi3,
  59. };
  60. void __init init_IRQ(void)
  61. {
  62. #if defined(CONFIG_SMC91X)
  63. /* INT0 : LAN controller (SMC91111) */
  64. irq_set_chip_and_handler(M32R_IRQ_INT0, &mappi3_irq_type,
  65. handle_level_irq);
  66. icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  67. disable_mappi3_irq(M32R_IRQ_INT0);
  68. #endif /* CONFIG_SMC91X */
  69. /* MFT2 : system timer */
  70. irq_set_chip_and_handler(M32R_IRQ_MFT2, &mappi3_irq_type,
  71. handle_level_irq);
  72. icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
  73. disable_mappi3_irq(M32R_IRQ_MFT2);
  74. #ifdef CONFIG_SERIAL_M32R_SIO
  75. /* SIO0_R : uart receive data */
  76. irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &mappi3_irq_type,
  77. handle_level_irq);
  78. icu_data[M32R_IRQ_SIO0_R].icucr = 0;
  79. disable_mappi3_irq(M32R_IRQ_SIO0_R);
  80. /* SIO0_S : uart send data */
  81. irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &mappi3_irq_type,
  82. handle_level_irq);
  83. icu_data[M32R_IRQ_SIO0_S].icucr = 0;
  84. disable_mappi3_irq(M32R_IRQ_SIO0_S);
  85. /* SIO1_R : uart receive data */
  86. irq_set_chip_and_handler(M32R_IRQ_SIO1_R, &mappi3_irq_type,
  87. handle_level_irq);
  88. icu_data[M32R_IRQ_SIO1_R].icucr = 0;
  89. disable_mappi3_irq(M32R_IRQ_SIO1_R);
  90. /* SIO1_S : uart send data */
  91. irq_set_chip_and_handler(M32R_IRQ_SIO1_S, &mappi3_irq_type,
  92. handle_level_irq);
  93. icu_data[M32R_IRQ_SIO1_S].icucr = 0;
  94. disable_mappi3_irq(M32R_IRQ_SIO1_S);
  95. #endif /* CONFIG_M32R_USE_DBG_CONSOLE */
  96. #if defined(CONFIG_USB)
  97. /* INT1 : USB Host controller interrupt */
  98. irq_set_chip_and_handler(M32R_IRQ_INT1, &mappi3_irq_type,
  99. handle_level_irq);
  100. icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
  101. disable_mappi3_irq(M32R_IRQ_INT1);
  102. #endif /* CONFIG_USB */
  103. /* CFC IREQ */
  104. irq_set_chip_and_handler(PLD_IRQ_CFIREQ, &mappi3_irq_type,
  105. handle_level_irq);
  106. icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
  107. disable_mappi3_irq(PLD_IRQ_CFIREQ);
  108. #if defined(CONFIG_M32R_CFC)
  109. /* ICUCR41: CFC Insert & eject */
  110. irq_set_chip_and_handler(PLD_IRQ_CFC_INSERT, &mappi3_irq_type,
  111. handle_level_irq);
  112. icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
  113. disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
  114. #endif /* CONFIG_M32R_CFC */
  115. /* IDE IREQ */
  116. irq_set_chip_and_handler(PLD_IRQ_IDEIREQ, &mappi3_irq_type,
  117. handle_level_irq);
  118. icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
  119. disable_mappi3_irq(PLD_IRQ_IDEIREQ);
  120. }
  121. #if defined(CONFIG_SMC91X)
  122. #define LAN_IOSTART 0x300
  123. #define LAN_IOEND 0x320
  124. static struct resource smc91x_resources[] = {
  125. [0] = {
  126. .start = (LAN_IOSTART),
  127. .end = (LAN_IOEND),
  128. .flags = IORESOURCE_MEM,
  129. },
  130. [1] = {
  131. .start = M32R_IRQ_INT0,
  132. .end = M32R_IRQ_INT0,
  133. .flags = IORESOURCE_IRQ,
  134. }
  135. };
  136. static struct platform_device smc91x_device = {
  137. .name = "smc91x",
  138. .id = 0,
  139. .num_resources = ARRAY_SIZE(smc91x_resources),
  140. .resource = smc91x_resources,
  141. };
  142. #endif
  143. #if defined(CONFIG_FB_S1D13XXX)
  144. #include <video/s1d13xxxfb.h>
  145. #include <asm/s1d13806.h>
  146. static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
  147. .initregs = s1d13xxxfb_initregs,
  148. .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
  149. .platform_init_video = NULL,
  150. #ifdef CONFIG_PM
  151. .platform_suspend_video = NULL,
  152. .platform_resume_video = NULL,
  153. #endif
  154. };
  155. static struct resource s1d13xxxfb_resources[] = {
  156. [0] = {
  157. .start = 0x1d600000UL,
  158. .end = 0x1d73FFFFUL,
  159. .flags = IORESOURCE_MEM,
  160. },
  161. [1] = {
  162. .start = 0x1d400000UL,
  163. .end = 0x1d4001FFUL,
  164. .flags = IORESOURCE_MEM,
  165. }
  166. };
  167. static struct platform_device s1d13xxxfb_device = {
  168. .name = S1D_DEVICENAME,
  169. .id = 0,
  170. .dev = {
  171. .platform_data = &s1d13xxxfb_data,
  172. },
  173. .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
  174. .resource = s1d13xxxfb_resources,
  175. };
  176. #endif
  177. static int __init platform_init(void)
  178. {
  179. #if defined(CONFIG_SMC91X)
  180. platform_device_register(&smc91x_device);
  181. #endif
  182. #if defined(CONFIG_FB_S1D13XXX)
  183. platform_device_register(&s1d13xxxfb_device);
  184. #endif
  185. return 0;
  186. }
  187. arch_initcall(platform_init);