setup-sh7722.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. /*
  2. * SH7722 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/init.h>
  11. #include <linux/mm.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/serial.h>
  14. #include <linux/serial_sci.h>
  15. #include <linux/sh_timer.h>
  16. #include <linux/uio_driver.h>
  17. #include <linux/usb/m66592.h>
  18. #include <asm/clock.h>
  19. #include <asm/mmzone.h>
  20. #include <asm/siu.h>
  21. #include <cpu/dma-register.h>
  22. #include <cpu/sh7722.h>
  23. static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
  24. {
  25. .slave_id = SHDMA_SLAVE_SCIF0_TX,
  26. .addr = 0xffe0000c,
  27. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  28. .mid_rid = 0x21,
  29. }, {
  30. .slave_id = SHDMA_SLAVE_SCIF0_RX,
  31. .addr = 0xffe00014,
  32. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  33. .mid_rid = 0x22,
  34. }, {
  35. .slave_id = SHDMA_SLAVE_SCIF1_TX,
  36. .addr = 0xffe1000c,
  37. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  38. .mid_rid = 0x25,
  39. }, {
  40. .slave_id = SHDMA_SLAVE_SCIF1_RX,
  41. .addr = 0xffe10014,
  42. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  43. .mid_rid = 0x26,
  44. }, {
  45. .slave_id = SHDMA_SLAVE_SCIF2_TX,
  46. .addr = 0xffe2000c,
  47. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  48. .mid_rid = 0x29,
  49. }, {
  50. .slave_id = SHDMA_SLAVE_SCIF2_RX,
  51. .addr = 0xffe20014,
  52. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  53. .mid_rid = 0x2a,
  54. }, {
  55. .slave_id = SHDMA_SLAVE_SIUA_TX,
  56. .addr = 0xa454c098,
  57. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  58. .mid_rid = 0xb1,
  59. }, {
  60. .slave_id = SHDMA_SLAVE_SIUA_RX,
  61. .addr = 0xa454c090,
  62. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  63. .mid_rid = 0xb2,
  64. }, {
  65. .slave_id = SHDMA_SLAVE_SIUB_TX,
  66. .addr = 0xa454c09c,
  67. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  68. .mid_rid = 0xb5,
  69. }, {
  70. .slave_id = SHDMA_SLAVE_SIUB_RX,
  71. .addr = 0xa454c094,
  72. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  73. .mid_rid = 0xb6,
  74. }, {
  75. .slave_id = SHDMA_SLAVE_SDHI0_TX,
  76. .addr = 0x04ce0030,
  77. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  78. .mid_rid = 0xc1,
  79. }, {
  80. .slave_id = SHDMA_SLAVE_SDHI0_RX,
  81. .addr = 0x04ce0030,
  82. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  83. .mid_rid = 0xc2,
  84. },
  85. };
  86. static const struct sh_dmae_channel sh7722_dmae_channels[] = {
  87. {
  88. .offset = 0,
  89. .dmars = 0,
  90. .dmars_bit = 0,
  91. }, {
  92. .offset = 0x10,
  93. .dmars = 0,
  94. .dmars_bit = 8,
  95. }, {
  96. .offset = 0x20,
  97. .dmars = 4,
  98. .dmars_bit = 0,
  99. }, {
  100. .offset = 0x30,
  101. .dmars = 4,
  102. .dmars_bit = 8,
  103. }, {
  104. .offset = 0x50,
  105. .dmars = 8,
  106. .dmars_bit = 0,
  107. }, {
  108. .offset = 0x60,
  109. .dmars = 8,
  110. .dmars_bit = 8,
  111. }
  112. };
  113. static const unsigned int ts_shift[] = TS_SHIFT;
  114. static struct sh_dmae_pdata dma_platform_data = {
  115. .slave = sh7722_dmae_slaves,
  116. .slave_num = ARRAY_SIZE(sh7722_dmae_slaves),
  117. .channel = sh7722_dmae_channels,
  118. .channel_num = ARRAY_SIZE(sh7722_dmae_channels),
  119. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  120. .ts_low_mask = CHCR_TS_LOW_MASK,
  121. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  122. .ts_high_mask = CHCR_TS_HIGH_MASK,
  123. .ts_shift = ts_shift,
  124. .ts_shift_num = ARRAY_SIZE(ts_shift),
  125. .dmaor_init = DMAOR_INIT,
  126. };
  127. static struct resource sh7722_dmae_resources[] = {
  128. [0] = {
  129. /* Channel registers and DMAOR */
  130. .start = 0xfe008020,
  131. .end = 0xfe00808f,
  132. .flags = IORESOURCE_MEM,
  133. },
  134. [1] = {
  135. /* DMARSx */
  136. .start = 0xfe009000,
  137. .end = 0xfe00900b,
  138. .flags = IORESOURCE_MEM,
  139. },
  140. {
  141. /* DMA error IRQ */
  142. .start = 78,
  143. .end = 78,
  144. .flags = IORESOURCE_IRQ,
  145. },
  146. {
  147. /* IRQ for channels 0-3 */
  148. .start = 48,
  149. .end = 51,
  150. .flags = IORESOURCE_IRQ,
  151. },
  152. {
  153. /* IRQ for channels 4-5 */
  154. .start = 76,
  155. .end = 77,
  156. .flags = IORESOURCE_IRQ,
  157. },
  158. };
  159. struct platform_device dma_device = {
  160. .name = "sh-dma-engine",
  161. .id = -1,
  162. .resource = sh7722_dmae_resources,
  163. .num_resources = ARRAY_SIZE(sh7722_dmae_resources),
  164. .dev = {
  165. .platform_data = &dma_platform_data,
  166. },
  167. .archdata = {
  168. .hwblk_id = HWBLK_DMAC,
  169. },
  170. };
  171. /* Serial */
  172. static struct plat_sci_port scif0_platform_data = {
  173. .mapbase = 0xffe00000,
  174. .flags = UPF_BOOT_AUTOCONF,
  175. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  176. .scbrr_algo_id = SCBRR_ALGO_2,
  177. .type = PORT_SCIF,
  178. .irqs = { 80, 80, 80, 80 },
  179. .ops = &sh7722_sci_port_ops,
  180. .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
  181. };
  182. static struct platform_device scif0_device = {
  183. .name = "sh-sci",
  184. .id = 0,
  185. .dev = {
  186. .platform_data = &scif0_platform_data,
  187. },
  188. };
  189. static struct plat_sci_port scif1_platform_data = {
  190. .mapbase = 0xffe10000,
  191. .flags = UPF_BOOT_AUTOCONF,
  192. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  193. .scbrr_algo_id = SCBRR_ALGO_2,
  194. .type = PORT_SCIF,
  195. .irqs = { 81, 81, 81, 81 },
  196. .ops = &sh7722_sci_port_ops,
  197. .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
  198. };
  199. static struct platform_device scif1_device = {
  200. .name = "sh-sci",
  201. .id = 1,
  202. .dev = {
  203. .platform_data = &scif1_platform_data,
  204. },
  205. };
  206. static struct plat_sci_port scif2_platform_data = {
  207. .mapbase = 0xffe20000,
  208. .flags = UPF_BOOT_AUTOCONF,
  209. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  210. .scbrr_algo_id = SCBRR_ALGO_2,
  211. .type = PORT_SCIF,
  212. .irqs = { 82, 82, 82, 82 },
  213. .ops = &sh7722_sci_port_ops,
  214. .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
  215. };
  216. static struct platform_device scif2_device = {
  217. .name = "sh-sci",
  218. .id = 2,
  219. .dev = {
  220. .platform_data = &scif2_platform_data,
  221. },
  222. };
  223. static struct resource rtc_resources[] = {
  224. [0] = {
  225. .start = 0xa465fec0,
  226. .end = 0xa465fec0 + 0x58 - 1,
  227. .flags = IORESOURCE_IO,
  228. },
  229. [1] = {
  230. /* Period IRQ */
  231. .start = 45,
  232. .flags = IORESOURCE_IRQ,
  233. },
  234. [2] = {
  235. /* Carry IRQ */
  236. .start = 46,
  237. .flags = IORESOURCE_IRQ,
  238. },
  239. [3] = {
  240. /* Alarm IRQ */
  241. .start = 44,
  242. .flags = IORESOURCE_IRQ,
  243. },
  244. };
  245. static struct platform_device rtc_device = {
  246. .name = "sh-rtc",
  247. .id = -1,
  248. .num_resources = ARRAY_SIZE(rtc_resources),
  249. .resource = rtc_resources,
  250. .archdata = {
  251. .hwblk_id = HWBLK_RTC,
  252. },
  253. };
  254. static struct m66592_platdata usbf_platdata = {
  255. .on_chip = 1,
  256. };
  257. static struct resource usbf_resources[] = {
  258. [0] = {
  259. .name = "USBF",
  260. .start = 0x04480000,
  261. .end = 0x044800FF,
  262. .flags = IORESOURCE_MEM,
  263. },
  264. [1] = {
  265. .start = 65,
  266. .end = 65,
  267. .flags = IORESOURCE_IRQ,
  268. },
  269. };
  270. static struct platform_device usbf_device = {
  271. .name = "m66592_udc",
  272. .id = 0, /* "usbf0" clock */
  273. .dev = {
  274. .dma_mask = NULL,
  275. .coherent_dma_mask = 0xffffffff,
  276. .platform_data = &usbf_platdata,
  277. },
  278. .num_resources = ARRAY_SIZE(usbf_resources),
  279. .resource = usbf_resources,
  280. .archdata = {
  281. .hwblk_id = HWBLK_USBF,
  282. },
  283. };
  284. static struct resource iic_resources[] = {
  285. [0] = {
  286. .name = "IIC",
  287. .start = 0x04470000,
  288. .end = 0x04470017,
  289. .flags = IORESOURCE_MEM,
  290. },
  291. [1] = {
  292. .start = 96,
  293. .end = 99,
  294. .flags = IORESOURCE_IRQ,
  295. },
  296. };
  297. static struct platform_device iic_device = {
  298. .name = "i2c-sh_mobile",
  299. .id = 0, /* "i2c0" clock */
  300. .num_resources = ARRAY_SIZE(iic_resources),
  301. .resource = iic_resources,
  302. .archdata = {
  303. .hwblk_id = HWBLK_IIC,
  304. },
  305. };
  306. static struct uio_info vpu_platform_data = {
  307. .name = "VPU4",
  308. .version = "0",
  309. .irq = 60,
  310. };
  311. static struct resource vpu_resources[] = {
  312. [0] = {
  313. .name = "VPU",
  314. .start = 0xfe900000,
  315. .end = 0xfe9022eb,
  316. .flags = IORESOURCE_MEM,
  317. },
  318. [1] = {
  319. /* place holder for contiguous memory */
  320. },
  321. };
  322. static struct platform_device vpu_device = {
  323. .name = "uio_pdrv_genirq",
  324. .id = 0,
  325. .dev = {
  326. .platform_data = &vpu_platform_data,
  327. },
  328. .resource = vpu_resources,
  329. .num_resources = ARRAY_SIZE(vpu_resources),
  330. .archdata = {
  331. .hwblk_id = HWBLK_VPU,
  332. },
  333. };
  334. static struct uio_info veu_platform_data = {
  335. .name = "VEU",
  336. .version = "0",
  337. .irq = 54,
  338. };
  339. static struct resource veu_resources[] = {
  340. [0] = {
  341. .name = "VEU",
  342. .start = 0xfe920000,
  343. .end = 0xfe9200b7,
  344. .flags = IORESOURCE_MEM,
  345. },
  346. [1] = {
  347. /* place holder for contiguous memory */
  348. },
  349. };
  350. static struct platform_device veu_device = {
  351. .name = "uio_pdrv_genirq",
  352. .id = 1,
  353. .dev = {
  354. .platform_data = &veu_platform_data,
  355. },
  356. .resource = veu_resources,
  357. .num_resources = ARRAY_SIZE(veu_resources),
  358. .archdata = {
  359. .hwblk_id = HWBLK_VEU,
  360. },
  361. };
  362. static struct uio_info jpu_platform_data = {
  363. .name = "JPU",
  364. .version = "0",
  365. .irq = 27,
  366. };
  367. static struct resource jpu_resources[] = {
  368. [0] = {
  369. .name = "JPU",
  370. .start = 0xfea00000,
  371. .end = 0xfea102d3,
  372. .flags = IORESOURCE_MEM,
  373. },
  374. [1] = {
  375. /* place holder for contiguous memory */
  376. },
  377. };
  378. static struct platform_device jpu_device = {
  379. .name = "uio_pdrv_genirq",
  380. .id = 2,
  381. .dev = {
  382. .platform_data = &jpu_platform_data,
  383. },
  384. .resource = jpu_resources,
  385. .num_resources = ARRAY_SIZE(jpu_resources),
  386. .archdata = {
  387. .hwblk_id = HWBLK_JPU,
  388. },
  389. };
  390. static struct sh_timer_config cmt_platform_data = {
  391. .channel_offset = 0x60,
  392. .timer_bit = 5,
  393. .clockevent_rating = 125,
  394. .clocksource_rating = 125,
  395. };
  396. static struct resource cmt_resources[] = {
  397. [0] = {
  398. .start = 0x044a0060,
  399. .end = 0x044a006b,
  400. .flags = IORESOURCE_MEM,
  401. },
  402. [1] = {
  403. .start = 104,
  404. .flags = IORESOURCE_IRQ,
  405. },
  406. };
  407. static struct platform_device cmt_device = {
  408. .name = "sh_cmt",
  409. .id = 0,
  410. .dev = {
  411. .platform_data = &cmt_platform_data,
  412. },
  413. .resource = cmt_resources,
  414. .num_resources = ARRAY_SIZE(cmt_resources),
  415. .archdata = {
  416. .hwblk_id = HWBLK_CMT,
  417. },
  418. };
  419. static struct sh_timer_config tmu0_platform_data = {
  420. .channel_offset = 0x04,
  421. .timer_bit = 0,
  422. .clockevent_rating = 200,
  423. };
  424. static struct resource tmu0_resources[] = {
  425. [0] = {
  426. .start = 0xffd80008,
  427. .end = 0xffd80013,
  428. .flags = IORESOURCE_MEM,
  429. },
  430. [1] = {
  431. .start = 16,
  432. .flags = IORESOURCE_IRQ,
  433. },
  434. };
  435. static struct platform_device tmu0_device = {
  436. .name = "sh_tmu",
  437. .id = 0,
  438. .dev = {
  439. .platform_data = &tmu0_platform_data,
  440. },
  441. .resource = tmu0_resources,
  442. .num_resources = ARRAY_SIZE(tmu0_resources),
  443. .archdata = {
  444. .hwblk_id = HWBLK_TMU,
  445. },
  446. };
  447. static struct sh_timer_config tmu1_platform_data = {
  448. .channel_offset = 0x10,
  449. .timer_bit = 1,
  450. .clocksource_rating = 200,
  451. };
  452. static struct resource tmu1_resources[] = {
  453. [0] = {
  454. .start = 0xffd80014,
  455. .end = 0xffd8001f,
  456. .flags = IORESOURCE_MEM,
  457. },
  458. [1] = {
  459. .start = 17,
  460. .flags = IORESOURCE_IRQ,
  461. },
  462. };
  463. static struct platform_device tmu1_device = {
  464. .name = "sh_tmu",
  465. .id = 1,
  466. .dev = {
  467. .platform_data = &tmu1_platform_data,
  468. },
  469. .resource = tmu1_resources,
  470. .num_resources = ARRAY_SIZE(tmu1_resources),
  471. .archdata = {
  472. .hwblk_id = HWBLK_TMU,
  473. },
  474. };
  475. static struct sh_timer_config tmu2_platform_data = {
  476. .channel_offset = 0x1c,
  477. .timer_bit = 2,
  478. };
  479. static struct resource tmu2_resources[] = {
  480. [0] = {
  481. .start = 0xffd80020,
  482. .end = 0xffd8002b,
  483. .flags = IORESOURCE_MEM,
  484. },
  485. [1] = {
  486. .start = 18,
  487. .flags = IORESOURCE_IRQ,
  488. },
  489. };
  490. static struct platform_device tmu2_device = {
  491. .name = "sh_tmu",
  492. .id = 2,
  493. .dev = {
  494. .platform_data = &tmu2_platform_data,
  495. },
  496. .resource = tmu2_resources,
  497. .num_resources = ARRAY_SIZE(tmu2_resources),
  498. .archdata = {
  499. .hwblk_id = HWBLK_TMU,
  500. },
  501. };
  502. static struct siu_platform siu_platform_data = {
  503. .dma_dev = &dma_device.dev,
  504. .dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX,
  505. .dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX,
  506. .dma_slave_tx_b = SHDMA_SLAVE_SIUB_TX,
  507. .dma_slave_rx_b = SHDMA_SLAVE_SIUB_RX,
  508. };
  509. static struct resource siu_resources[] = {
  510. [0] = {
  511. .start = 0xa4540000,
  512. .end = 0xa454c10f,
  513. .flags = IORESOURCE_MEM,
  514. },
  515. [1] = {
  516. .start = 108,
  517. .flags = IORESOURCE_IRQ,
  518. },
  519. };
  520. static struct platform_device siu_device = {
  521. .name = "siu-pcm-audio",
  522. .id = -1,
  523. .dev = {
  524. .platform_data = &siu_platform_data,
  525. },
  526. .resource = siu_resources,
  527. .num_resources = ARRAY_SIZE(siu_resources),
  528. .archdata = {
  529. .hwblk_id = HWBLK_SIU,
  530. },
  531. };
  532. static struct platform_device *sh7722_devices[] __initdata = {
  533. &scif0_device,
  534. &scif1_device,
  535. &scif2_device,
  536. &cmt_device,
  537. &tmu0_device,
  538. &tmu1_device,
  539. &tmu2_device,
  540. &rtc_device,
  541. &usbf_device,
  542. &iic_device,
  543. &vpu_device,
  544. &veu_device,
  545. &jpu_device,
  546. &siu_device,
  547. &dma_device,
  548. };
  549. static int __init sh7722_devices_setup(void)
  550. {
  551. platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
  552. platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
  553. platform_resource_setup_memory(&jpu_device, "jpu", 2 << 20);
  554. return platform_add_devices(sh7722_devices,
  555. ARRAY_SIZE(sh7722_devices));
  556. }
  557. arch_initcall(sh7722_devices_setup);
  558. static struct platform_device *sh7722_early_devices[] __initdata = {
  559. &scif0_device,
  560. &scif1_device,
  561. &scif2_device,
  562. &cmt_device,
  563. &tmu0_device,
  564. &tmu1_device,
  565. &tmu2_device,
  566. };
  567. void __init plat_early_device_setup(void)
  568. {
  569. early_platform_add_devices(sh7722_early_devices,
  570. ARRAY_SIZE(sh7722_early_devices));
  571. }
  572. enum {
  573. UNUSED=0,
  574. ENABLED,
  575. DISABLED,
  576. /* interrupt sources */
  577. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  578. HUDI,
  579. SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
  580. RTC_ATI, RTC_PRI, RTC_CUI,
  581. DMAC0, DMAC1, DMAC2, DMAC3,
  582. VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU,
  583. VPU, TPU,
  584. USB_USBI0, USB_USBI1,
  585. DMAC4, DMAC5, DMAC_DADERR,
  586. KEYSC,
  587. SCIF0, SCIF1, SCIF2, SIOF0, SIOF1, SIO,
  588. FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
  589. I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI,
  590. CMT, TSIF, SIU, TWODG,
  591. TMU0, TMU1, TMU2,
  592. IRDA, JPU, LCDC,
  593. /* interrupt groups */
  594. SIM, RTC, DMAC0123, VIOVOU, USB, DMAC45, FLCTL, I2C, SDHI,
  595. };
  596. static struct intc_vect vectors[] __initdata = {
  597. INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
  598. INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
  599. INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
  600. INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
  601. INTC_VECT(SIM_ERI, 0x700), INTC_VECT(SIM_RXI, 0x720),
  602. INTC_VECT(SIM_TXI, 0x740), INTC_VECT(SIM_TEI, 0x760),
  603. INTC_VECT(RTC_ATI, 0x780), INTC_VECT(RTC_PRI, 0x7a0),
  604. INTC_VECT(RTC_CUI, 0x7c0),
  605. INTC_VECT(DMAC0, 0x800), INTC_VECT(DMAC1, 0x820),
  606. INTC_VECT(DMAC2, 0x840), INTC_VECT(DMAC3, 0x860),
  607. INTC_VECT(VIO_CEUI, 0x880), INTC_VECT(VIO_BEUI, 0x8a0),
  608. INTC_VECT(VIO_VEUI, 0x8c0), INTC_VECT(VOU, 0x8e0),
  609. INTC_VECT(VPU, 0x980), INTC_VECT(TPU, 0x9a0),
  610. INTC_VECT(USB_USBI0, 0xa20), INTC_VECT(USB_USBI1, 0xa40),
  611. INTC_VECT(DMAC4, 0xb80), INTC_VECT(DMAC5, 0xba0),
  612. INTC_VECT(DMAC_DADERR, 0xbc0), INTC_VECT(KEYSC, 0xbe0),
  613. INTC_VECT(SCIF0, 0xc00), INTC_VECT(SCIF1, 0xc20),
  614. INTC_VECT(SCIF2, 0xc40), INTC_VECT(SIOF0, 0xc80),
  615. INTC_VECT(SIOF1, 0xca0), INTC_VECT(SIO, 0xd00),
  616. INTC_VECT(FLCTL_FLSTEI, 0xd80), INTC_VECT(FLCTL_FLENDI, 0xda0),
  617. INTC_VECT(FLCTL_FLTREQ0I, 0xdc0), INTC_VECT(FLCTL_FLTREQ1I, 0xde0),
  618. INTC_VECT(I2C_ALI, 0xe00), INTC_VECT(I2C_TACKI, 0xe20),
  619. INTC_VECT(I2C_WAITI, 0xe40), INTC_VECT(I2C_DTEI, 0xe60),
  620. INTC_VECT(SDHI, 0xe80), INTC_VECT(SDHI, 0xea0),
  621. INTC_VECT(SDHI, 0xec0), INTC_VECT(SDHI, 0xee0),
  622. INTC_VECT(CMT, 0xf00), INTC_VECT(TSIF, 0xf20),
  623. INTC_VECT(SIU, 0xf80), INTC_VECT(TWODG, 0xfa0),
  624. INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
  625. INTC_VECT(TMU2, 0x440), INTC_VECT(IRDA, 0x480),
  626. INTC_VECT(JPU, 0x560), INTC_VECT(LCDC, 0x580),
  627. };
  628. static struct intc_group groups[] __initdata = {
  629. INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI),
  630. INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
  631. INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3),
  632. INTC_GROUP(VIOVOU, VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU),
  633. INTC_GROUP(USB, USB_USBI0, USB_USBI1),
  634. INTC_GROUP(DMAC45, DMAC4, DMAC5, DMAC_DADERR),
  635. INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLENDI,
  636. FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
  637. INTC_GROUP(I2C, I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI),
  638. };
  639. static struct intc_mask_reg mask_registers[] __initdata = {
  640. { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
  641. { } },
  642. { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
  643. { VOU, VIO_VEUI, VIO_BEUI, VIO_CEUI, DMAC3, DMAC2, DMAC1, DMAC0 } },
  644. { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
  645. { 0, 0, 0, VPU, } },
  646. { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
  647. { SIM_TEI, SIM_TXI, SIM_RXI, SIM_ERI, 0, 0, 0, IRDA } },
  648. { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
  649. { 0, TMU2, TMU1, TMU0, JPU, 0, 0, LCDC } },
  650. { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
  651. { KEYSC, DMAC_DADERR, DMAC5, DMAC4, 0, SCIF2, SCIF1, SCIF0 } },
  652. { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
  653. { 0, 0, 0, SIO, 0, 0, SIOF1, SIOF0 } },
  654. { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
  655. { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
  656. FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLENDI, FLCTL_FLSTEI } },
  657. { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
  658. { DISABLED, ENABLED, ENABLED, ENABLED, 0, 0, TWODG, SIU } },
  659. { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
  660. { 0, 0, 0, CMT, 0, USB_USBI1, USB_USBI0, } },
  661. { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
  662. { } },
  663. { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
  664. { 0, RTC_CUI, RTC_PRI, RTC_ATI, 0, TPU, 0, TSIF } },
  665. { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
  666. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  667. };
  668. static struct intc_prio_reg prio_registers[] __initdata = {
  669. { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, IRDA } },
  670. { 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, SIM } },
  671. { 0xa4080008, 0, 16, 4, /* IPRC */ { } },
  672. { 0xa408000c, 0, 16, 4, /* IPRD */ { } },
  673. { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, 0, VPU } },
  674. { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC45, USB, CMT } },
  675. { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, SCIF2 } },
  676. { 0xa408001c, 0, 16, 4, /* IPRH */ { SIOF0, SIOF1, FLCTL, I2C } },
  677. { 0xa4080020, 0, 16, 4, /* IPRI */ { SIO, 0, TSIF, RTC } },
  678. { 0xa4080024, 0, 16, 4, /* IPRJ */ { 0, 0, SIU } },
  679. { 0xa4080028, 0, 16, 4, /* IPRK */ { 0, 0, 0, SDHI } },
  680. { 0xa408002c, 0, 16, 4, /* IPRL */ { TWODG, 0, TPU } },
  681. { 0xa4140010, 0, 32, 4, /* INTPRI00 */
  682. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  683. };
  684. static struct intc_sense_reg sense_registers[] __initdata = {
  685. { 0xa414001c, 16, 2, /* ICR1 */
  686. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  687. };
  688. static struct intc_mask_reg ack_registers[] __initdata = {
  689. { 0xa4140024, 0, 8, /* INTREQ00 */
  690. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  691. };
  692. static struct intc_desc intc_desc __initdata = {
  693. .name = "sh7722",
  694. .force_enable = ENABLED,
  695. .force_disable = DISABLED,
  696. .hw = INTC_HW_DESC(vectors, groups, mask_registers,
  697. prio_registers, sense_registers, ack_registers),
  698. };
  699. void __init plat_irq_setup(void)
  700. {
  701. register_intc_controller(&intc_desc);
  702. }
  703. void __init plat_mem_setup(void)
  704. {
  705. /* Register the URAM space as Node 1 */
  706. setup_bootmem_node(1, 0x055f0000, 0x05610000);
  707. }