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/mmzone.h>
  20. #include <asm/siu.h>
  21. #include <cpu/dma-register.h>
  22. #include <cpu/sh7722.h>
  23. static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
  24. {
  25. .slave_id = SHDMA_SLAVE_SCIF0_TX,
  26. .addr = 0xffe0000c,
  27. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  28. .mid_rid = 0x21,
  29. }, {
  30. .slave_id = SHDMA_SLAVE_SCIF0_RX,
  31. .addr = 0xffe00014,
  32. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  33. .mid_rid = 0x22,
  34. }, {
  35. .slave_id = SHDMA_SLAVE_SCIF1_TX,
  36. .addr = 0xffe1000c,
  37. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  38. .mid_rid = 0x25,
  39. }, {
  40. .slave_id = SHDMA_SLAVE_SCIF1_RX,
  41. .addr = 0xffe10014,
  42. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  43. .mid_rid = 0x26,
  44. }, {
  45. .slave_id = SHDMA_SLAVE_SCIF2_TX,
  46. .addr = 0xffe2000c,
  47. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  48. .mid_rid = 0x29,
  49. }, {
  50. .slave_id = SHDMA_SLAVE_SCIF2_RX,
  51. .addr = 0xffe20014,
  52. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
  53. .mid_rid = 0x2a,
  54. }, {
  55. .slave_id = SHDMA_SLAVE_SIUA_TX,
  56. .addr = 0xa454c098,
  57. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  58. .mid_rid = 0xb1,
  59. }, {
  60. .slave_id = SHDMA_SLAVE_SIUA_RX,
  61. .addr = 0xa454c090,
  62. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  63. .mid_rid = 0xb2,
  64. }, {
  65. .slave_id = SHDMA_SLAVE_SIUB_TX,
  66. .addr = 0xa454c09c,
  67. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  68. .mid_rid = 0xb5,
  69. }, {
  70. .slave_id = SHDMA_SLAVE_SIUB_RX,
  71. .addr = 0xa454c094,
  72. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
  73. .mid_rid = 0xb6,
  74. }, {
  75. .slave_id = SHDMA_SLAVE_SDHI0_TX,
  76. .addr = 0x04ce0030,
  77. .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  78. .mid_rid = 0xc1,
  79. }, {
  80. .slave_id = SHDMA_SLAVE_SDHI0_RX,
  81. .addr = 0x04ce0030,
  82. .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
  83. .mid_rid = 0xc2,
  84. },
  85. };
  86. static const struct sh_dmae_channel sh7722_dmae_channels[] = {
  87. {
  88. .offset = 0,
  89. .dmars = 0,
  90. .dmars_bit = 0,
  91. }, {
  92. .offset = 0x10,
  93. .dmars = 0,
  94. .dmars_bit = 8,
  95. }, {
  96. .offset = 0x20,
  97. .dmars = 4,
  98. .dmars_bit = 0,
  99. }, {
  100. .offset = 0x30,
  101. .dmars = 4,
  102. .dmars_bit = 8,
  103. }, {
  104. .offset = 0x50,
  105. .dmars = 8,
  106. .dmars_bit = 0,
  107. }, {
  108. .offset = 0x60,
  109. .dmars = 8,
  110. .dmars_bit = 8,
  111. }
  112. };
  113. static const unsigned int ts_shift[] = TS_SHIFT;
  114. static struct sh_dmae_pdata dma_platform_data = {
  115. .slave = sh7722_dmae_slaves,
  116. .slave_num = ARRAY_SIZE(sh7722_dmae_slaves),
  117. .channel = sh7722_dmae_channels,
  118. .channel_num = ARRAY_SIZE(sh7722_dmae_channels),
  119. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  120. .ts_low_mask = CHCR_TS_LOW_MASK,
  121. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  122. .ts_high_mask = CHCR_TS_HIGH_MASK,
  123. .ts_shift = ts_shift,
  124. .ts_shift_num = ARRAY_SIZE(ts_shift),
  125. .dmaor_init = DMAOR_INIT,
  126. };
  127. static struct resource sh7722_dmae_resources[] = {
  128. [0] = {
  129. /* Channel registers and DMAOR */
  130. .start = 0xfe008020,
  131. .end = 0xfe00808f,
  132. .flags = IORESOURCE_MEM,
  133. },
  134. [1] = {
  135. /* DMARSx */
  136. .start = 0xfe009000,
  137. .end = 0xfe00900b,
  138. .flags = IORESOURCE_MEM,
  139. },
  140. {
  141. /* DMA error IRQ */
  142. .start = 78,
  143. .end = 78,
  144. .flags = IORESOURCE_IRQ,
  145. },
  146. {
  147. /* IRQ for channels 0-3 */
  148. .start = 48,
  149. .end = 51,
  150. .flags = IORESOURCE_IRQ,
  151. },
  152. {
  153. /* IRQ for channels 4-5 */
  154. .start = 76,
  155. .end = 77,
  156. .flags = IORESOURCE_IRQ,
  157. },
  158. };
  159. struct platform_device dma_device = {
  160. .name = "sh-dma-engine",
  161. .id = -1,
  162. .resource = sh7722_dmae_resources,
  163. .num_resources = ARRAY_SIZE(sh7722_dmae_resources),
  164. .dev = {
  165. .platform_data = &dma_platform_data,
  166. },
  167. .archdata = {
  168. .hwblk_id = HWBLK_DMAC,
  169. },
  170. };
  171. /* Serial */
  172. static struct plat_sci_port scif0_platform_data = {
  173. .mapbase = 0xffe00000,
  174. .flags = UPF_BOOT_AUTOCONF,
  175. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  176. .scbrr_algo_id = SCBRR_ALGO_2,
  177. .type = PORT_SCIF,
  178. .irqs = { 80, 80, 80, 80 },
  179. };
  180. static struct platform_device scif0_device = {
  181. .name = "sh-sci",
  182. .id = 0,
  183. .dev = {
  184. .platform_data = &scif0_platform_data,
  185. },
  186. };
  187. static struct plat_sci_port scif1_platform_data = {
  188. .mapbase = 0xffe10000,
  189. .flags = UPF_BOOT_AUTOCONF,
  190. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  191. .scbrr_algo_id = SCBRR_ALGO_2,
  192. .type = PORT_SCIF,
  193. .irqs = { 81, 81, 81, 81 },
  194. };
  195. static struct platform_device scif1_device = {
  196. .name = "sh-sci",
  197. .id = 1,
  198. .dev = {
  199. .platform_data = &scif1_platform_data,
  200. },
  201. };
  202. static struct plat_sci_port scif2_platform_data = {
  203. .mapbase = 0xffe20000,
  204. .flags = UPF_BOOT_AUTOCONF,
  205. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  206. .scbrr_algo_id = SCBRR_ALGO_2,
  207. .type = PORT_SCIF,
  208. .irqs = { 82, 82, 82, 82 },
  209. };
  210. static struct platform_device scif2_device = {
  211. .name = "sh-sci",
  212. .id = 2,
  213. .dev = {
  214. .platform_data = &scif2_platform_data,
  215. },
  216. };
  217. static struct resource rtc_resources[] = {
  218. [0] = {
  219. .start = 0xa465fec0,
  220. .end = 0xa465fec0 + 0x58 - 1,
  221. .flags = IORESOURCE_IO,
  222. },
  223. [1] = {
  224. /* Period IRQ */
  225. .start = 45,
  226. .flags = IORESOURCE_IRQ,
  227. },
  228. [2] = {
  229. /* Carry IRQ */
  230. .start = 46,
  231. .flags = IORESOURCE_IRQ,
  232. },
  233. [3] = {
  234. /* Alarm IRQ */
  235. .start = 44,
  236. .flags = IORESOURCE_IRQ,
  237. },
  238. };
  239. static struct platform_device rtc_device = {
  240. .name = "sh-rtc",
  241. .id = -1,
  242. .num_resources = ARRAY_SIZE(rtc_resources),
  243. .resource = rtc_resources,
  244. .archdata = {
  245. .hwblk_id = HWBLK_RTC,
  246. },
  247. };
  248. static struct m66592_platdata usbf_platdata = {
  249. .on_chip = 1,
  250. };
  251. static struct resource usbf_resources[] = {
  252. [0] = {
  253. .name = "USBF",
  254. .start = 0x04480000,
  255. .end = 0x044800FF,
  256. .flags = IORESOURCE_MEM,
  257. },
  258. [1] = {
  259. .start = 65,
  260. .end = 65,
  261. .flags = IORESOURCE_IRQ,
  262. },
  263. };
  264. static struct platform_device usbf_device = {
  265. .name = "m66592_udc",
  266. .id = 0, /* "usbf0" clock */
  267. .dev = {
  268. .dma_mask = NULL,
  269. .coherent_dma_mask = 0xffffffff,
  270. .platform_data = &usbf_platdata,
  271. },
  272. .num_resources = ARRAY_SIZE(usbf_resources),
  273. .resource = usbf_resources,
  274. .archdata = {
  275. .hwblk_id = HWBLK_USBF,
  276. },
  277. };
  278. static struct resource iic_resources[] = {
  279. [0] = {
  280. .name = "IIC",
  281. .start = 0x04470000,
  282. .end = 0x04470017,
  283. .flags = IORESOURCE_MEM,
  284. },
  285. [1] = {
  286. .start = 96,
  287. .end = 99,
  288. .flags = IORESOURCE_IRQ,
  289. },
  290. };
  291. static struct platform_device iic_device = {
  292. .name = "i2c-sh_mobile",
  293. .id = 0, /* "i2c0" clock */
  294. .num_resources = ARRAY_SIZE(iic_resources),
  295. .resource = iic_resources,
  296. .archdata = {
  297. .hwblk_id = HWBLK_IIC,
  298. },
  299. };
  300. static struct uio_info vpu_platform_data = {
  301. .name = "VPU4",
  302. .version = "0",
  303. .irq = 60,
  304. };
  305. static struct resource vpu_resources[] = {
  306. [0] = {
  307. .name = "VPU",
  308. .start = 0xfe900000,
  309. .end = 0xfe9022eb,
  310. .flags = IORESOURCE_MEM,
  311. },
  312. [1] = {
  313. /* place holder for contiguous memory */
  314. },
  315. };
  316. static struct platform_device vpu_device = {
  317. .name = "uio_pdrv_genirq",
  318. .id = 0,
  319. .dev = {
  320. .platform_data = &vpu_platform_data,
  321. },
  322. .resource = vpu_resources,
  323. .num_resources = ARRAY_SIZE(vpu_resources),
  324. .archdata = {
  325. .hwblk_id = HWBLK_VPU,
  326. },
  327. };
  328. static struct uio_info veu_platform_data = {
  329. .name = "VEU",
  330. .version = "0",
  331. .irq = 54,
  332. };
  333. static struct resource veu_resources[] = {
  334. [0] = {
  335. .name = "VEU",
  336. .start = 0xfe920000,
  337. .end = 0xfe9200b7,
  338. .flags = IORESOURCE_MEM,
  339. },
  340. [1] = {
  341. /* place holder for contiguous memory */
  342. },
  343. };
  344. static struct platform_device veu_device = {
  345. .name = "uio_pdrv_genirq",
  346. .id = 1,
  347. .dev = {
  348. .platform_data = &veu_platform_data,
  349. },
  350. .resource = veu_resources,
  351. .num_resources = ARRAY_SIZE(veu_resources),
  352. .archdata = {
  353. .hwblk_id = HWBLK_VEU,
  354. },
  355. };
  356. static struct uio_info jpu_platform_data = {
  357. .name = "JPU",
  358. .version = "0",
  359. .irq = 27,
  360. };
  361. static struct resource jpu_resources[] = {
  362. [0] = {
  363. .name = "JPU",
  364. .start = 0xfea00000,
  365. .end = 0xfea102d3,
  366. .flags = IORESOURCE_MEM,
  367. },
  368. [1] = {
  369. /* place holder for contiguous memory */
  370. },
  371. };
  372. static struct platform_device jpu_device = {
  373. .name = "uio_pdrv_genirq",
  374. .id = 2,
  375. .dev = {
  376. .platform_data = &jpu_platform_data,
  377. },
  378. .resource = jpu_resources,
  379. .num_resources = ARRAY_SIZE(jpu_resources),
  380. .archdata = {
  381. .hwblk_id = HWBLK_JPU,
  382. },
  383. };
  384. static struct sh_timer_config cmt_platform_data = {
  385. .channel_offset = 0x60,
  386. .timer_bit = 5,
  387. .clockevent_rating = 125,
  388. .clocksource_rating = 125,
  389. };
  390. static struct resource cmt_resources[] = {
  391. [0] = {
  392. .start = 0x044a0060,
  393. .end = 0x044a006b,
  394. .flags = IORESOURCE_MEM,
  395. },
  396. [1] = {
  397. .start = 104,
  398. .flags = IORESOURCE_IRQ,
  399. },
  400. };
  401. static struct platform_device cmt_device = {
  402. .name = "sh_cmt",
  403. .id = 0,
  404. .dev = {
  405. .platform_data = &cmt_platform_data,
  406. },
  407. .resource = cmt_resources,
  408. .num_resources = ARRAY_SIZE(cmt_resources),
  409. .archdata = {
  410. .hwblk_id = HWBLK_CMT,
  411. },
  412. };
  413. static struct sh_timer_config tmu0_platform_data = {
  414. .channel_offset = 0x04,
  415. .timer_bit = 0,
  416. .clockevent_rating = 200,
  417. };
  418. static struct resource tmu0_resources[] = {
  419. [0] = {
  420. .start = 0xffd80008,
  421. .end = 0xffd80013,
  422. .flags = IORESOURCE_MEM,
  423. },
  424. [1] = {
  425. .start = 16,
  426. .flags = IORESOURCE_IRQ,
  427. },
  428. };
  429. static struct platform_device tmu0_device = {
  430. .name = "sh_tmu",
  431. .id = 0,
  432. .dev = {
  433. .platform_data = &tmu0_platform_data,
  434. },
  435. .resource = tmu0_resources,
  436. .num_resources = ARRAY_SIZE(tmu0_resources),
  437. .archdata = {
  438. .hwblk_id = HWBLK_TMU,
  439. },
  440. };
  441. static struct sh_timer_config tmu1_platform_data = {
  442. .channel_offset = 0x10,
  443. .timer_bit = 1,
  444. .clocksource_rating = 200,
  445. };
  446. static struct resource tmu1_resources[] = {
  447. [0] = {
  448. .start = 0xffd80014,
  449. .end = 0xffd8001f,
  450. .flags = IORESOURCE_MEM,
  451. },
  452. [1] = {
  453. .start = 17,
  454. .flags = IORESOURCE_IRQ,
  455. },
  456. };
  457. static struct platform_device tmu1_device = {
  458. .name = "sh_tmu",
  459. .id = 1,
  460. .dev = {
  461. .platform_data = &tmu1_platform_data,
  462. },
  463. .resource = tmu1_resources,
  464. .num_resources = ARRAY_SIZE(tmu1_resources),
  465. .archdata = {
  466. .hwblk_id = HWBLK_TMU,
  467. },
  468. };
  469. static struct sh_timer_config tmu2_platform_data = {
  470. .channel_offset = 0x1c,
  471. .timer_bit = 2,
  472. };
  473. static struct resource tmu2_resources[] = {
  474. [0] = {
  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 = "siu-pcm-audio",
  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, ENABLED, 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. }