setup-sh7722.c 18 KB

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