setup.c 5.3 KB

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