setup-sh7264.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * SH7264 Setup
  3. *
  4. * Copyright (C) 2012 Renesas Electronics Europe Ltd
  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/usb/r8a66597.h>
  15. #include <linux/sh_timer.h>
  16. #include <linux/io.h>
  17. enum {
  18. UNUSED = 0,
  19. /* interrupt sources */
  20. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  21. PINT0, PINT1, PINT2, PINT3, PINT4, PINT5, PINT6, PINT7,
  22. DMAC0, DMAC1, DMAC2, DMAC3, DMAC4, DMAC5, DMAC6, DMAC7,
  23. DMAC8, DMAC9, DMAC10, DMAC11, DMAC12, DMAC13, DMAC14, DMAC15,
  24. USB, VDC3, CMT0, CMT1, BSC, WDT,
  25. MTU0_ABCD, MTU0_VEF, MTU1_AB, MTU1_VU, MTU2_AB, MTU2_VU,
  26. MTU3_ABCD, MTU3_TCI3V, MTU4_ABCD, MTU4_TCI4V,
  27. PWMT1, PWMT2, ADC_ADI,
  28. SSIF0, SSII1, SSII2, SSII3,
  29. RSPDIF,
  30. IIC30, IIC31, IIC32, IIC33,
  31. SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI,
  32. SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI,
  33. SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI,
  34. SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI,
  35. SCIF4_BRI, SCIF4_ERI, SCIF4_RXI, SCIF4_TXI,
  36. SCIF5_BRI, SCIF5_ERI, SCIF5_RXI, SCIF5_TXI,
  37. SCIF6_BRI, SCIF6_ERI, SCIF6_RXI, SCIF6_TXI,
  38. SCIF7_BRI, SCIF7_ERI, SCIF7_RXI, SCIF7_TXI,
  39. SIO_FIFO, RSPIC0, RSPIC1,
  40. RCAN0, RCAN1, IEBC, CD_ROMD,
  41. NFMC, SDHI, RTC,
  42. SRCC0, SRCC1, DCOMU, OFFI, IFEI,
  43. /* interrupt groups */
  44. PINT, SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7,
  45. };
  46. static struct intc_vect vectors[] __initdata = {
  47. INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
  48. INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
  49. INTC_IRQ(IRQ4, 68), INTC_IRQ(IRQ5, 69),
  50. INTC_IRQ(IRQ6, 70), INTC_IRQ(IRQ7, 71),
  51. INTC_IRQ(PINT0, 80), INTC_IRQ(PINT1, 81),
  52. INTC_IRQ(PINT2, 82), INTC_IRQ(PINT3, 83),
  53. INTC_IRQ(PINT4, 84), INTC_IRQ(PINT5, 85),
  54. INTC_IRQ(PINT6, 86), INTC_IRQ(PINT7, 87),
  55. INTC_IRQ(DMAC0, 108), INTC_IRQ(DMAC0, 109),
  56. INTC_IRQ(DMAC1, 112), INTC_IRQ(DMAC1, 113),
  57. INTC_IRQ(DMAC2, 116), INTC_IRQ(DMAC2, 117),
  58. INTC_IRQ(DMAC3, 120), INTC_IRQ(DMAC3, 121),
  59. INTC_IRQ(DMAC4, 124), INTC_IRQ(DMAC4, 125),
  60. INTC_IRQ(DMAC5, 128), INTC_IRQ(DMAC5, 129),
  61. INTC_IRQ(DMAC6, 132), INTC_IRQ(DMAC6, 133),
  62. INTC_IRQ(DMAC7, 136), INTC_IRQ(DMAC7, 137),
  63. INTC_IRQ(DMAC8, 140), INTC_IRQ(DMAC8, 141),
  64. INTC_IRQ(DMAC9, 144), INTC_IRQ(DMAC9, 145),
  65. INTC_IRQ(DMAC10, 148), INTC_IRQ(DMAC10, 149),
  66. INTC_IRQ(DMAC11, 152), INTC_IRQ(DMAC11, 153),
  67. INTC_IRQ(DMAC12, 156), INTC_IRQ(DMAC12, 157),
  68. INTC_IRQ(DMAC13, 160), INTC_IRQ(DMAC13, 161),
  69. INTC_IRQ(DMAC14, 164), INTC_IRQ(DMAC14, 165),
  70. INTC_IRQ(DMAC15, 168), INTC_IRQ(DMAC15, 169),
  71. INTC_IRQ(USB, 170),
  72. INTC_IRQ(VDC3, 171), INTC_IRQ(VDC3, 172),
  73. INTC_IRQ(VDC3, 173), INTC_IRQ(VDC3, 174),
  74. INTC_IRQ(CMT0, 175), INTC_IRQ(CMT1, 176),
  75. INTC_IRQ(BSC, 177), INTC_IRQ(WDT, 178),
  76. INTC_IRQ(MTU0_ABCD, 179), INTC_IRQ(MTU0_ABCD, 180),
  77. INTC_IRQ(MTU0_ABCD, 181), INTC_IRQ(MTU0_ABCD, 182),
  78. INTC_IRQ(MTU0_VEF, 183),
  79. INTC_IRQ(MTU0_VEF, 184), INTC_IRQ(MTU0_VEF, 185),
  80. INTC_IRQ(MTU1_AB, 186), INTC_IRQ(MTU1_AB, 187),
  81. INTC_IRQ(MTU1_VU, 188), INTC_IRQ(MTU1_VU, 189),
  82. INTC_IRQ(MTU2_AB, 190), INTC_IRQ(MTU2_AB, 191),
  83. INTC_IRQ(MTU2_VU, 192), INTC_IRQ(MTU2_VU, 193),
  84. INTC_IRQ(MTU3_ABCD, 194), INTC_IRQ(MTU3_ABCD, 195),
  85. INTC_IRQ(MTU3_ABCD, 196), INTC_IRQ(MTU3_ABCD, 197),
  86. INTC_IRQ(MTU3_TCI3V, 198),
  87. INTC_IRQ(MTU4_ABCD, 199), INTC_IRQ(MTU4_ABCD, 200),
  88. INTC_IRQ(MTU4_ABCD, 201), INTC_IRQ(MTU4_ABCD, 202),
  89. INTC_IRQ(MTU4_TCI4V, 203),
  90. INTC_IRQ(PWMT1, 204), INTC_IRQ(PWMT2, 205),
  91. INTC_IRQ(ADC_ADI, 206),
  92. INTC_IRQ(SSIF0, 207), INTC_IRQ(SSIF0, 208),
  93. INTC_IRQ(SSIF0, 209),
  94. INTC_IRQ(SSII1, 210), INTC_IRQ(SSII1, 211),
  95. INTC_IRQ(SSII2, 212), INTC_IRQ(SSII2, 213),
  96. INTC_IRQ(SSII3, 214), INTC_IRQ(SSII3, 215),
  97. INTC_IRQ(RSPDIF, 216),
  98. INTC_IRQ(IIC30, 217), INTC_IRQ(IIC30, 218),
  99. INTC_IRQ(IIC30, 219), INTC_IRQ(IIC30, 220),
  100. INTC_IRQ(IIC30, 221),
  101. INTC_IRQ(IIC31, 222), INTC_IRQ(IIC31, 223),
  102. INTC_IRQ(IIC31, 224), INTC_IRQ(IIC31, 225),
  103. INTC_IRQ(IIC31, 226),
  104. INTC_IRQ(IIC32, 227), INTC_IRQ(IIC32, 228),
  105. INTC_IRQ(IIC32, 229), INTC_IRQ(IIC32, 230),
  106. INTC_IRQ(IIC32, 231),
  107. INTC_IRQ(SCIF0_BRI, 232), INTC_IRQ(SCIF0_ERI, 233),
  108. INTC_IRQ(SCIF0_RXI, 234), INTC_IRQ(SCIF0_TXI, 235),
  109. INTC_IRQ(SCIF1_BRI, 236), INTC_IRQ(SCIF1_ERI, 237),
  110. INTC_IRQ(SCIF1_RXI, 238), INTC_IRQ(SCIF1_TXI, 239),
  111. INTC_IRQ(SCIF2_BRI, 240), INTC_IRQ(SCIF2_ERI, 241),
  112. INTC_IRQ(SCIF2_RXI, 242), INTC_IRQ(SCIF2_TXI, 243),
  113. INTC_IRQ(SCIF3_BRI, 244), INTC_IRQ(SCIF3_ERI, 245),
  114. INTC_IRQ(SCIF3_RXI, 246), INTC_IRQ(SCIF3_TXI, 247),
  115. INTC_IRQ(SCIF4_BRI, 248), INTC_IRQ(SCIF4_ERI, 249),
  116. INTC_IRQ(SCIF4_RXI, 250), INTC_IRQ(SCIF4_TXI, 251),
  117. INTC_IRQ(SCIF5_BRI, 252), INTC_IRQ(SCIF5_ERI, 253),
  118. INTC_IRQ(SCIF5_RXI, 254), INTC_IRQ(SCIF5_TXI, 255),
  119. INTC_IRQ(SCIF6_BRI, 256), INTC_IRQ(SCIF6_ERI, 257),
  120. INTC_IRQ(SCIF6_RXI, 258), INTC_IRQ(SCIF6_TXI, 259),
  121. INTC_IRQ(SCIF7_BRI, 260), INTC_IRQ(SCIF7_ERI, 261),
  122. INTC_IRQ(SCIF7_RXI, 262), INTC_IRQ(SCIF7_TXI, 263),
  123. INTC_IRQ(SIO_FIFO, 264),
  124. INTC_IRQ(RSPIC0, 265), INTC_IRQ(RSPIC0, 266),
  125. INTC_IRQ(RSPIC0, 267),
  126. INTC_IRQ(RSPIC1, 268), INTC_IRQ(RSPIC1, 269),
  127. INTC_IRQ(RSPIC1, 270),
  128. INTC_IRQ(RCAN0, 271), INTC_IRQ(RCAN0, 272),
  129. INTC_IRQ(RCAN0, 273), INTC_IRQ(RCAN0, 274),
  130. INTC_IRQ(RCAN0, 275),
  131. INTC_IRQ(RCAN1, 276), INTC_IRQ(RCAN1, 277),
  132. INTC_IRQ(RCAN1, 278), INTC_IRQ(RCAN1, 279),
  133. INTC_IRQ(RCAN1, 280),
  134. INTC_IRQ(IEBC, 281),
  135. INTC_IRQ(CD_ROMD, 282), INTC_IRQ(CD_ROMD, 283),
  136. INTC_IRQ(CD_ROMD, 284), INTC_IRQ(CD_ROMD, 285),
  137. INTC_IRQ(CD_ROMD, 286), INTC_IRQ(CD_ROMD, 287),
  138. INTC_IRQ(NFMC, 288), INTC_IRQ(NFMC, 289),
  139. INTC_IRQ(NFMC, 290), INTC_IRQ(NFMC, 291),
  140. INTC_IRQ(SDHI, 292), INTC_IRQ(SDHI, 293),
  141. INTC_IRQ(SDHI, 294),
  142. INTC_IRQ(RTC, 296), INTC_IRQ(RTC, 297),
  143. INTC_IRQ(RTC, 298),
  144. INTC_IRQ(SRCC0, 299), INTC_IRQ(SRCC0, 300),
  145. INTC_IRQ(SRCC0, 301), INTC_IRQ(SRCC0, 302),
  146. INTC_IRQ(SRCC0, 303),
  147. INTC_IRQ(SRCC1, 304), INTC_IRQ(SRCC1, 305),
  148. INTC_IRQ(SRCC1, 306), INTC_IRQ(SRCC1, 307),
  149. INTC_IRQ(SRCC1, 308),
  150. INTC_IRQ(DCOMU, 310), INTC_IRQ(DCOMU, 311),
  151. INTC_IRQ(DCOMU, 312),
  152. };
  153. static struct intc_group groups[] __initdata = {
  154. INTC_GROUP(PINT, PINT0, PINT1, PINT2, PINT3,
  155. PINT4, PINT5, PINT6, PINT7),
  156. INTC_GROUP(SCIF0, SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI),
  157. INTC_GROUP(SCIF1, SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI),
  158. INTC_GROUP(SCIF2, SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI),
  159. INTC_GROUP(SCIF3, SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI),
  160. INTC_GROUP(SCIF4, SCIF4_BRI, SCIF4_ERI, SCIF4_RXI, SCIF4_TXI),
  161. INTC_GROUP(SCIF5, SCIF5_BRI, SCIF5_ERI, SCIF5_RXI, SCIF5_TXI),
  162. INTC_GROUP(SCIF6, SCIF6_BRI, SCIF6_ERI, SCIF6_RXI, SCIF6_TXI),
  163. INTC_GROUP(SCIF7, SCIF7_BRI, SCIF7_ERI, SCIF7_RXI, SCIF7_TXI),
  164. };
  165. static struct intc_prio_reg prio_registers[] __initdata = {
  166. { 0xfffe0818, 0, 16, 4, /* IPR01 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
  167. { 0xfffe081a, 0, 16, 4, /* IPR02 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
  168. { 0xfffe0820, 0, 16, 4, /* IPR05 */ { PINT, 0, 0, 0 } },
  169. { 0xfffe0c00, 0, 16, 4, /* IPR06 */ { DMAC0, DMAC1, DMAC2, DMAC3 } },
  170. { 0xfffe0c02, 0, 16, 4, /* IPR07 */ { DMAC4, DMAC5, DMAC6, DMAC7 } },
  171. { 0xfffe0c04, 0, 16, 4, /* IPR08 */ { DMAC8, DMAC9,
  172. DMAC10, DMAC11 } },
  173. { 0xfffe0c06, 0, 16, 4, /* IPR09 */ { DMAC12, DMAC13,
  174. DMAC14, DMAC15 } },
  175. { 0xfffe0c08, 0, 16, 4, /* IPR10 */ { USB, VDC3, CMT0, CMT1 } },
  176. { 0xfffe0c0a, 0, 16, 4, /* IPR11 */ { BSC, WDT, MTU0_ABCD, MTU0_VEF } },
  177. { 0xfffe0c0c, 0, 16, 4, /* IPR12 */ { MTU1_AB, MTU1_VU,
  178. MTU2_AB, MTU2_VU } },
  179. { 0xfffe0c0e, 0, 16, 4, /* IPR13 */ { MTU3_ABCD, MTU3_TCI3V,
  180. MTU4_ABCD, MTU4_TCI4V } },
  181. { 0xfffe0c10, 0, 16, 4, /* IPR14 */ { PWMT1, PWMT2, ADC_ADI, 0 } },
  182. { 0xfffe0c12, 0, 16, 4, /* IPR15 */ { SSIF0, SSII1, SSII2, SSII3 } },
  183. { 0xfffe0c14, 0, 16, 4, /* IPR16 */ { RSPDIF, IIC30, IIC31, IIC32 } },
  184. { 0xfffe0c16, 0, 16, 4, /* IPR17 */ { SCIF0, SCIF1, SCIF2, SCIF3 } },
  185. { 0xfffe0c18, 0, 16, 4, /* IPR18 */ { SCIF4, SCIF5, SCIF6, SCIF7 } },
  186. { 0xfffe0c1a, 0, 16, 4, /* IPR19 */ { SIO_FIFO, 0, RSPIC0, RSPIC1, } },
  187. { 0xfffe0c1c, 0, 16, 4, /* IPR20 */ { RCAN0, RCAN1, IEBC, CD_ROMD } },
  188. { 0xfffe0c1e, 0, 16, 4, /* IPR21 */ { NFMC, SDHI, RTC, 0 } },
  189. { 0xfffe0c20, 0, 16, 4, /* IPR22 */ { SRCC0, SRCC1, 0, DCOMU } },
  190. };
  191. static struct intc_mask_reg mask_registers[] __initdata = {
  192. { 0xfffe0808, 0, 16, /* PINTER */
  193. { 0, 0, 0, 0, 0, 0, 0, 0,
  194. PINT7, PINT6, PINT5, PINT4, PINT3, PINT2, PINT1, PINT0 } },
  195. };
  196. static DECLARE_INTC_DESC(intc_desc, "sh7264", vectors, groups,
  197. mask_registers, prio_registers, NULL);
  198. static struct plat_sci_port scif0_platform_data = {
  199. .flags = UPF_BOOT_AUTOCONF,
  200. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  201. SCSCR_REIE | SCSCR_TOIE,
  202. .type = PORT_SCIF,
  203. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  204. };
  205. static struct resource scif0_resources[] = {
  206. DEFINE_RES_MEM(0xfffe8000, 0x100),
  207. DEFINE_RES_IRQ(233),
  208. DEFINE_RES_IRQ(234),
  209. DEFINE_RES_IRQ(235),
  210. DEFINE_RES_IRQ(232),
  211. };
  212. static struct platform_device scif0_device = {
  213. .name = "sh-sci",
  214. .id = 0,
  215. .resource = scif0_resources,
  216. .num_resources = ARRAY_SIZE(scif0_resources),
  217. .dev = {
  218. .platform_data = &scif0_platform_data,
  219. },
  220. };
  221. static struct plat_sci_port scif1_platform_data = {
  222. .flags = UPF_BOOT_AUTOCONF,
  223. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  224. SCSCR_REIE | SCSCR_TOIE,
  225. .type = PORT_SCIF,
  226. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  227. };
  228. static struct resource scif1_resources[] = {
  229. DEFINE_RES_MEM(0xfffe8800, 0x100),
  230. DEFINE_RES_IRQ(237),
  231. DEFINE_RES_IRQ(238),
  232. DEFINE_RES_IRQ(239),
  233. DEFINE_RES_IRQ(236),
  234. };
  235. static struct platform_device scif1_device = {
  236. .name = "sh-sci",
  237. .id = 1,
  238. .resource = scif1_resources,
  239. .num_resources = ARRAY_SIZE(scif1_resources),
  240. .dev = {
  241. .platform_data = &scif1_platform_data,
  242. },
  243. };
  244. static struct plat_sci_port scif2_platform_data = {
  245. .flags = UPF_BOOT_AUTOCONF,
  246. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  247. SCSCR_REIE | SCSCR_TOIE,
  248. .type = PORT_SCIF,
  249. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  250. };
  251. static struct resource scif2_resources[] = {
  252. DEFINE_RES_MEM(0xfffe9000, 0x100),
  253. DEFINE_RES_IRQ(241),
  254. DEFINE_RES_IRQ(242),
  255. DEFINE_RES_IRQ(243),
  256. DEFINE_RES_IRQ(240),
  257. };
  258. static struct platform_device scif2_device = {
  259. .name = "sh-sci",
  260. .id = 2,
  261. .resource = scif2_resources,
  262. .num_resources = ARRAY_SIZE(scif2_resources),
  263. .dev = {
  264. .platform_data = &scif2_platform_data,
  265. },
  266. };
  267. static struct plat_sci_port scif3_platform_data = {
  268. .flags = UPF_BOOT_AUTOCONF,
  269. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  270. SCSCR_REIE | SCSCR_TOIE,
  271. .type = PORT_SCIF,
  272. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  273. };
  274. static struct resource scif3_resources[] = {
  275. DEFINE_RES_MEM(0xfffe9800, 0x100),
  276. DEFINE_RES_IRQ(245),
  277. DEFINE_RES_IRQ(246),
  278. DEFINE_RES_IRQ(247),
  279. DEFINE_RES_IRQ(244),
  280. };
  281. static struct platform_device scif3_device = {
  282. .name = "sh-sci",
  283. .id = 3,
  284. .resource = scif3_resources,
  285. .num_resources = ARRAY_SIZE(scif3_resources),
  286. .dev = {
  287. .platform_data = &scif3_platform_data,
  288. },
  289. };
  290. static struct plat_sci_port scif4_platform_data = {
  291. .flags = UPF_BOOT_AUTOCONF,
  292. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  293. SCSCR_REIE | SCSCR_TOIE,
  294. .type = PORT_SCIF,
  295. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  296. };
  297. static struct resource scif4_resources[] = {
  298. DEFINE_RES_MEM(0xfffea000, 0x100),
  299. DEFINE_RES_IRQ(249),
  300. DEFINE_RES_IRQ(250),
  301. DEFINE_RES_IRQ(251),
  302. DEFINE_RES_IRQ(248),
  303. };
  304. static struct platform_device scif4_device = {
  305. .name = "sh-sci",
  306. .id = 4,
  307. .resource = scif4_resources,
  308. .num_resources = ARRAY_SIZE(scif4_resources),
  309. .dev = {
  310. .platform_data = &scif4_platform_data,
  311. },
  312. };
  313. static struct plat_sci_port scif5_platform_data = {
  314. .flags = UPF_BOOT_AUTOCONF,
  315. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  316. SCSCR_REIE | SCSCR_TOIE,
  317. .type = PORT_SCIF,
  318. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  319. };
  320. static struct resource scif5_resources[] = {
  321. DEFINE_RES_MEM(0xfffea800, 0x100),
  322. DEFINE_RES_IRQ(253),
  323. DEFINE_RES_IRQ(254),
  324. DEFINE_RES_IRQ(255),
  325. DEFINE_RES_IRQ(252),
  326. };
  327. static struct platform_device scif5_device = {
  328. .name = "sh-sci",
  329. .id = 5,
  330. .resource = scif5_resources,
  331. .num_resources = ARRAY_SIZE(scif5_resources),
  332. .dev = {
  333. .platform_data = &scif5_platform_data,
  334. },
  335. };
  336. static struct plat_sci_port scif6_platform_data = {
  337. .flags = UPF_BOOT_AUTOCONF,
  338. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  339. SCSCR_REIE | SCSCR_TOIE,
  340. .type = PORT_SCIF,
  341. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  342. };
  343. static struct resource scif6_resources[] = {
  344. DEFINE_RES_MEM(0xfffeb000, 0x100),
  345. DEFINE_RES_IRQ(257),
  346. DEFINE_RES_IRQ(258),
  347. DEFINE_RES_IRQ(259),
  348. DEFINE_RES_IRQ(256),
  349. };
  350. static struct platform_device scif6_device = {
  351. .name = "sh-sci",
  352. .id = 6,
  353. .resource = scif6_resources,
  354. .num_resources = ARRAY_SIZE(scif6_resources),
  355. .dev = {
  356. .platform_data = &scif6_platform_data,
  357. },
  358. };
  359. static struct plat_sci_port scif7_platform_data = {
  360. .flags = UPF_BOOT_AUTOCONF,
  361. .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
  362. SCSCR_REIE | SCSCR_TOIE,
  363. .type = PORT_SCIF,
  364. .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
  365. };
  366. static struct resource scif7_resources[] = {
  367. DEFINE_RES_MEM(0xfffeb800, 0x100),
  368. DEFINE_RES_IRQ(261),
  369. DEFINE_RES_IRQ(262),
  370. DEFINE_RES_IRQ(263),
  371. DEFINE_RES_IRQ(260),
  372. };
  373. static struct platform_device scif7_device = {
  374. .name = "sh-sci",
  375. .id = 7,
  376. .resource = scif7_resources,
  377. .num_resources = ARRAY_SIZE(scif7_resources),
  378. .dev = {
  379. .platform_data = &scif7_platform_data,
  380. },
  381. };
  382. static struct sh_timer_config cmt_platform_data = {
  383. .channels_mask = 3,
  384. };
  385. static struct resource cmt_resources[] = {
  386. DEFINE_RES_MEM(0xfffec000, 0x10),
  387. DEFINE_RES_IRQ(175),
  388. DEFINE_RES_IRQ(176),
  389. };
  390. static struct platform_device cmt_device = {
  391. .name = "sh-cmt-16",
  392. .id = 0,
  393. .dev = {
  394. .platform_data = &cmt_platform_data,
  395. },
  396. .resource = cmt_resources,
  397. .num_resources = ARRAY_SIZE(cmt_resources),
  398. };
  399. static struct resource mtu2_resources[] = {
  400. DEFINE_RES_MEM(0xfffe4000, 0x400),
  401. DEFINE_RES_IRQ_NAMED(179, "tgi0a"),
  402. DEFINE_RES_IRQ_NAMED(186, "tgi1a"),
  403. };
  404. static struct platform_device mtu2_device = {
  405. .name = "sh-mtu2",
  406. .id = -1,
  407. .resource = mtu2_resources,
  408. .num_resources = ARRAY_SIZE(mtu2_resources),
  409. };
  410. static struct resource rtc_resources[] = {
  411. [0] = {
  412. .start = 0xfffe6000,
  413. .end = 0xfffe6000 + 0x30 - 1,
  414. .flags = IORESOURCE_IO,
  415. },
  416. [1] = {
  417. /* Shared Period/Carry/Alarm IRQ */
  418. .start = 296,
  419. .flags = IORESOURCE_IRQ,
  420. },
  421. };
  422. static struct platform_device rtc_device = {
  423. .name = "sh-rtc",
  424. .id = -1,
  425. .num_resources = ARRAY_SIZE(rtc_resources),
  426. .resource = rtc_resources,
  427. };
  428. /* USB Host */
  429. static void usb_port_power(int port, int power)
  430. {
  431. __raw_writew(0x200 , 0xffffc0c2) ; /* Initialise UACS25 */
  432. }
  433. static struct r8a66597_platdata r8a66597_data = {
  434. .on_chip = 1,
  435. .endian = 1,
  436. .port_power = usb_port_power,
  437. };
  438. static struct resource r8a66597_usb_host_resources[] = {
  439. [0] = {
  440. .start = 0xffffc000,
  441. .end = 0xffffc0e4,
  442. .flags = IORESOURCE_MEM,
  443. },
  444. [1] = {
  445. .start = 170,
  446. .end = 170,
  447. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  448. },
  449. };
  450. static struct platform_device r8a66597_usb_host_device = {
  451. .name = "r8a66597_hcd",
  452. .id = 0,
  453. .dev = {
  454. .dma_mask = NULL, /* not use dma */
  455. .coherent_dma_mask = 0xffffffff,
  456. .platform_data = &r8a66597_data,
  457. },
  458. .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
  459. .resource = r8a66597_usb_host_resources,
  460. };
  461. static struct platform_device *sh7264_devices[] __initdata = {
  462. &scif0_device,
  463. &scif1_device,
  464. &scif2_device,
  465. &scif3_device,
  466. &scif4_device,
  467. &scif5_device,
  468. &scif6_device,
  469. &scif7_device,
  470. &cmt_device,
  471. &mtu2_device,
  472. &rtc_device,
  473. &r8a66597_usb_host_device,
  474. };
  475. static int __init sh7264_devices_setup(void)
  476. {
  477. return platform_add_devices(sh7264_devices,
  478. ARRAY_SIZE(sh7264_devices));
  479. }
  480. arch_initcall(sh7264_devices_setup);
  481. void __init plat_irq_setup(void)
  482. {
  483. register_intc_controller(&intc_desc);
  484. }
  485. static struct platform_device *sh7264_early_devices[] __initdata = {
  486. &scif0_device,
  487. &scif1_device,
  488. &scif2_device,
  489. &scif3_device,
  490. &scif4_device,
  491. &scif5_device,
  492. &scif6_device,
  493. &scif7_device,
  494. &cmt_device,
  495. &mtu2_device,
  496. };
  497. void __init plat_early_device_setup(void)
  498. {
  499. early_platform_add_devices(sh7264_early_devices,
  500. ARRAY_SIZE(sh7264_early_devices));
  501. }