setup-sh7367.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * sh7367 processor support
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. * Copyright (C) 2008 Yoshihiro Shimoda
  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_timer.h>
  30. #include <mach/hardware.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/mach/arch.h>
  33. /* SCIFA0 */
  34. static struct plat_sci_port scif0_platform_data = {
  35. .mapbase = 0xe6c40000,
  36. .flags = UPF_BOOT_AUTOCONF,
  37. .type = PORT_SCIF,
  38. .irqs = { evt2irq(0xc00), evt2irq(0xc00),
  39. evt2irq(0xc00), evt2irq(0xc00) },
  40. };
  41. static struct platform_device scif0_device = {
  42. .name = "sh-sci",
  43. .id = 0,
  44. .dev = {
  45. .platform_data = &scif0_platform_data,
  46. },
  47. };
  48. /* SCIFA1 */
  49. static struct plat_sci_port scif1_platform_data = {
  50. .mapbase = 0xe6c50000,
  51. .flags = UPF_BOOT_AUTOCONF,
  52. .type = PORT_SCIF,
  53. .irqs = { evt2irq(0xc20), evt2irq(0xc20),
  54. evt2irq(0xc20), evt2irq(0xc20) },
  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. /* SCIFA2 */
  64. static struct plat_sci_port scif2_platform_data = {
  65. .mapbase = 0xe6c60000,
  66. .flags = UPF_BOOT_AUTOCONF,
  67. .type = PORT_SCIF,
  68. .irqs = { evt2irq(0xc40), evt2irq(0xc40),
  69. evt2irq(0xc40), evt2irq(0xc40) },
  70. };
  71. static struct platform_device scif2_device = {
  72. .name = "sh-sci",
  73. .id = 2,
  74. .dev = {
  75. .platform_data = &scif2_platform_data,
  76. },
  77. };
  78. /* SCIFA3 */
  79. static struct plat_sci_port scif3_platform_data = {
  80. .mapbase = 0xe6c70000,
  81. .flags = UPF_BOOT_AUTOCONF,
  82. .type = PORT_SCIF,
  83. .irqs = { evt2irq(0xc60), evt2irq(0xc60),
  84. evt2irq(0xc60), evt2irq(0xc60) },
  85. };
  86. static struct platform_device scif3_device = {
  87. .name = "sh-sci",
  88. .id = 3,
  89. .dev = {
  90. .platform_data = &scif3_platform_data,
  91. },
  92. };
  93. /* SCIFA4 */
  94. static struct plat_sci_port scif4_platform_data = {
  95. .mapbase = 0xe6c80000,
  96. .flags = UPF_BOOT_AUTOCONF,
  97. .type = PORT_SCIF,
  98. .irqs = { evt2irq(0xd20), evt2irq(0xd20),
  99. evt2irq(0xd20), evt2irq(0xd20) },
  100. };
  101. static struct platform_device scif4_device = {
  102. .name = "sh-sci",
  103. .id = 4,
  104. .dev = {
  105. .platform_data = &scif4_platform_data,
  106. },
  107. };
  108. /* SCIFA5 */
  109. static struct plat_sci_port scif5_platform_data = {
  110. .mapbase = 0xe6cb0000,
  111. .flags = UPF_BOOT_AUTOCONF,
  112. .type = PORT_SCIF,
  113. .irqs = { evt2irq(0xd40), evt2irq(0xd40),
  114. evt2irq(0xd40), evt2irq(0xd40) },
  115. };
  116. static struct platform_device scif5_device = {
  117. .name = "sh-sci",
  118. .id = 5,
  119. .dev = {
  120. .platform_data = &scif5_platform_data,
  121. },
  122. };
  123. /* SCIFB */
  124. static struct plat_sci_port scif6_platform_data = {
  125. .mapbase = 0xe6c30000,
  126. .flags = UPF_BOOT_AUTOCONF,
  127. .type = PORT_SCIF,
  128. .irqs = { evt2irq(0xd60), evt2irq(0xd60),
  129. evt2irq(0xd60), evt2irq(0xd60) },
  130. };
  131. static struct platform_device scif6_device = {
  132. .name = "sh-sci",
  133. .id = 6,
  134. .dev = {
  135. .platform_data = &scif6_platform_data,
  136. },
  137. };
  138. static struct sh_timer_config cmt10_platform_data = {
  139. .name = "CMT10",
  140. .channel_offset = 0x10,
  141. .timer_bit = 0,
  142. .clk = "r_clk",
  143. .clockevent_rating = 125,
  144. .clocksource_rating = 125,
  145. };
  146. static struct resource cmt10_resources[] = {
  147. [0] = {
  148. .name = "CMT10",
  149. .start = 0xe6138010,
  150. .end = 0xe613801b,
  151. .flags = IORESOURCE_MEM,
  152. },
  153. [1] = {
  154. .start = evt2irq(0xb00), /* CMT1_CMT10 */
  155. .flags = IORESOURCE_IRQ,
  156. },
  157. };
  158. static struct platform_device cmt10_device = {
  159. .name = "sh_cmt",
  160. .id = 10,
  161. .dev = {
  162. .platform_data = &cmt10_platform_data,
  163. },
  164. .resource = cmt10_resources,
  165. .num_resources = ARRAY_SIZE(cmt10_resources),
  166. };
  167. static struct platform_device *sh7367_early_devices[] __initdata = {
  168. &scif0_device,
  169. &scif1_device,
  170. &scif2_device,
  171. &scif3_device,
  172. &scif4_device,
  173. &scif5_device,
  174. &scif6_device,
  175. &cmt10_device,
  176. };
  177. void __init sh7367_add_standard_devices(void)
  178. {
  179. platform_add_devices(sh7367_early_devices,
  180. ARRAY_SIZE(sh7367_early_devices));
  181. }
  182. #define SYMSTPCR2 0xe6158048
  183. #define SYMSTPCR2_CMT1 (1 << 29)
  184. void __init sh7367_add_early_devices(void)
  185. {
  186. /* enable clock to CMT1 */
  187. __raw_writel(__raw_readl(SYMSTPCR2) & ~SYMSTPCR2_CMT1, SYMSTPCR2);
  188. early_platform_add_devices(sh7367_early_devices,
  189. ARRAY_SIZE(sh7367_early_devices));
  190. }