setup-sh7770.c 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. /*
  2. * SH7770 Setup
  3. *
  4. * Copyright (C) 2006 - 2008 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/serial.h>
  13. #include <linux/serial_sci.h>
  14. #include <linux/sh_timer.h>
  15. static struct plat_sci_port sci_platform_data[] = {
  16. {
  17. .mapbase = 0xff923000,
  18. .flags = UPF_BOOT_AUTOCONF,
  19. .type = PORT_SCIF,
  20. .irqs = { 61, 61, 61, 61 },
  21. }, {
  22. .mapbase = 0xff924000,
  23. .flags = UPF_BOOT_AUTOCONF,
  24. .type = PORT_SCIF,
  25. .irqs = { 62, 62, 62, 62 },
  26. }, {
  27. .mapbase = 0xff925000,
  28. .flags = UPF_BOOT_AUTOCONF,
  29. .type = PORT_SCIF,
  30. .irqs = { 63, 63, 63, 63 },
  31. }, {
  32. .mapbase = 0xff926000,
  33. .flags = UPF_BOOT_AUTOCONF,
  34. .type = PORT_SCIF,
  35. .irqs = { 64, 64, 64, 64 },
  36. }, {
  37. .mapbase = 0xff927000,
  38. .flags = UPF_BOOT_AUTOCONF,
  39. .type = PORT_SCIF,
  40. .irqs = { 65, 65, 65, 65 },
  41. }, {
  42. .mapbase = 0xff928000,
  43. .flags = UPF_BOOT_AUTOCONF,
  44. .type = PORT_SCIF,
  45. .irqs = { 66, 66, 66, 66 },
  46. }, {
  47. .mapbase = 0xff929000,
  48. .flags = UPF_BOOT_AUTOCONF,
  49. .type = PORT_SCIF,
  50. .irqs = { 67, 67, 67, 67 },
  51. }, {
  52. .mapbase = 0xff92a000,
  53. .flags = UPF_BOOT_AUTOCONF,
  54. .type = PORT_SCIF,
  55. .irqs = { 68, 68, 68, 68 },
  56. }, {
  57. .mapbase = 0xff92b000,
  58. .flags = UPF_BOOT_AUTOCONF,
  59. .type = PORT_SCIF,
  60. .irqs = { 69, 69, 69, 69 },
  61. }, {
  62. .mapbase = 0xff92c000,
  63. .flags = UPF_BOOT_AUTOCONF,
  64. .type = PORT_SCIF,
  65. .irqs = { 70, 70, 70, 70 },
  66. }, {
  67. .flags = 0,
  68. }
  69. };
  70. static struct platform_device sci_device = {
  71. .name = "sh-sci",
  72. .id = -1,
  73. .dev = {
  74. .platform_data = sci_platform_data,
  75. },
  76. };
  77. static struct sh_timer_config tmu0_platform_data = {
  78. .name = "TMU0",
  79. .channel_offset = 0x04,
  80. .timer_bit = 0,
  81. .clk = "module_clk",
  82. .clockevent_rating = 200,
  83. };
  84. static struct resource tmu0_resources[] = {
  85. [0] = {
  86. .name = "TMU0",
  87. .start = 0xffd80008,
  88. .end = 0xffd80013,
  89. .flags = IORESOURCE_MEM,
  90. },
  91. [1] = {
  92. .start = 16,
  93. .flags = IORESOURCE_IRQ,
  94. },
  95. };
  96. static struct platform_device tmu0_device = {
  97. .name = "sh_tmu",
  98. .id = 0,
  99. .dev = {
  100. .platform_data = &tmu0_platform_data,
  101. },
  102. .resource = tmu0_resources,
  103. .num_resources = ARRAY_SIZE(tmu0_resources),
  104. };
  105. static struct sh_timer_config tmu1_platform_data = {
  106. .name = "TMU1",
  107. .channel_offset = 0x10,
  108. .timer_bit = 1,
  109. .clk = "module_clk",
  110. .clocksource_rating = 200,
  111. };
  112. static struct resource tmu1_resources[] = {
  113. [0] = {
  114. .name = "TMU1",
  115. .start = 0xffd80014,
  116. .end = 0xffd8001f,
  117. .flags = IORESOURCE_MEM,
  118. },
  119. [1] = {
  120. .start = 17,
  121. .flags = IORESOURCE_IRQ,
  122. },
  123. };
  124. static struct platform_device tmu1_device = {
  125. .name = "sh_tmu",
  126. .id = 1,
  127. .dev = {
  128. .platform_data = &tmu1_platform_data,
  129. },
  130. .resource = tmu1_resources,
  131. .num_resources = ARRAY_SIZE(tmu1_resources),
  132. };
  133. static struct sh_timer_config tmu2_platform_data = {
  134. .name = "TMU2",
  135. .channel_offset = 0x1c,
  136. .timer_bit = 2,
  137. .clk = "module_clk",
  138. };
  139. static struct resource tmu2_resources[] = {
  140. [0] = {
  141. .name = "TMU2",
  142. .start = 0xffd80020,
  143. .end = 0xffd8002f,
  144. .flags = IORESOURCE_MEM,
  145. },
  146. [1] = {
  147. .start = 18,
  148. .flags = IORESOURCE_IRQ,
  149. },
  150. };
  151. static struct platform_device tmu2_device = {
  152. .name = "sh_tmu",
  153. .id = 2,
  154. .dev = {
  155. .platform_data = &tmu2_platform_data,
  156. },
  157. .resource = tmu2_resources,
  158. .num_resources = ARRAY_SIZE(tmu2_resources),
  159. };
  160. static struct sh_timer_config tmu3_platform_data = {
  161. .name = "TMU3",
  162. .channel_offset = 0x04,
  163. .timer_bit = 0,
  164. .clk = "module_clk",
  165. };
  166. static struct resource tmu3_resources[] = {
  167. [0] = {
  168. .name = "TMU3",
  169. .start = 0xffd81008,
  170. .end = 0xffd81013,
  171. .flags = IORESOURCE_MEM,
  172. },
  173. [1] = {
  174. .start = 19,
  175. .flags = IORESOURCE_IRQ,
  176. },
  177. };
  178. static struct platform_device tmu3_device = {
  179. .name = "sh_tmu",
  180. .id = 3,
  181. .dev = {
  182. .platform_data = &tmu3_platform_data,
  183. },
  184. .resource = tmu3_resources,
  185. .num_resources = ARRAY_SIZE(tmu3_resources),
  186. };
  187. static struct sh_timer_config tmu4_platform_data = {
  188. .name = "TMU4",
  189. .channel_offset = 0x10,
  190. .timer_bit = 1,
  191. .clk = "module_clk",
  192. };
  193. static struct resource tmu4_resources[] = {
  194. [0] = {
  195. .name = "TMU4",
  196. .start = 0xffd81014,
  197. .end = 0xffd8101f,
  198. .flags = IORESOURCE_MEM,
  199. },
  200. [1] = {
  201. .start = 20,
  202. .flags = IORESOURCE_IRQ,
  203. },
  204. };
  205. static struct platform_device tmu4_device = {
  206. .name = "sh_tmu",
  207. .id = 4,
  208. .dev = {
  209. .platform_data = &tmu4_platform_data,
  210. },
  211. .resource = tmu4_resources,
  212. .num_resources = ARRAY_SIZE(tmu4_resources),
  213. };
  214. static struct sh_timer_config tmu5_platform_data = {
  215. .name = "TMU5",
  216. .channel_offset = 0x1c,
  217. .timer_bit = 2,
  218. .clk = "module_clk",
  219. };
  220. static struct resource tmu5_resources[] = {
  221. [0] = {
  222. .name = "TMU5",
  223. .start = 0xffd81020,
  224. .end = 0xffd8102f,
  225. .flags = IORESOURCE_MEM,
  226. },
  227. [1] = {
  228. .start = 21,
  229. .flags = IORESOURCE_IRQ,
  230. },
  231. };
  232. static struct platform_device tmu5_device = {
  233. .name = "sh_tmu",
  234. .id = 5,
  235. .dev = {
  236. .platform_data = &tmu5_platform_data,
  237. },
  238. .resource = tmu5_resources,
  239. .num_resources = ARRAY_SIZE(tmu5_resources),
  240. };
  241. static struct sh_timer_config tmu6_platform_data = {
  242. .name = "TMU6",
  243. .channel_offset = 0x04,
  244. .timer_bit = 0,
  245. .clk = "module_clk",
  246. };
  247. static struct resource tmu6_resources[] = {
  248. [0] = {
  249. .name = "TMU6",
  250. .start = 0xffd82008,
  251. .end = 0xffd82013,
  252. .flags = IORESOURCE_MEM,
  253. },
  254. [1] = {
  255. .start = 22,
  256. .flags = IORESOURCE_IRQ,
  257. },
  258. };
  259. static struct platform_device tmu6_device = {
  260. .name = "sh_tmu",
  261. .id = 6,
  262. .dev = {
  263. .platform_data = &tmu6_platform_data,
  264. },
  265. .resource = tmu6_resources,
  266. .num_resources = ARRAY_SIZE(tmu6_resources),
  267. };
  268. static struct sh_timer_config tmu7_platform_data = {
  269. .name = "TMU7",
  270. .channel_offset = 0x10,
  271. .timer_bit = 1,
  272. .clk = "module_clk",
  273. };
  274. static struct resource tmu7_resources[] = {
  275. [0] = {
  276. .name = "TMU7",
  277. .start = 0xffd82014,
  278. .end = 0xffd8201f,
  279. .flags = IORESOURCE_MEM,
  280. },
  281. [1] = {
  282. .start = 23,
  283. .flags = IORESOURCE_IRQ,
  284. },
  285. };
  286. static struct platform_device tmu7_device = {
  287. .name = "sh_tmu",
  288. .id = 7,
  289. .dev = {
  290. .platform_data = &tmu7_platform_data,
  291. },
  292. .resource = tmu7_resources,
  293. .num_resources = ARRAY_SIZE(tmu7_resources),
  294. };
  295. static struct sh_timer_config tmu8_platform_data = {
  296. .name = "TMU8",
  297. .channel_offset = 0x1c,
  298. .timer_bit = 2,
  299. .clk = "module_clk",
  300. };
  301. static struct resource tmu8_resources[] = {
  302. [0] = {
  303. .name = "TMU8",
  304. .start = 0xffd82020,
  305. .end = 0xffd8202b,
  306. .flags = IORESOURCE_MEM,
  307. },
  308. [1] = {
  309. .start = 24,
  310. .flags = IORESOURCE_IRQ,
  311. },
  312. };
  313. static struct platform_device tmu8_device = {
  314. .name = "sh_tmu",
  315. .id = 8,
  316. .dev = {
  317. .platform_data = &tmu8_platform_data,
  318. },
  319. .resource = tmu8_resources,
  320. .num_resources = ARRAY_SIZE(tmu8_resources),
  321. };
  322. static struct platform_device *sh7770_devices[] __initdata = {
  323. &tmu0_device,
  324. &tmu1_device,
  325. &tmu2_device,
  326. &tmu3_device,
  327. &tmu4_device,
  328. &tmu5_device,
  329. &tmu6_device,
  330. &tmu7_device,
  331. &tmu8_device,
  332. &sci_device,
  333. };
  334. static int __init sh7770_devices_setup(void)
  335. {
  336. return platform_add_devices(sh7770_devices,
  337. ARRAY_SIZE(sh7770_devices));
  338. }
  339. __initcall(sh7770_devices_setup);
  340. static struct platform_device *sh7770_early_devices[] __initdata = {
  341. &tmu0_device,
  342. &tmu1_device,
  343. &tmu2_device,
  344. &tmu3_device,
  345. &tmu4_device,
  346. &tmu5_device,
  347. &tmu6_device,
  348. &tmu7_device,
  349. &tmu8_device,
  350. };
  351. void __init plat_early_device_setup(void)
  352. {
  353. early_platform_add_devices(sh7770_early_devices,
  354. ARRAY_SIZE(sh7770_early_devices));
  355. }
  356. void __init plat_irq_setup(void)
  357. {
  358. }