setup_mappi.c 5.1 KB

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