setup-sh7722.c 18 KB

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