setup_mappi.c 5.0 KB

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