setup.c 4.1 KB

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