setup-sh7722.c 17 KB

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