setup-sh7722.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  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. .type = PORT_SCIF,
  176. .irqs = { 80, 80, 80, 80 },
  177. };
  178. static struct platform_device scif0_device = {
  179. .name = "sh-sci",
  180. .id = 0,
  181. .dev = {
  182. .platform_data = &scif0_platform_data,
  183. },
  184. };
  185. static struct plat_sci_port scif1_platform_data = {
  186. .mapbase = 0xffe10000,
  187. .flags = UPF_BOOT_AUTOCONF,
  188. .type = PORT_SCIF,
  189. .irqs = { 81, 81, 81, 81 },
  190. };
  191. static struct platform_device scif1_device = {
  192. .name = "sh-sci",
  193. .id = 1,
  194. .dev = {
  195. .platform_data = &scif1_platform_data,
  196. },
  197. };
  198. static struct plat_sci_port scif2_platform_data = {
  199. .mapbase = 0xffe20000,
  200. .flags = UPF_BOOT_AUTOCONF,
  201. .type = PORT_SCIF,
  202. .irqs = { 82, 82, 82, 82 },
  203. };
  204. static struct platform_device scif2_device = {
  205. .name = "sh-sci",
  206. .id = 2,
  207. .dev = {
  208. .platform_data = &scif2_platform_data,
  209. },
  210. };
  211. static struct resource rtc_resources[] = {
  212. [0] = {
  213. .start = 0xa465fec0,
  214. .end = 0xa465fec0 + 0x58 - 1,
  215. .flags = IORESOURCE_IO,
  216. },
  217. [1] = {
  218. /* Period IRQ */
  219. .start = 45,
  220. .flags = IORESOURCE_IRQ,
  221. },
  222. [2] = {
  223. /* Carry IRQ */
  224. .start = 46,
  225. .flags = IORESOURCE_IRQ,
  226. },
  227. [3] = {
  228. /* Alarm IRQ */
  229. .start = 44,
  230. .flags = IORESOURCE_IRQ,
  231. },
  232. };
  233. static struct platform_device rtc_device = {
  234. .name = "sh-rtc",
  235. .id = -1,
  236. .num_resources = ARRAY_SIZE(rtc_resources),
  237. .resource = rtc_resources,
  238. .archdata = {
  239. .hwblk_id = HWBLK_RTC,
  240. },
  241. };
  242. static struct m66592_platdata usbf_platdata = {
  243. .on_chip = 1,
  244. };
  245. static struct resource usbf_resources[] = {
  246. [0] = {
  247. .name = "USBF",
  248. .start = 0x04480000,
  249. .end = 0x044800FF,
  250. .flags = IORESOURCE_MEM,
  251. },
  252. [1] = {
  253. .start = 65,
  254. .end = 65,
  255. .flags = IORESOURCE_IRQ,
  256. },
  257. };
  258. static struct platform_device usbf_device = {
  259. .name = "m66592_udc",
  260. .id = 0, /* "usbf0" clock */
  261. .dev = {
  262. .dma_mask = NULL,
  263. .coherent_dma_mask = 0xffffffff,
  264. .platform_data = &usbf_platdata,
  265. },
  266. .num_resources = ARRAY_SIZE(usbf_resources),
  267. .resource = usbf_resources,
  268. .archdata = {
  269. .hwblk_id = HWBLK_USBF,
  270. },
  271. };
  272. static struct resource iic_resources[] = {
  273. [0] = {
  274. .name = "IIC",
  275. .start = 0x04470000,
  276. .end = 0x04470017,
  277. .flags = IORESOURCE_MEM,
  278. },
  279. [1] = {
  280. .start = 96,
  281. .end = 99,
  282. .flags = IORESOURCE_IRQ,
  283. },
  284. };
  285. static struct platform_device iic_device = {
  286. .name = "i2c-sh_mobile",
  287. .id = 0, /* "i2c0" clock */
  288. .num_resources = ARRAY_SIZE(iic_resources),
  289. .resource = iic_resources,
  290. .archdata = {
  291. .hwblk_id = HWBLK_IIC,
  292. },
  293. };
  294. static struct uio_info vpu_platform_data = {
  295. .name = "VPU4",
  296. .version = "0",
  297. .irq = 60,
  298. };
  299. static struct resource vpu_resources[] = {
  300. [0] = {
  301. .name = "VPU",
  302. .start = 0xfe900000,
  303. .end = 0xfe9022eb,
  304. .flags = IORESOURCE_MEM,
  305. },
  306. [1] = {
  307. /* place holder for contiguous memory */
  308. },
  309. };
  310. static struct platform_device vpu_device = {
  311. .name = "uio_pdrv_genirq",
  312. .id = 0,
  313. .dev = {
  314. .platform_data = &vpu_platform_data,
  315. },
  316. .resource = vpu_resources,
  317. .num_resources = ARRAY_SIZE(vpu_resources),
  318. .archdata = {
  319. .hwblk_id = HWBLK_VPU,
  320. },
  321. };
  322. static struct uio_info veu_platform_data = {
  323. .name = "VEU",
  324. .version = "0",
  325. .irq = 54,
  326. };
  327. static struct resource veu_resources[] = {
  328. [0] = {
  329. .name = "VEU",
  330. .start = 0xfe920000,
  331. .end = 0xfe9200b7,
  332. .flags = IORESOURCE_MEM,
  333. },
  334. [1] = {
  335. /* place holder for contiguous memory */
  336. },
  337. };
  338. static struct platform_device veu_device = {
  339. .name = "uio_pdrv_genirq",
  340. .id = 1,
  341. .dev = {
  342. .platform_data = &veu_platform_data,
  343. },
  344. .resource = veu_resources,
  345. .num_resources = ARRAY_SIZE(veu_resources),
  346. .archdata = {
  347. .hwblk_id = HWBLK_VEU,
  348. },
  349. };
  350. static struct uio_info jpu_platform_data = {
  351. .name = "JPU",
  352. .version = "0",
  353. .irq = 27,
  354. };
  355. static struct resource jpu_resources[] = {
  356. [0] = {
  357. .name = "JPU",
  358. .start = 0xfea00000,
  359. .end = 0xfea102d3,
  360. .flags = IORESOURCE_MEM,
  361. },
  362. [1] = {
  363. /* place holder for contiguous memory */
  364. },
  365. };
  366. static struct platform_device jpu_device = {
  367. .name = "uio_pdrv_genirq",
  368. .id = 2,
  369. .dev = {
  370. .platform_data = &jpu_platform_data,
  371. },
  372. .resource = jpu_resources,
  373. .num_resources = ARRAY_SIZE(jpu_resources),
  374. .archdata = {
  375. .hwblk_id = HWBLK_JPU,
  376. },
  377. };
  378. static struct sh_timer_config cmt_platform_data = {
  379. .channel_offset = 0x60,
  380. .timer_bit = 5,
  381. .clockevent_rating = 125,
  382. .clocksource_rating = 125,
  383. };
  384. static struct resource cmt_resources[] = {
  385. [0] = {
  386. .start = 0x044a0060,
  387. .end = 0x044a006b,
  388. .flags = IORESOURCE_MEM,
  389. },
  390. [1] = {
  391. .start = 104,
  392. .flags = IORESOURCE_IRQ,
  393. },
  394. };
  395. static struct platform_device cmt_device = {
  396. .name = "sh_cmt",
  397. .id = 0,
  398. .dev = {
  399. .platform_data = &cmt_platform_data,
  400. },
  401. .resource = cmt_resources,
  402. .num_resources = ARRAY_SIZE(cmt_resources),
  403. .archdata = {
  404. .hwblk_id = HWBLK_CMT,
  405. },
  406. };
  407. static struct sh_timer_config tmu0_platform_data = {
  408. .channel_offset = 0x04,
  409. .timer_bit = 0,
  410. .clockevent_rating = 200,
  411. };
  412. static struct resource tmu0_resources[] = {
  413. [0] = {
  414. .start = 0xffd80008,
  415. .end = 0xffd80013,
  416. .flags = IORESOURCE_MEM,
  417. },
  418. [1] = {
  419. .start = 16,
  420. .flags = IORESOURCE_IRQ,
  421. },
  422. };
  423. static struct platform_device tmu0_device = {
  424. .name = "sh_tmu",
  425. .id = 0,
  426. .dev = {
  427. .platform_data = &tmu0_platform_data,
  428. },
  429. .resource = tmu0_resources,
  430. .num_resources = ARRAY_SIZE(tmu0_resources),
  431. .archdata = {
  432. .hwblk_id = HWBLK_TMU,
  433. },
  434. };
  435. static struct sh_timer_config tmu1_platform_data = {
  436. .channel_offset = 0x10,
  437. .timer_bit = 1,
  438. .clocksource_rating = 200,
  439. };
  440. static struct resource tmu1_resources[] = {
  441. [0] = {
  442. .start = 0xffd80014,
  443. .end = 0xffd8001f,
  444. .flags = IORESOURCE_MEM,
  445. },
  446. [1] = {
  447. .start = 17,
  448. .flags = IORESOURCE_IRQ,
  449. },
  450. };
  451. static struct platform_device tmu1_device = {
  452. .name = "sh_tmu",
  453. .id = 1,
  454. .dev = {
  455. .platform_data = &tmu1_platform_data,
  456. },
  457. .resource = tmu1_resources,
  458. .num_resources = ARRAY_SIZE(tmu1_resources),
  459. .archdata = {
  460. .hwblk_id = HWBLK_TMU,
  461. },
  462. };
  463. static struct sh_timer_config tmu2_platform_data = {
  464. .channel_offset = 0x1c,
  465. .timer_bit = 2,
  466. };
  467. static struct resource tmu2_resources[] = {
  468. [0] = {
  469. .start = 0xffd80020,
  470. .end = 0xffd8002b,
  471. .flags = IORESOURCE_MEM,
  472. },
  473. [1] = {
  474. .start = 18,
  475. .flags = IORESOURCE_IRQ,
  476. },
  477. };
  478. static struct platform_device tmu2_device = {
  479. .name = "sh_tmu",
  480. .id = 2,
  481. .dev = {
  482. .platform_data = &tmu2_platform_data,
  483. },
  484. .resource = tmu2_resources,
  485. .num_resources = ARRAY_SIZE(tmu2_resources),
  486. .archdata = {
  487. .hwblk_id = HWBLK_TMU,
  488. },
  489. };
  490. static struct siu_platform siu_platform_data = {
  491. .dma_dev = &dma_device.dev,
  492. .dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX,
  493. .dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX,
  494. .dma_slave_tx_b = SHDMA_SLAVE_SIUB_TX,
  495. .dma_slave_rx_b = SHDMA_SLAVE_SIUB_RX,
  496. };
  497. static struct resource siu_resources[] = {
  498. [0] = {
  499. .start = 0xa4540000,
  500. .end = 0xa454c10f,
  501. .flags = IORESOURCE_MEM,
  502. },
  503. [1] = {
  504. .start = 108,
  505. .flags = IORESOURCE_IRQ,
  506. },
  507. };
  508. static struct platform_device siu_device = {
  509. .name = "siu-pcm-audio",
  510. .id = -1,
  511. .dev = {
  512. .platform_data = &siu_platform_data,
  513. },
  514. .resource = siu_resources,
  515. .num_resources = ARRAY_SIZE(siu_resources),
  516. .archdata = {
  517. .hwblk_id = HWBLK_SIU,
  518. },
  519. };
  520. static struct platform_device *sh7722_devices[] __initdata = {
  521. &scif0_device,
  522. &scif1_device,
  523. &scif2_device,
  524. &cmt_device,
  525. &tmu0_device,
  526. &tmu1_device,
  527. &tmu2_device,
  528. &rtc_device,
  529. &usbf_device,
  530. &iic_device,
  531. &vpu_device,
  532. &veu_device,
  533. &jpu_device,
  534. &siu_device,
  535. &dma_device,
  536. };
  537. static int __init sh7722_devices_setup(void)
  538. {
  539. platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
  540. platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
  541. platform_resource_setup_memory(&jpu_device, "jpu", 2 << 20);
  542. return platform_add_devices(sh7722_devices,
  543. ARRAY_SIZE(sh7722_devices));
  544. }
  545. arch_initcall(sh7722_devices_setup);
  546. static struct platform_device *sh7722_early_devices[] __initdata = {
  547. &scif0_device,
  548. &scif1_device,
  549. &scif2_device,
  550. &cmt_device,
  551. &tmu0_device,
  552. &tmu1_device,
  553. &tmu2_device,
  554. };
  555. void __init plat_early_device_setup(void)
  556. {
  557. early_platform_add_devices(sh7722_early_devices,
  558. ARRAY_SIZE(sh7722_early_devices));
  559. }
  560. enum {
  561. UNUSED=0,
  562. ENABLED,
  563. DISABLED,
  564. /* interrupt sources */
  565. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  566. HUDI,
  567. SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
  568. RTC_ATI, RTC_PRI, RTC_CUI,
  569. DMAC0, DMAC1, DMAC2, DMAC3,
  570. VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU,
  571. VPU, TPU,
  572. USB_USBI0, USB_USBI1,
  573. DMAC4, DMAC5, DMAC_DADERR,
  574. KEYSC,
  575. SCIF0, SCIF1, SCIF2, SIOF0, SIOF1, SIO,
  576. FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
  577. I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI,
  578. CMT, TSIF, SIU, TWODG,
  579. TMU0, TMU1, TMU2,
  580. IRDA, JPU, LCDC,
  581. /* interrupt groups */
  582. SIM, RTC, DMAC0123, VIOVOU, USB, DMAC45, FLCTL, I2C, SDHI,
  583. };
  584. static struct intc_vect vectors[] __initdata = {
  585. INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
  586. INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
  587. INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
  588. INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
  589. INTC_VECT(SIM_ERI, 0x700), INTC_VECT(SIM_RXI, 0x720),
  590. INTC_VECT(SIM_TXI, 0x740), INTC_VECT(SIM_TEI, 0x760),
  591. INTC_VECT(RTC_ATI, 0x780), INTC_VECT(RTC_PRI, 0x7a0),
  592. INTC_VECT(RTC_CUI, 0x7c0),
  593. INTC_VECT(DMAC0, 0x800), INTC_VECT(DMAC1, 0x820),
  594. INTC_VECT(DMAC2, 0x840), INTC_VECT(DMAC3, 0x860),
  595. INTC_VECT(VIO_CEUI, 0x880), INTC_VECT(VIO_BEUI, 0x8a0),
  596. INTC_VECT(VIO_VEUI, 0x8c0), INTC_VECT(VOU, 0x8e0),
  597. INTC_VECT(VPU, 0x980), INTC_VECT(TPU, 0x9a0),
  598. INTC_VECT(USB_USBI0, 0xa20), INTC_VECT(USB_USBI1, 0xa40),
  599. INTC_VECT(DMAC4, 0xb80), INTC_VECT(DMAC5, 0xba0),
  600. INTC_VECT(DMAC_DADERR, 0xbc0), INTC_VECT(KEYSC, 0xbe0),
  601. INTC_VECT(SCIF0, 0xc00), INTC_VECT(SCIF1, 0xc20),
  602. INTC_VECT(SCIF2, 0xc40), INTC_VECT(SIOF0, 0xc80),
  603. INTC_VECT(SIOF1, 0xca0), INTC_VECT(SIO, 0xd00),
  604. INTC_VECT(FLCTL_FLSTEI, 0xd80), INTC_VECT(FLCTL_FLENDI, 0xda0),
  605. INTC_VECT(FLCTL_FLTREQ0I, 0xdc0), INTC_VECT(FLCTL_FLTREQ1I, 0xde0),
  606. INTC_VECT(I2C_ALI, 0xe00), INTC_VECT(I2C_TACKI, 0xe20),
  607. INTC_VECT(I2C_WAITI, 0xe40), INTC_VECT(I2C_DTEI, 0xe60),
  608. INTC_VECT(SDHI, 0xe80), INTC_VECT(SDHI, 0xea0),
  609. INTC_VECT(SDHI, 0xec0), INTC_VECT(SDHI, 0xee0),
  610. INTC_VECT(CMT, 0xf00), INTC_VECT(TSIF, 0xf20),
  611. INTC_VECT(SIU, 0xf80), INTC_VECT(TWODG, 0xfa0),
  612. INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
  613. INTC_VECT(TMU2, 0x440), INTC_VECT(IRDA, 0x480),
  614. INTC_VECT(JPU, 0x560), INTC_VECT(LCDC, 0x580),
  615. };
  616. static struct intc_group groups[] __initdata = {
  617. INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI),
  618. INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
  619. INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3),
  620. INTC_GROUP(VIOVOU, VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU),
  621. INTC_GROUP(USB, USB_USBI0, USB_USBI1),
  622. INTC_GROUP(DMAC45, DMAC4, DMAC5, DMAC_DADERR),
  623. INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLENDI,
  624. FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
  625. INTC_GROUP(I2C, I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI),
  626. };
  627. static struct intc_mask_reg mask_registers[] __initdata = {
  628. { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
  629. { } },
  630. { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
  631. { VOU, VIO_VEUI, VIO_BEUI, VIO_CEUI, DMAC3, DMAC2, DMAC1, DMAC0 } },
  632. { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
  633. { 0, 0, 0, VPU, } },
  634. { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
  635. { SIM_TEI, SIM_TXI, SIM_RXI, SIM_ERI, 0, 0, 0, IRDA } },
  636. { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
  637. { 0, TMU2, TMU1, TMU0, JPU, 0, 0, LCDC } },
  638. { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
  639. { KEYSC, DMAC_DADERR, DMAC5, DMAC4, 0, SCIF2, SCIF1, SCIF0 } },
  640. { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
  641. { 0, 0, 0, SIO, 0, 0, SIOF1, SIOF0 } },
  642. { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
  643. { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
  644. FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLENDI, FLCTL_FLSTEI } },
  645. { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
  646. { DISABLED, DISABLED, ENABLED, ENABLED, 0, 0, TWODG, SIU } },
  647. { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
  648. { 0, 0, 0, CMT, 0, USB_USBI1, USB_USBI0, } },
  649. { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
  650. { } },
  651. { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
  652. { 0, RTC_CUI, RTC_PRI, RTC_ATI, 0, TPU, 0, TSIF } },
  653. { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
  654. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  655. };
  656. static struct intc_prio_reg prio_registers[] __initdata = {
  657. { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, IRDA } },
  658. { 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, SIM } },
  659. { 0xa4080008, 0, 16, 4, /* IPRC */ { } },
  660. { 0xa408000c, 0, 16, 4, /* IPRD */ { } },
  661. { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, 0, VPU } },
  662. { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC45, USB, CMT } },
  663. { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, SCIF2 } },
  664. { 0xa408001c, 0, 16, 4, /* IPRH */ { SIOF0, SIOF1, FLCTL, I2C } },
  665. { 0xa4080020, 0, 16, 4, /* IPRI */ { SIO, 0, TSIF, RTC } },
  666. { 0xa4080024, 0, 16, 4, /* IPRJ */ { 0, 0, SIU } },
  667. { 0xa4080028, 0, 16, 4, /* IPRK */ { 0, 0, 0, SDHI } },
  668. { 0xa408002c, 0, 16, 4, /* IPRL */ { TWODG, 0, TPU } },
  669. { 0xa4140010, 0, 32, 4, /* INTPRI00 */
  670. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  671. };
  672. static struct intc_sense_reg sense_registers[] __initdata = {
  673. { 0xa414001c, 16, 2, /* ICR1 */
  674. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  675. };
  676. static struct intc_mask_reg ack_registers[] __initdata = {
  677. { 0xa4140024, 0, 8, /* INTREQ00 */
  678. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  679. };
  680. static struct intc_desc intc_desc __initdata = {
  681. .name = "sh7722",
  682. .force_enable = ENABLED,
  683. .force_disable = DISABLED,
  684. .hw = INTC_HW_DESC(vectors, groups, mask_registers,
  685. prio_registers, sense_registers, ack_registers),
  686. };
  687. void __init plat_irq_setup(void)
  688. {
  689. register_intc_controller(&intc_desc);
  690. }
  691. void __init plat_mem_setup(void)
  692. {
  693. /* Register the URAM space as Node 1 */
  694. setup_bootmem_node(1, 0x055f0000, 0x05610000);
  695. }