setup-sh7372.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  2. * sh7372 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_intc.h>
  30. #include <linux/sh_timer.h>
  31. #include <mach/hardware.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/mach/arch.h>
  34. /* SCIF */
  35. static struct plat_sci_port scif0_platform_data = {
  36. .mapbase = 0xe6c40000,
  37. .flags = UPF_BOOT_AUTOCONF,
  38. .type = PORT_SCIF,
  39. .irqs = { 80, 80, 80, 80 },
  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. static struct plat_sci_port scif1_platform_data = {
  49. .mapbase = 0xe6c50000,
  50. .flags = UPF_BOOT_AUTOCONF,
  51. .type = PORT_SCIF,
  52. .irqs = { 81, 81, 81, 81 },
  53. };
  54. static struct platform_device scif1_device = {
  55. .name = "sh-sci",
  56. .id = 1,
  57. .dev = {
  58. .platform_data = &scif1_platform_data,
  59. },
  60. };
  61. static struct plat_sci_port scif2_platform_data = {
  62. .mapbase = 0xe6c60000,
  63. .flags = UPF_BOOT_AUTOCONF,
  64. .type = PORT_SCIF,
  65. .irqs = { 82, 82, 82, 82 },
  66. };
  67. static struct platform_device scif2_device = {
  68. .name = "sh-sci",
  69. .id = 2,
  70. .dev = {
  71. .platform_data = &scif2_platform_data,
  72. },
  73. };
  74. static struct plat_sci_port scif3_platform_data = {
  75. .mapbase = 0xe6c70000,
  76. .flags = UPF_BOOT_AUTOCONF,
  77. .type = PORT_SCIF,
  78. .irqs = { 83, 83, 83, 83 },
  79. };
  80. static struct platform_device scif3_device = {
  81. .name = "sh-sci",
  82. .id = 3,
  83. .dev = {
  84. .platform_data = &scif3_platform_data,
  85. },
  86. };
  87. static struct plat_sci_port scif4_platform_data = {
  88. .mapbase = 0xe6c80000,
  89. .flags = UPF_BOOT_AUTOCONF,
  90. .type = PORT_SCIF,
  91. .irqs = { 89, 89, 89, 89 },
  92. };
  93. static struct platform_device scif4_device = {
  94. .name = "sh-sci",
  95. .id = 4,
  96. .dev = {
  97. .platform_data = &scif4_platform_data,
  98. },
  99. };
  100. static struct plat_sci_port scif5_platform_data = {
  101. .mapbase = 0xe6cb0000,
  102. .flags = UPF_BOOT_AUTOCONF,
  103. .type = PORT_SCIF,
  104. .irqs = { 90, 90, 90, 90 },
  105. };
  106. static struct platform_device scif5_device = {
  107. .name = "sh-sci",
  108. .id = 5,
  109. .dev = {
  110. .platform_data = &scif5_platform_data,
  111. },
  112. };
  113. static struct plat_sci_port scif6_platform_data = {
  114. .mapbase = 0xe6c30000,
  115. .flags = UPF_BOOT_AUTOCONF,
  116. .type = PORT_SCIF,
  117. .irqs = { 91, 91, 91, 91 },
  118. };
  119. static struct platform_device scif6_device = {
  120. .name = "sh-sci",
  121. .id = 6,
  122. .dev = {
  123. .platform_data = &scif6_platform_data,
  124. },
  125. };
  126. /* CMT */
  127. static struct sh_timer_config cmt10_platform_data = {
  128. .name = "CMT10",
  129. .channel_offset = 0x10,
  130. .timer_bit = 0,
  131. .clk = "r_clk",
  132. .clockevent_rating = 125,
  133. .clocksource_rating = 125,
  134. };
  135. static struct resource cmt10_resources[] = {
  136. [0] = {
  137. .name = "CMT10",
  138. .start = 0xe6138010,
  139. .end = 0xe613801b,
  140. .flags = IORESOURCE_MEM,
  141. },
  142. [1] = {
  143. .start = 72,
  144. .flags = IORESOURCE_IRQ,
  145. },
  146. };
  147. static struct platform_device cmt10_device = {
  148. .name = "sh_cmt",
  149. .id = 10,
  150. .dev = {
  151. .platform_data = &cmt10_platform_data,
  152. },
  153. .resource = cmt10_resources,
  154. .num_resources = ARRAY_SIZE(cmt10_resources),
  155. };
  156. /* I2C */
  157. static struct resource iic0_resources[] = {
  158. [0] = {
  159. .name = "IIC0",
  160. .start = 0xFFF20000,
  161. .end = 0xFFF20425 - 1,
  162. .flags = IORESOURCE_MEM,
  163. },
  164. [1] = {
  165. .start = intcs_evt2irq(0xe00),
  166. .end = intcs_evt2irq(0xe60),
  167. .flags = IORESOURCE_IRQ,
  168. },
  169. };
  170. static struct platform_device iic0_device = {
  171. .name = "i2c-sh_mobile",
  172. .id = 0, /* "i2c0" clock */
  173. .num_resources = ARRAY_SIZE(iic0_resources),
  174. .resource = iic0_resources,
  175. };
  176. static struct resource iic1_resources[] = {
  177. [0] = {
  178. .name = "IIC1",
  179. .start = 0xE6C20000,
  180. .end = 0xE6C20425 - 1,
  181. .flags = IORESOURCE_MEM,
  182. },
  183. [1] = {
  184. .start = 44,
  185. .end = 47,
  186. .flags = IORESOURCE_IRQ,
  187. },
  188. };
  189. static struct platform_device iic1_device = {
  190. .name = "i2c-sh_mobile",
  191. .id = 1, /* "i2c1" clock */
  192. .num_resources = ARRAY_SIZE(iic1_resources),
  193. .resource = iic1_resources,
  194. };
  195. static struct platform_device *sh7372_early_devices[] __initdata = {
  196. &scif0_device,
  197. &scif1_device,
  198. &scif2_device,
  199. &scif3_device,
  200. &scif4_device,
  201. &scif5_device,
  202. &scif6_device,
  203. &cmt10_device,
  204. &iic0_device,
  205. &iic1_device,
  206. };
  207. void __init sh7372_add_standard_devices(void)
  208. {
  209. platform_add_devices(sh7372_early_devices,
  210. ARRAY_SIZE(sh7372_early_devices));
  211. }
  212. #define SMSTPCR3 0xe615013c
  213. #define SMSTPCR3_CMT1 (1 << 29)
  214. void __init sh7372_add_early_devices(void)
  215. {
  216. /* enable clock to CMT1 */
  217. __raw_writel(__raw_readl(SMSTPCR3) & ~SMSTPCR3_CMT1, SMSTPCR3);
  218. early_platform_add_devices(sh7372_early_devices,
  219. ARRAY_SIZE(sh7372_early_devices));
  220. }