setup-sh73a0.c 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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. /* TMU */
  190. static struct sh_timer_config tmu00_platform_data = {
  191. .name = "TMU00",
  192. .channel_offset = 0x4,
  193. .timer_bit = 0,
  194. .clockevent_rating = 200,
  195. };
  196. static struct resource tmu00_resources[] = {
  197. [0] = {
  198. .name = "TMU00",
  199. .start = 0xfff60008,
  200. .end = 0xfff60013,
  201. .flags = IORESOURCE_MEM,
  202. },
  203. [1] = {
  204. .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
  205. .flags = IORESOURCE_IRQ,
  206. },
  207. };
  208. static struct platform_device tmu00_device = {
  209. .name = "sh_tmu",
  210. .id = 0,
  211. .dev = {
  212. .platform_data = &tmu00_platform_data,
  213. },
  214. .resource = tmu00_resources,
  215. .num_resources = ARRAY_SIZE(tmu00_resources),
  216. };
  217. static struct sh_timer_config tmu01_platform_data = {
  218. .name = "TMU01",
  219. .channel_offset = 0x10,
  220. .timer_bit = 1,
  221. .clocksource_rating = 200,
  222. };
  223. static struct resource tmu01_resources[] = {
  224. [0] = {
  225. .name = "TMU01",
  226. .start = 0xfff60014,
  227. .end = 0xfff6001f,
  228. .flags = IORESOURCE_MEM,
  229. },
  230. [1] = {
  231. .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
  232. .flags = IORESOURCE_IRQ,
  233. },
  234. };
  235. static struct platform_device tmu01_device = {
  236. .name = "sh_tmu",
  237. .id = 1,
  238. .dev = {
  239. .platform_data = &tmu01_platform_data,
  240. },
  241. .resource = tmu01_resources,
  242. .num_resources = ARRAY_SIZE(tmu01_resources),
  243. };
  244. static struct resource i2c0_resources[] = {
  245. [0] = {
  246. .name = "IIC0",
  247. .start = 0xe6820000,
  248. .end = 0xe6820425 - 1,
  249. .flags = IORESOURCE_MEM,
  250. },
  251. [1] = {
  252. .start = gic_spi(167),
  253. .end = gic_spi(170),
  254. .flags = IORESOURCE_IRQ,
  255. },
  256. };
  257. static struct resource i2c1_resources[] = {
  258. [0] = {
  259. .name = "IIC1",
  260. .start = 0xe6822000,
  261. .end = 0xe6822425 - 1,
  262. .flags = IORESOURCE_MEM,
  263. },
  264. [1] = {
  265. .start = gic_spi(51),
  266. .end = gic_spi(54),
  267. .flags = IORESOURCE_IRQ,
  268. },
  269. };
  270. static struct resource i2c2_resources[] = {
  271. [0] = {
  272. .name = "IIC2",
  273. .start = 0xe6824000,
  274. .end = 0xe6824425 - 1,
  275. .flags = IORESOURCE_MEM,
  276. },
  277. [1] = {
  278. .start = gic_spi(171),
  279. .end = gic_spi(174),
  280. .flags = IORESOURCE_IRQ,
  281. },
  282. };
  283. static struct resource i2c3_resources[] = {
  284. [0] = {
  285. .name = "IIC3",
  286. .start = 0xe6826000,
  287. .end = 0xe6826425 - 1,
  288. .flags = IORESOURCE_MEM,
  289. },
  290. [1] = {
  291. .start = gic_spi(183),
  292. .end = gic_spi(186),
  293. .flags = IORESOURCE_IRQ,
  294. },
  295. };
  296. static struct resource i2c4_resources[] = {
  297. [0] = {
  298. .name = "IIC4",
  299. .start = 0xe6828000,
  300. .end = 0xe6828425 - 1,
  301. .flags = IORESOURCE_MEM,
  302. },
  303. [1] = {
  304. .start = gic_spi(187),
  305. .end = gic_spi(190),
  306. .flags = IORESOURCE_IRQ,
  307. },
  308. };
  309. static struct platform_device i2c0_device = {
  310. .name = "i2c-sh_mobile",
  311. .id = 0,
  312. .resource = i2c0_resources,
  313. .num_resources = ARRAY_SIZE(i2c0_resources),
  314. };
  315. static struct platform_device i2c1_device = {
  316. .name = "i2c-sh_mobile",
  317. .id = 1,
  318. .resource = i2c1_resources,
  319. .num_resources = ARRAY_SIZE(i2c1_resources),
  320. };
  321. static struct platform_device i2c2_device = {
  322. .name = "i2c-sh_mobile",
  323. .id = 2,
  324. .resource = i2c2_resources,
  325. .num_resources = ARRAY_SIZE(i2c2_resources),
  326. };
  327. static struct platform_device i2c3_device = {
  328. .name = "i2c-sh_mobile",
  329. .id = 3,
  330. .resource = i2c3_resources,
  331. .num_resources = ARRAY_SIZE(i2c3_resources),
  332. };
  333. static struct platform_device i2c4_device = {
  334. .name = "i2c-sh_mobile",
  335. .id = 4,
  336. .resource = i2c4_resources,
  337. .num_resources = ARRAY_SIZE(i2c4_resources),
  338. };
  339. static struct platform_device *sh73a0_early_devices[] __initdata = {
  340. &scif0_device,
  341. &scif1_device,
  342. &scif2_device,
  343. &scif3_device,
  344. &scif4_device,
  345. &scif5_device,
  346. &scif6_device,
  347. &scif7_device,
  348. &scif8_device,
  349. &cmt10_device,
  350. &tmu00_device,
  351. &tmu01_device,
  352. };
  353. static struct platform_device *sh73a0_late_devices[] __initdata = {
  354. &i2c0_device,
  355. &i2c1_device,
  356. &i2c2_device,
  357. &i2c3_device,
  358. &i2c4_device,
  359. };
  360. void __init sh73a0_add_standard_devices(void)
  361. {
  362. platform_add_devices(sh73a0_early_devices,
  363. ARRAY_SIZE(sh73a0_early_devices));
  364. platform_add_devices(sh73a0_late_devices,
  365. ARRAY_SIZE(sh73a0_late_devices));
  366. }
  367. void __init sh73a0_add_early_devices(void)
  368. {
  369. early_platform_add_devices(sh73a0_early_devices,
  370. ARRAY_SIZE(sh73a0_early_devices));
  371. }