setup-sh7722.c 18 KB

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