setup-r8a7779.c 5.7 KB

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