setup-sh7269.c 17 KB

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