setup-sh73a0.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. * sh73a0 processor support
  3. *
  4. * Copyright (C) 2010 Takashi Yoshii
  5. * Copyright (C) 2010 Magnus Damm
  6. * Copyright (C) 2008 Yoshihiro Shimoda
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/irq.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/delay.h>
  27. #include <linux/input.h>
  28. #include <linux/io.h>
  29. #include <linux/serial_sci.h>
  30. #include <linux/sh_intc.h>
  31. #include <linux/sh_timer.h>
  32. #include <mach/hardware.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. static struct plat_sci_port scif0_platform_data = {
  36. .mapbase = 0xe6c40000,
  37. .flags = UPF_BOOT_AUTOCONF,
  38. .type = PORT_SCIFA,
  39. .irqs = { gic_spi(72), gic_spi(72),
  40. gic_spi(72), gic_spi(72) },
  41. };
  42. static struct platform_device scif0_device = {
  43. .name = "sh-sci",
  44. .id = 0,
  45. .dev = {
  46. .platform_data = &scif0_platform_data,
  47. },
  48. };
  49. static struct plat_sci_port scif1_platform_data = {
  50. .mapbase = 0xe6c50000,
  51. .flags = UPF_BOOT_AUTOCONF,
  52. .type = PORT_SCIFA,
  53. .irqs = { gic_spi(73), gic_spi(73),
  54. gic_spi(73), gic_spi(73) },
  55. };
  56. static struct platform_device scif1_device = {
  57. .name = "sh-sci",
  58. .id = 1,
  59. .dev = {
  60. .platform_data = &scif1_platform_data,
  61. },
  62. };
  63. static struct plat_sci_port scif2_platform_data = {
  64. .mapbase = 0xe6c60000,
  65. .flags = UPF_BOOT_AUTOCONF,
  66. .type = PORT_SCIFA,
  67. .irqs = { gic_spi(74), gic_spi(74),
  68. gic_spi(74), gic_spi(74) },
  69. };
  70. static struct platform_device scif2_device = {
  71. .name = "sh-sci",
  72. .id = 2,
  73. .dev = {
  74. .platform_data = &scif2_platform_data,
  75. },
  76. };
  77. static struct plat_sci_port scif3_platform_data = {
  78. .mapbase = 0xe6c70000,
  79. .flags = UPF_BOOT_AUTOCONF,
  80. .type = PORT_SCIFA,
  81. .irqs = { gic_spi(75), gic_spi(75),
  82. gic_spi(75), gic_spi(75) },
  83. };
  84. static struct platform_device scif3_device = {
  85. .name = "sh-sci",
  86. .id = 3,
  87. .dev = {
  88. .platform_data = &scif3_platform_data,
  89. },
  90. };
  91. static struct plat_sci_port scif4_platform_data = {
  92. .mapbase = 0xe6c80000,
  93. .flags = UPF_BOOT_AUTOCONF,
  94. .type = PORT_SCIFA,
  95. .irqs = { gic_spi(78), gic_spi(78),
  96. gic_spi(78), gic_spi(78) },
  97. };
  98. static struct platform_device scif4_device = {
  99. .name = "sh-sci",
  100. .id = 4,
  101. .dev = {
  102. .platform_data = &scif4_platform_data,
  103. },
  104. };
  105. static struct plat_sci_port scif5_platform_data = {
  106. .mapbase = 0xe6cb0000,
  107. .flags = UPF_BOOT_AUTOCONF,
  108. .type = PORT_SCIFA,
  109. .irqs = { gic_spi(79), gic_spi(79),
  110. gic_spi(79), gic_spi(79) },
  111. };
  112. static struct platform_device scif5_device = {
  113. .name = "sh-sci",
  114. .id = 5,
  115. .dev = {
  116. .platform_data = &scif5_platform_data,
  117. },
  118. };
  119. static struct plat_sci_port scif6_platform_data = {
  120. .mapbase = 0xe6cc0000,
  121. .flags = UPF_BOOT_AUTOCONF,
  122. .type = PORT_SCIFA,
  123. .irqs = { gic_spi(156), gic_spi(156),
  124. gic_spi(156), gic_spi(156) },
  125. };
  126. static struct platform_device scif6_device = {
  127. .name = "sh-sci",
  128. .id = 6,
  129. .dev = {
  130. .platform_data = &scif6_platform_data,
  131. },
  132. };
  133. static struct plat_sci_port scif7_platform_data = {
  134. .mapbase = 0xe6cd0000,
  135. .flags = UPF_BOOT_AUTOCONF,
  136. .type = PORT_SCIFA,
  137. .irqs = { gic_spi(143), gic_spi(143),
  138. gic_spi(143), gic_spi(143) },
  139. };
  140. static struct platform_device scif7_device = {
  141. .name = "sh-sci",
  142. .id = 7,
  143. .dev = {
  144. .platform_data = &scif7_platform_data,
  145. },
  146. };
  147. static struct plat_sci_port scif8_platform_data = {
  148. .mapbase = 0xe6c30000,
  149. .flags = UPF_BOOT_AUTOCONF,
  150. .type = PORT_SCIFB,
  151. .irqs = { gic_spi(80), gic_spi(80),
  152. gic_spi(80), gic_spi(80) },
  153. };
  154. static struct platform_device scif8_device = {
  155. .name = "sh-sci",
  156. .id = 8,
  157. .dev = {
  158. .platform_data = &scif8_platform_data,
  159. },
  160. };
  161. static struct sh_timer_config cmt10_platform_data = {
  162. .name = "CMT10",
  163. .channel_offset = 0x10,
  164. .timer_bit = 0,
  165. .clockevent_rating = 125,
  166. .clocksource_rating = 125,
  167. };
  168. static struct resource cmt10_resources[] = {
  169. [0] = {
  170. .name = "CMT10",
  171. .start = 0xe6138010,
  172. .end = 0xe613801b,
  173. .flags = IORESOURCE_MEM,
  174. },
  175. [1] = {
  176. .start = gic_spi(65),
  177. .flags = IORESOURCE_IRQ,
  178. },
  179. };
  180. static struct platform_device cmt10_device = {
  181. .name = "sh_cmt",
  182. .id = 10,
  183. .dev = {
  184. .platform_data = &cmt10_platform_data,
  185. },
  186. .resource = cmt10_resources,
  187. .num_resources = ARRAY_SIZE(cmt10_resources),
  188. };
  189. static struct platform_device *sh73a0_early_devices[] __initdata = {
  190. &scif0_device,
  191. &scif1_device,
  192. &scif2_device,
  193. &scif3_device,
  194. &scif4_device,
  195. &scif5_device,
  196. &scif6_device,
  197. &scif7_device,
  198. &scif8_device,
  199. &cmt10_device,
  200. };
  201. void __init sh73a0_add_standard_devices(void)
  202. {
  203. platform_add_devices(sh73a0_early_devices,
  204. ARRAY_SIZE(sh73a0_early_devices));
  205. }
  206. void __init sh73a0_add_early_devices(void)
  207. {
  208. early_platform_add_devices(sh73a0_early_devices,
  209. ARRAY_SIZE(sh73a0_early_devices));
  210. }