setup-sh7372.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  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/uio_driver.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_dma.h>
  31. #include <linux/sh_intc.h>
  32. #include <linux/sh_timer.h>
  33. #include <mach/hardware.h>
  34. #include <mach/sh7372.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. /* SCIFA0 */
  38. static struct plat_sci_port scif0_platform_data = {
  39. .mapbase = 0xe6c40000,
  40. .flags = UPF_BOOT_AUTOCONF,
  41. .scscr = SCSCR_RE | SCSCR_TE,
  42. .scbrr_algo_id = SCBRR_ALGO_4,
  43. .type = PORT_SCIFA,
  44. .irqs = { evt2irq(0x0c00), evt2irq(0x0c00),
  45. evt2irq(0x0c00), evt2irq(0x0c00) },
  46. };
  47. static struct platform_device scif0_device = {
  48. .name = "sh-sci",
  49. .id = 0,
  50. .dev = {
  51. .platform_data = &scif0_platform_data,
  52. },
  53. };
  54. /* SCIFA1 */
  55. static struct plat_sci_port scif1_platform_data = {
  56. .mapbase = 0xe6c50000,
  57. .flags = UPF_BOOT_AUTOCONF,
  58. .scscr = SCSCR_RE | SCSCR_TE,
  59. .scbrr_algo_id = SCBRR_ALGO_4,
  60. .type = PORT_SCIFA,
  61. .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
  62. evt2irq(0x0c20), evt2irq(0x0c20) },
  63. };
  64. static struct platform_device scif1_device = {
  65. .name = "sh-sci",
  66. .id = 1,
  67. .dev = {
  68. .platform_data = &scif1_platform_data,
  69. },
  70. };
  71. /* SCIFA2 */
  72. static struct plat_sci_port scif2_platform_data = {
  73. .mapbase = 0xe6c60000,
  74. .flags = UPF_BOOT_AUTOCONF,
  75. .scscr = SCSCR_RE | SCSCR_TE,
  76. .scbrr_algo_id = SCBRR_ALGO_4,
  77. .type = PORT_SCIFA,
  78. .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
  79. evt2irq(0x0c40), evt2irq(0x0c40) },
  80. };
  81. static struct platform_device scif2_device = {
  82. .name = "sh-sci",
  83. .id = 2,
  84. .dev = {
  85. .platform_data = &scif2_platform_data,
  86. },
  87. };
  88. /* SCIFA3 */
  89. static struct plat_sci_port scif3_platform_data = {
  90. .mapbase = 0xe6c70000,
  91. .flags = UPF_BOOT_AUTOCONF,
  92. .scscr = SCSCR_RE | SCSCR_TE,
  93. .scbrr_algo_id = SCBRR_ALGO_4,
  94. .type = PORT_SCIFA,
  95. .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
  96. evt2irq(0x0c60), evt2irq(0x0c60) },
  97. };
  98. static struct platform_device scif3_device = {
  99. .name = "sh-sci",
  100. .id = 3,
  101. .dev = {
  102. .platform_data = &scif3_platform_data,
  103. },
  104. };
  105. /* SCIFA4 */
  106. static struct plat_sci_port scif4_platform_data = {
  107. .mapbase = 0xe6c80000,
  108. .flags = UPF_BOOT_AUTOCONF,
  109. .scscr = SCSCR_RE | SCSCR_TE,
  110. .scbrr_algo_id = SCBRR_ALGO_4,
  111. .type = PORT_SCIFA,
  112. .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
  113. evt2irq(0x0d20), evt2irq(0x0d20) },
  114. };
  115. static struct platform_device scif4_device = {
  116. .name = "sh-sci",
  117. .id = 4,
  118. .dev = {
  119. .platform_data = &scif4_platform_data,
  120. },
  121. };
  122. /* SCIFA5 */
  123. static struct plat_sci_port scif5_platform_data = {
  124. .mapbase = 0xe6cb0000,
  125. .flags = UPF_BOOT_AUTOCONF,
  126. .scscr = SCSCR_RE | SCSCR_TE,
  127. .scbrr_algo_id = SCBRR_ALGO_4,
  128. .type = PORT_SCIFA,
  129. .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
  130. evt2irq(0x0d40), evt2irq(0x0d40) },
  131. };
  132. static struct platform_device scif5_device = {
  133. .name = "sh-sci",
  134. .id = 5,
  135. .dev = {
  136. .platform_data = &scif5_platform_data,
  137. },
  138. };
  139. /* SCIFB */
  140. static struct plat_sci_port scif6_platform_data = {
  141. .mapbase = 0xe6c30000,
  142. .flags = UPF_BOOT_AUTOCONF,
  143. .scscr = SCSCR_RE | SCSCR_TE,
  144. .scbrr_algo_id = SCBRR_ALGO_4,
  145. .type = PORT_SCIFB,
  146. .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
  147. evt2irq(0x0d60), evt2irq(0x0d60) },
  148. };
  149. static struct platform_device scif6_device = {
  150. .name = "sh-sci",
  151. .id = 6,
  152. .dev = {
  153. .platform_data = &scif6_platform_data,
  154. },
  155. };
  156. /* CMT */
  157. static struct sh_timer_config cmt10_platform_data = {
  158. .name = "CMT10",
  159. .channel_offset = 0x10,
  160. .timer_bit = 0,
  161. .clockevent_rating = 125,
  162. .clocksource_rating = 125,
  163. };
  164. static struct resource cmt10_resources[] = {
  165. [0] = {
  166. .name = "CMT10",
  167. .start = 0xe6138010,
  168. .end = 0xe613801b,
  169. .flags = IORESOURCE_MEM,
  170. },
  171. [1] = {
  172. .start = evt2irq(0x0b00), /* CMT1_CMT10 */
  173. .flags = IORESOURCE_IRQ,
  174. },
  175. };
  176. static struct platform_device cmt10_device = {
  177. .name = "sh_cmt",
  178. .id = 10,
  179. .dev = {
  180. .platform_data = &cmt10_platform_data,
  181. },
  182. .resource = cmt10_resources,
  183. .num_resources = ARRAY_SIZE(cmt10_resources),
  184. };
  185. /* TMU */
  186. static struct sh_timer_config tmu00_platform_data = {
  187. .name = "TMU00",
  188. .channel_offset = 0x4,
  189. .timer_bit = 0,
  190. .clockevent_rating = 200,
  191. };
  192. static struct resource tmu00_resources[] = {
  193. [0] = {
  194. .name = "TMU00",
  195. .start = 0xfff60008,
  196. .end = 0xfff60013,
  197. .flags = IORESOURCE_MEM,
  198. },
  199. [1] = {
  200. .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
  201. .flags = IORESOURCE_IRQ,
  202. },
  203. };
  204. static struct platform_device tmu00_device = {
  205. .name = "sh_tmu",
  206. .id = 0,
  207. .dev = {
  208. .platform_data = &tmu00_platform_data,
  209. },
  210. .resource = tmu00_resources,
  211. .num_resources = ARRAY_SIZE(tmu00_resources),
  212. };
  213. static struct sh_timer_config tmu01_platform_data = {
  214. .name = "TMU01",
  215. .channel_offset = 0x10,
  216. .timer_bit = 1,
  217. .clocksource_rating = 200,
  218. };
  219. static struct resource tmu01_resources[] = {
  220. [0] = {
  221. .name = "TMU01",
  222. .start = 0xfff60014,
  223. .end = 0xfff6001f,
  224. .flags = IORESOURCE_MEM,
  225. },
  226. [1] = {
  227. .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
  228. .flags = IORESOURCE_IRQ,
  229. },
  230. };
  231. static struct platform_device tmu01_device = {
  232. .name = "sh_tmu",
  233. .id = 1,
  234. .dev = {
  235. .platform_data = &tmu01_platform_data,
  236. },
  237. .resource = tmu01_resources,
  238. .num_resources = ARRAY_SIZE(tmu01_resources),
  239. };
  240. /* I2C */
  241. static struct resource iic0_resources[] = {
  242. [0] = {
  243. .name = "IIC0",
  244. .start = 0xFFF20000,
  245. .end = 0xFFF20425 - 1,
  246. .flags = IORESOURCE_MEM,
  247. },
  248. [1] = {
  249. .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
  250. .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
  251. .flags = IORESOURCE_IRQ,
  252. },
  253. };
  254. static struct platform_device iic0_device = {
  255. .name = "i2c-sh_mobile",
  256. .id = 0, /* "i2c0" clock */
  257. .num_resources = ARRAY_SIZE(iic0_resources),
  258. .resource = iic0_resources,
  259. };
  260. static struct resource iic1_resources[] = {
  261. [0] = {
  262. .name = "IIC1",
  263. .start = 0xE6C20000,
  264. .end = 0xE6C20425 - 1,
  265. .flags = IORESOURCE_MEM,
  266. },
  267. [1] = {
  268. .start = evt2irq(0x780), /* IIC1_ALI1 */
  269. .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
  270. .flags = IORESOURCE_IRQ,
  271. },
  272. };
  273. static struct platform_device iic1_device = {
  274. .name = "i2c-sh_mobile",
  275. .id = 1, /* "i2c1" clock */
  276. .num_resources = ARRAY_SIZE(iic1_resources),
  277. .resource = iic1_resources,
  278. };
  279. /* DMA */
  280. /* Transmit sizes and respective CHCR register values */
  281. enum {
  282. XMIT_SZ_8BIT = 0,
  283. XMIT_SZ_16BIT = 1,
  284. XMIT_SZ_32BIT = 2,
  285. XMIT_SZ_64BIT = 7,
  286. XMIT_SZ_128BIT = 3,
  287. XMIT_SZ_256BIT = 4,
  288. XMIT_SZ_512BIT = 5,
  289. };
  290. /* log2(size / 8) - used to calculate number of transfers */
  291. #define TS_SHIFT { \
  292. [XMIT_SZ_8BIT] = 0, \
  293. [XMIT_SZ_16BIT] = 1, \
  294. [XMIT_SZ_32BIT] = 2, \
  295. [XMIT_SZ_64BIT] = 3, \
  296. [XMIT_SZ_128BIT] = 4, \
  297. [XMIT_SZ_256BIT] = 5, \
  298. [XMIT_SZ_512BIT] = 6, \
  299. }
  300. #define TS_INDEX2VAL(i) ((((i) & 3) << 3) | \
  301. (((i) & 0xc) << (20 - 2)))
  302. static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
  303. {
  304. .slave_id = SHDMA_SLAVE_SCIF0_TX,
  305. .addr = 0xe6c40020,
  306. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  307. .mid_rid = 0x21,
  308. }, {
  309. .slave_id = SHDMA_SLAVE_SCIF0_RX,
  310. .addr = 0xe6c40024,
  311. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  312. .mid_rid = 0x22,
  313. }, {
  314. .slave_id = SHDMA_SLAVE_SCIF1_TX,
  315. .addr = 0xe6c50020,
  316. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  317. .mid_rid = 0x25,
  318. }, {
  319. .slave_id = SHDMA_SLAVE_SCIF1_RX,
  320. .addr = 0xe6c50024,
  321. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  322. .mid_rid = 0x26,
  323. }, {
  324. .slave_id = SHDMA_SLAVE_SCIF2_TX,
  325. .addr = 0xe6c60020,
  326. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  327. .mid_rid = 0x29,
  328. }, {
  329. .slave_id = SHDMA_SLAVE_SCIF2_RX,
  330. .addr = 0xe6c60024,
  331. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  332. .mid_rid = 0x2a,
  333. }, {
  334. .slave_id = SHDMA_SLAVE_SCIF3_TX,
  335. .addr = 0xe6c70020,
  336. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  337. .mid_rid = 0x2d,
  338. }, {
  339. .slave_id = SHDMA_SLAVE_SCIF3_RX,
  340. .addr = 0xe6c70024,
  341. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  342. .mid_rid = 0x2e,
  343. }, {
  344. .slave_id = SHDMA_SLAVE_SCIF4_TX,
  345. .addr = 0xe6c80020,
  346. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  347. .mid_rid = 0x39,
  348. }, {
  349. .slave_id = SHDMA_SLAVE_SCIF4_RX,
  350. .addr = 0xe6c80024,
  351. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  352. .mid_rid = 0x3a,
  353. }, {
  354. .slave_id = SHDMA_SLAVE_SCIF5_TX,
  355. .addr = 0xe6cb0020,
  356. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  357. .mid_rid = 0x35,
  358. }, {
  359. .slave_id = SHDMA_SLAVE_SCIF5_RX,
  360. .addr = 0xe6cb0024,
  361. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  362. .mid_rid = 0x36,
  363. }, {
  364. .slave_id = SHDMA_SLAVE_SCIF6_TX,
  365. .addr = 0xe6c30040,
  366. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  367. .mid_rid = 0x3d,
  368. }, {
  369. .slave_id = SHDMA_SLAVE_SCIF6_RX,
  370. .addr = 0xe6c30060,
  371. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  372. .mid_rid = 0x3e,
  373. }, {
  374. .slave_id = SHDMA_SLAVE_SDHI0_TX,
  375. .addr = 0xe6850030,
  376. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  377. .mid_rid = 0xc1,
  378. }, {
  379. .slave_id = SHDMA_SLAVE_SDHI0_RX,
  380. .addr = 0xe6850030,
  381. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  382. .mid_rid = 0xc2,
  383. }, {
  384. .slave_id = SHDMA_SLAVE_SDHI1_TX,
  385. .addr = 0xe6860030,
  386. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  387. .mid_rid = 0xc9,
  388. }, {
  389. .slave_id = SHDMA_SLAVE_SDHI1_RX,
  390. .addr = 0xe6860030,
  391. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  392. .mid_rid = 0xca,
  393. }, {
  394. .slave_id = SHDMA_SLAVE_SDHI2_TX,
  395. .addr = 0xe6870030,
  396. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  397. .mid_rid = 0xcd,
  398. }, {
  399. .slave_id = SHDMA_SLAVE_SDHI2_RX,
  400. .addr = 0xe6870030,
  401. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  402. .mid_rid = 0xce,
  403. }, {
  404. .slave_id = SHDMA_SLAVE_MMCIF_TX,
  405. .addr = 0xe6bd0034,
  406. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  407. .mid_rid = 0xd1,
  408. }, {
  409. .slave_id = SHDMA_SLAVE_MMCIF_RX,
  410. .addr = 0xe6bd0034,
  411. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  412. .mid_rid = 0xd2,
  413. },
  414. };
  415. static const struct sh_dmae_channel sh7372_dmae_channels[] = {
  416. {
  417. .offset = 0,
  418. .dmars = 0,
  419. .dmars_bit = 0,
  420. }, {
  421. .offset = 0x10,
  422. .dmars = 0,
  423. .dmars_bit = 8,
  424. }, {
  425. .offset = 0x20,
  426. .dmars = 4,
  427. .dmars_bit = 0,
  428. }, {
  429. .offset = 0x30,
  430. .dmars = 4,
  431. .dmars_bit = 8,
  432. }, {
  433. .offset = 0x50,
  434. .dmars = 8,
  435. .dmars_bit = 0,
  436. }, {
  437. .offset = 0x60,
  438. .dmars = 8,
  439. .dmars_bit = 8,
  440. }
  441. };
  442. static const unsigned int ts_shift[] = TS_SHIFT;
  443. static struct sh_dmae_pdata dma_platform_data = {
  444. .slave = sh7372_dmae_slaves,
  445. .slave_num = ARRAY_SIZE(sh7372_dmae_slaves),
  446. .channel = sh7372_dmae_channels,
  447. .channel_num = ARRAY_SIZE(sh7372_dmae_channels),
  448. .ts_low_shift = 3,
  449. .ts_low_mask = 0x18,
  450. .ts_high_shift = (20 - 2), /* 2 bits for shifted low TS */
  451. .ts_high_mask = 0x00300000,
  452. .ts_shift = ts_shift,
  453. .ts_shift_num = ARRAY_SIZE(ts_shift),
  454. .dmaor_init = DMAOR_DME,
  455. };
  456. /* Resource order important! */
  457. static struct resource sh7372_dmae0_resources[] = {
  458. {
  459. /* Channel registers and DMAOR */
  460. .start = 0xfe008020,
  461. .end = 0xfe00808f,
  462. .flags = IORESOURCE_MEM,
  463. },
  464. {
  465. /* DMARSx */
  466. .start = 0xfe009000,
  467. .end = 0xfe00900b,
  468. .flags = IORESOURCE_MEM,
  469. },
  470. {
  471. /* DMA error IRQ */
  472. .start = evt2irq(0x20c0),
  473. .end = evt2irq(0x20c0),
  474. .flags = IORESOURCE_IRQ,
  475. },
  476. {
  477. /* IRQ for channels 0-5 */
  478. .start = evt2irq(0x2000),
  479. .end = evt2irq(0x20a0),
  480. .flags = IORESOURCE_IRQ,
  481. },
  482. };
  483. /* Resource order important! */
  484. static struct resource sh7372_dmae1_resources[] = {
  485. {
  486. /* Channel registers and DMAOR */
  487. .start = 0xfe018020,
  488. .end = 0xfe01808f,
  489. .flags = IORESOURCE_MEM,
  490. },
  491. {
  492. /* DMARSx */
  493. .start = 0xfe019000,
  494. .end = 0xfe01900b,
  495. .flags = IORESOURCE_MEM,
  496. },
  497. {
  498. /* DMA error IRQ */
  499. .start = evt2irq(0x21c0),
  500. .end = evt2irq(0x21c0),
  501. .flags = IORESOURCE_IRQ,
  502. },
  503. {
  504. /* IRQ for channels 0-5 */
  505. .start = evt2irq(0x2100),
  506. .end = evt2irq(0x21a0),
  507. .flags = IORESOURCE_IRQ,
  508. },
  509. };
  510. /* Resource order important! */
  511. static struct resource sh7372_dmae2_resources[] = {
  512. {
  513. /* Channel registers and DMAOR */
  514. .start = 0xfe028020,
  515. .end = 0xfe02808f,
  516. .flags = IORESOURCE_MEM,
  517. },
  518. {
  519. /* DMARSx */
  520. .start = 0xfe029000,
  521. .end = 0xfe02900b,
  522. .flags = IORESOURCE_MEM,
  523. },
  524. {
  525. /* DMA error IRQ */
  526. .start = evt2irq(0x22c0),
  527. .end = evt2irq(0x22c0),
  528. .flags = IORESOURCE_IRQ,
  529. },
  530. {
  531. /* IRQ for channels 0-5 */
  532. .start = evt2irq(0x2200),
  533. .end = evt2irq(0x22a0),
  534. .flags = IORESOURCE_IRQ,
  535. },
  536. };
  537. static struct platform_device dma0_device = {
  538. .name = "sh-dma-engine",
  539. .id = 0,
  540. .resource = sh7372_dmae0_resources,
  541. .num_resources = ARRAY_SIZE(sh7372_dmae0_resources),
  542. .dev = {
  543. .platform_data = &dma_platform_data,
  544. },
  545. };
  546. static struct platform_device dma1_device = {
  547. .name = "sh-dma-engine",
  548. .id = 1,
  549. .resource = sh7372_dmae1_resources,
  550. .num_resources = ARRAY_SIZE(sh7372_dmae1_resources),
  551. .dev = {
  552. .platform_data = &dma_platform_data,
  553. },
  554. };
  555. static struct platform_device dma2_device = {
  556. .name = "sh-dma-engine",
  557. .id = 2,
  558. .resource = sh7372_dmae2_resources,
  559. .num_resources = ARRAY_SIZE(sh7372_dmae2_resources),
  560. .dev = {
  561. .platform_data = &dma_platform_data,
  562. },
  563. };
  564. /* VPU */
  565. static struct uio_info vpu_platform_data = {
  566. .name = "VPU5HG",
  567. .version = "0",
  568. .irq = intcs_evt2irq(0x980),
  569. };
  570. static struct resource vpu_resources[] = {
  571. [0] = {
  572. .name = "VPU",
  573. .start = 0xfe900000,
  574. .end = 0xfe900157,
  575. .flags = IORESOURCE_MEM,
  576. },
  577. };
  578. static struct platform_device vpu_device = {
  579. .name = "uio_pdrv_genirq",
  580. .id = 0,
  581. .dev = {
  582. .platform_data = &vpu_platform_data,
  583. },
  584. .resource = vpu_resources,
  585. .num_resources = ARRAY_SIZE(vpu_resources),
  586. };
  587. /* VEU0 */
  588. static struct uio_info veu0_platform_data = {
  589. .name = "VEU0",
  590. .version = "0",
  591. .irq = intcs_evt2irq(0x700),
  592. };
  593. static struct resource veu0_resources[] = {
  594. [0] = {
  595. .name = "VEU0",
  596. .start = 0xfe920000,
  597. .end = 0xfe9200cb,
  598. .flags = IORESOURCE_MEM,
  599. },
  600. };
  601. static struct platform_device veu0_device = {
  602. .name = "uio_pdrv_genirq",
  603. .id = 1,
  604. .dev = {
  605. .platform_data = &veu0_platform_data,
  606. },
  607. .resource = veu0_resources,
  608. .num_resources = ARRAY_SIZE(veu0_resources),
  609. };
  610. /* VEU1 */
  611. static struct uio_info veu1_platform_data = {
  612. .name = "VEU1",
  613. .version = "0",
  614. .irq = intcs_evt2irq(0x720),
  615. };
  616. static struct resource veu1_resources[] = {
  617. [0] = {
  618. .name = "VEU1",
  619. .start = 0xfe924000,
  620. .end = 0xfe9240cb,
  621. .flags = IORESOURCE_MEM,
  622. },
  623. };
  624. static struct platform_device veu1_device = {
  625. .name = "uio_pdrv_genirq",
  626. .id = 2,
  627. .dev = {
  628. .platform_data = &veu1_platform_data,
  629. },
  630. .resource = veu1_resources,
  631. .num_resources = ARRAY_SIZE(veu1_resources),
  632. };
  633. /* VEU2 */
  634. static struct uio_info veu2_platform_data = {
  635. .name = "VEU2",
  636. .version = "0",
  637. .irq = intcs_evt2irq(0x740),
  638. };
  639. static struct resource veu2_resources[] = {
  640. [0] = {
  641. .name = "VEU2",
  642. .start = 0xfe928000,
  643. .end = 0xfe928307,
  644. .flags = IORESOURCE_MEM,
  645. },
  646. };
  647. static struct platform_device veu2_device = {
  648. .name = "uio_pdrv_genirq",
  649. .id = 3,
  650. .dev = {
  651. .platform_data = &veu2_platform_data,
  652. },
  653. .resource = veu2_resources,
  654. .num_resources = ARRAY_SIZE(veu2_resources),
  655. };
  656. /* VEU3 */
  657. static struct uio_info veu3_platform_data = {
  658. .name = "VEU3",
  659. .version = "0",
  660. .irq = intcs_evt2irq(0x760),
  661. };
  662. static struct resource veu3_resources[] = {
  663. [0] = {
  664. .name = "VEU3",
  665. .start = 0xfe92c000,
  666. .end = 0xfe92c307,
  667. .flags = IORESOURCE_MEM,
  668. },
  669. };
  670. static struct platform_device veu3_device = {
  671. .name = "uio_pdrv_genirq",
  672. .id = 4,
  673. .dev = {
  674. .platform_data = &veu3_platform_data,
  675. },
  676. .resource = veu3_resources,
  677. .num_resources = ARRAY_SIZE(veu3_resources),
  678. };
  679. /* JPU */
  680. static struct uio_info jpu_platform_data = {
  681. .name = "JPU",
  682. .version = "0",
  683. .irq = intcs_evt2irq(0x560),
  684. };
  685. static struct resource jpu_resources[] = {
  686. [0] = {
  687. .name = "JPU",
  688. .start = 0xfe980000,
  689. .end = 0xfe9902d3,
  690. .flags = IORESOURCE_MEM,
  691. },
  692. };
  693. static struct platform_device jpu_device = {
  694. .name = "uio_pdrv_genirq",
  695. .id = 5,
  696. .dev = {
  697. .platform_data = &jpu_platform_data,
  698. },
  699. .resource = jpu_resources,
  700. .num_resources = ARRAY_SIZE(jpu_resources),
  701. };
  702. /* SPU2DSP0 */
  703. static struct uio_info spu0_platform_data = {
  704. .name = "SPU2DSP0",
  705. .version = "0",
  706. .irq = evt2irq(0x1800),
  707. };
  708. static struct resource spu0_resources[] = {
  709. [0] = {
  710. .name = "SPU2DSP0",
  711. .start = 0xfe200000,
  712. .end = 0xfe2fffff,
  713. .flags = IORESOURCE_MEM,
  714. },
  715. };
  716. static struct platform_device spu0_device = {
  717. .name = "uio_pdrv_genirq",
  718. .id = 6,
  719. .dev = {
  720. .platform_data = &spu0_platform_data,
  721. },
  722. .resource = spu0_resources,
  723. .num_resources = ARRAY_SIZE(spu0_resources),
  724. };
  725. /* SPU2DSP1 */
  726. static struct uio_info spu1_platform_data = {
  727. .name = "SPU2DSP1",
  728. .version = "0",
  729. .irq = evt2irq(0x1820),
  730. };
  731. static struct resource spu1_resources[] = {
  732. [0] = {
  733. .name = "SPU2DSP1",
  734. .start = 0xfe300000,
  735. .end = 0xfe3fffff,
  736. .flags = IORESOURCE_MEM,
  737. },
  738. };
  739. static struct platform_device spu1_device = {
  740. .name = "uio_pdrv_genirq",
  741. .id = 7,
  742. .dev = {
  743. .platform_data = &spu1_platform_data,
  744. },
  745. .resource = spu1_resources,
  746. .num_resources = ARRAY_SIZE(spu1_resources),
  747. };
  748. static struct platform_device *sh7372_early_devices[] __initdata = {
  749. &scif0_device,
  750. &scif1_device,
  751. &scif2_device,
  752. &scif3_device,
  753. &scif4_device,
  754. &scif5_device,
  755. &scif6_device,
  756. &cmt10_device,
  757. &tmu00_device,
  758. &tmu01_device,
  759. };
  760. static struct platform_device *sh7372_late_devices[] __initdata = {
  761. &iic0_device,
  762. &iic1_device,
  763. &dma0_device,
  764. &dma1_device,
  765. &dma2_device,
  766. &vpu_device,
  767. &veu0_device,
  768. &veu1_device,
  769. &veu2_device,
  770. &veu3_device,
  771. &jpu_device,
  772. &spu0_device,
  773. &spu1_device,
  774. };
  775. void __init sh7372_add_standard_devices(void)
  776. {
  777. platform_add_devices(sh7372_early_devices,
  778. ARRAY_SIZE(sh7372_early_devices));
  779. platform_add_devices(sh7372_late_devices,
  780. ARRAY_SIZE(sh7372_late_devices));
  781. }
  782. void __init sh7372_add_early_devices(void)
  783. {
  784. early_platform_add_devices(sh7372_early_devices,
  785. ARRAY_SIZE(sh7372_early_devices));
  786. }