setup-sh7722.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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 | RS_ERS | 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. .channels_mask = 0x20,
  383. };
  384. static struct resource cmt_resources[] = {
  385. DEFINE_RES_MEM(0x044a0000, 0x70),
  386. DEFINE_RES_IRQ(evt2irq(0xf00)),
  387. };
  388. static struct platform_device cmt_device = {
  389. .name = "sh-cmt-32",
  390. .id = 0,
  391. .dev = {
  392. .platform_data = &cmt_platform_data,
  393. },
  394. .resource = cmt_resources,
  395. .num_resources = ARRAY_SIZE(cmt_resources),
  396. };
  397. static struct sh_timer_config tmu0_platform_data = {
  398. .channels_mask = 7,
  399. };
  400. static struct resource tmu0_resources[] = {
  401. DEFINE_RES_MEM(0xffd80000, 0x2c),
  402. DEFINE_RES_IRQ(evt2irq(0x400)),
  403. DEFINE_RES_IRQ(evt2irq(0x420)),
  404. DEFINE_RES_IRQ(evt2irq(0x440)),
  405. };
  406. static struct platform_device tmu0_device = {
  407. .name = "sh-tmu",
  408. .id = 0,
  409. .dev = {
  410. .platform_data = &tmu0_platform_data,
  411. },
  412. .resource = tmu0_resources,
  413. .num_resources = ARRAY_SIZE(tmu0_resources),
  414. };
  415. static struct siu_platform siu_platform_data = {
  416. .dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX,
  417. .dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX,
  418. .dma_slave_tx_b = SHDMA_SLAVE_SIUB_TX,
  419. .dma_slave_rx_b = SHDMA_SLAVE_SIUB_RX,
  420. };
  421. static struct resource siu_resources[] = {
  422. [0] = {
  423. .start = 0xa4540000,
  424. .end = 0xa454c10f,
  425. .flags = IORESOURCE_MEM,
  426. },
  427. [1] = {
  428. .start = evt2irq(0xf80),
  429. .flags = IORESOURCE_IRQ,
  430. },
  431. };
  432. static struct platform_device siu_device = {
  433. .name = "siu-pcm-audio",
  434. .id = -1,
  435. .dev = {
  436. .platform_data = &siu_platform_data,
  437. },
  438. .resource = siu_resources,
  439. .num_resources = ARRAY_SIZE(siu_resources),
  440. };
  441. static struct platform_device *sh7722_devices[] __initdata = {
  442. &scif0_device,
  443. &scif1_device,
  444. &scif2_device,
  445. &cmt_device,
  446. &tmu0_device,
  447. &rtc_device,
  448. &usbf_device,
  449. &iic_device,
  450. &vpu_device,
  451. &veu_device,
  452. &jpu_device,
  453. &siu_device,
  454. &dma_device,
  455. };
  456. static int __init sh7722_devices_setup(void)
  457. {
  458. platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
  459. platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
  460. platform_resource_setup_memory(&jpu_device, "jpu", 2 << 20);
  461. return platform_add_devices(sh7722_devices,
  462. ARRAY_SIZE(sh7722_devices));
  463. }
  464. arch_initcall(sh7722_devices_setup);
  465. static struct platform_device *sh7722_early_devices[] __initdata = {
  466. &scif0_device,
  467. &scif1_device,
  468. &scif2_device,
  469. &cmt_device,
  470. &tmu0_device,
  471. };
  472. void __init plat_early_device_setup(void)
  473. {
  474. early_platform_add_devices(sh7722_early_devices,
  475. ARRAY_SIZE(sh7722_early_devices));
  476. }
  477. enum {
  478. UNUSED=0,
  479. ENABLED,
  480. DISABLED,
  481. /* interrupt sources */
  482. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  483. HUDI,
  484. SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
  485. RTC_ATI, RTC_PRI, RTC_CUI,
  486. DMAC0, DMAC1, DMAC2, DMAC3,
  487. VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU,
  488. VPU, TPU,
  489. USB_USBI0, USB_USBI1,
  490. DMAC4, DMAC5, DMAC_DADERR,
  491. KEYSC,
  492. SCIF0, SCIF1, SCIF2, SIOF0, SIOF1, SIO,
  493. FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
  494. I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI,
  495. CMT, TSIF, SIU, TWODG,
  496. TMU0, TMU1, TMU2,
  497. IRDA, JPU, LCDC,
  498. /* interrupt groups */
  499. SIM, RTC, DMAC0123, VIOVOU, USB, DMAC45, FLCTL, I2C, SDHI,
  500. };
  501. static struct intc_vect vectors[] __initdata = {
  502. INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
  503. INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
  504. INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
  505. INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
  506. INTC_VECT(SIM_ERI, 0x700), INTC_VECT(SIM_RXI, 0x720),
  507. INTC_VECT(SIM_TXI, 0x740), INTC_VECT(SIM_TEI, 0x760),
  508. INTC_VECT(RTC_ATI, 0x780), INTC_VECT(RTC_PRI, 0x7a0),
  509. INTC_VECT(RTC_CUI, 0x7c0),
  510. INTC_VECT(DMAC0, 0x800), INTC_VECT(DMAC1, 0x820),
  511. INTC_VECT(DMAC2, 0x840), INTC_VECT(DMAC3, 0x860),
  512. INTC_VECT(VIO_CEUI, 0x880), INTC_VECT(VIO_BEUI, 0x8a0),
  513. INTC_VECT(VIO_VEUI, 0x8c0), INTC_VECT(VOU, 0x8e0),
  514. INTC_VECT(VPU, 0x980), INTC_VECT(TPU, 0x9a0),
  515. INTC_VECT(USB_USBI0, 0xa20), INTC_VECT(USB_USBI1, 0xa40),
  516. INTC_VECT(DMAC4, 0xb80), INTC_VECT(DMAC5, 0xba0),
  517. INTC_VECT(DMAC_DADERR, 0xbc0), INTC_VECT(KEYSC, 0xbe0),
  518. INTC_VECT(SCIF0, 0xc00), INTC_VECT(SCIF1, 0xc20),
  519. INTC_VECT(SCIF2, 0xc40), INTC_VECT(SIOF0, 0xc80),
  520. INTC_VECT(SIOF1, 0xca0), INTC_VECT(SIO, 0xd00),
  521. INTC_VECT(FLCTL_FLSTEI, 0xd80), INTC_VECT(FLCTL_FLENDI, 0xda0),
  522. INTC_VECT(FLCTL_FLTREQ0I, 0xdc0), INTC_VECT(FLCTL_FLTREQ1I, 0xde0),
  523. INTC_VECT(I2C_ALI, 0xe00), INTC_VECT(I2C_TACKI, 0xe20),
  524. INTC_VECT(I2C_WAITI, 0xe40), INTC_VECT(I2C_DTEI, 0xe60),
  525. INTC_VECT(SDHI, 0xe80), INTC_VECT(SDHI, 0xea0),
  526. INTC_VECT(SDHI, 0xec0), INTC_VECT(SDHI, 0xee0),
  527. INTC_VECT(CMT, 0xf00), INTC_VECT(TSIF, 0xf20),
  528. INTC_VECT(SIU, 0xf80), INTC_VECT(TWODG, 0xfa0),
  529. INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
  530. INTC_VECT(TMU2, 0x440), INTC_VECT(IRDA, 0x480),
  531. INTC_VECT(JPU, 0x560), INTC_VECT(LCDC, 0x580),
  532. };
  533. static struct intc_group groups[] __initdata = {
  534. INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI),
  535. INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
  536. INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3),
  537. INTC_GROUP(VIOVOU, VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU),
  538. INTC_GROUP(USB, USB_USBI0, USB_USBI1),
  539. INTC_GROUP(DMAC45, DMAC4, DMAC5, DMAC_DADERR),
  540. INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLENDI,
  541. FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
  542. INTC_GROUP(I2C, I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI),
  543. };
  544. static struct intc_mask_reg mask_registers[] __initdata = {
  545. { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
  546. { } },
  547. { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
  548. { VOU, VIO_VEUI, VIO_BEUI, VIO_CEUI, DMAC3, DMAC2, DMAC1, DMAC0 } },
  549. { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
  550. { 0, 0, 0, VPU, } },
  551. { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
  552. { SIM_TEI, SIM_TXI, SIM_RXI, SIM_ERI, 0, 0, 0, IRDA } },
  553. { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
  554. { 0, TMU2, TMU1, TMU0, JPU, 0, 0, LCDC } },
  555. { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
  556. { KEYSC, DMAC_DADERR, DMAC5, DMAC4, 0, SCIF2, SCIF1, SCIF0 } },
  557. { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
  558. { 0, 0, 0, SIO, 0, 0, SIOF1, SIOF0 } },
  559. { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
  560. { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
  561. FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLENDI, FLCTL_FLSTEI } },
  562. { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
  563. { DISABLED, ENABLED, ENABLED, ENABLED, 0, 0, TWODG, SIU } },
  564. { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
  565. { 0, 0, 0, CMT, 0, USB_USBI1, USB_USBI0, } },
  566. { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
  567. { } },
  568. { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
  569. { 0, RTC_CUI, RTC_PRI, RTC_ATI, 0, TPU, 0, TSIF } },
  570. { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
  571. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  572. };
  573. static struct intc_prio_reg prio_registers[] __initdata = {
  574. { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, IRDA } },
  575. { 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, SIM } },
  576. { 0xa4080008, 0, 16, 4, /* IPRC */ { } },
  577. { 0xa408000c, 0, 16, 4, /* IPRD */ { } },
  578. { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, 0, VPU } },
  579. { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC45, USB, CMT } },
  580. { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, SCIF2 } },
  581. { 0xa408001c, 0, 16, 4, /* IPRH */ { SIOF0, SIOF1, FLCTL, I2C } },
  582. { 0xa4080020, 0, 16, 4, /* IPRI */ { SIO, 0, TSIF, RTC } },
  583. { 0xa4080024, 0, 16, 4, /* IPRJ */ { 0, 0, SIU } },
  584. { 0xa4080028, 0, 16, 4, /* IPRK */ { 0, 0, 0, SDHI } },
  585. { 0xa408002c, 0, 16, 4, /* IPRL */ { TWODG, 0, TPU } },
  586. { 0xa4140010, 0, 32, 4, /* INTPRI00 */
  587. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  588. };
  589. static struct intc_sense_reg sense_registers[] __initdata = {
  590. { 0xa414001c, 16, 2, /* ICR1 */
  591. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  592. };
  593. static struct intc_mask_reg ack_registers[] __initdata = {
  594. { 0xa4140024, 0, 8, /* INTREQ00 */
  595. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  596. };
  597. static struct intc_desc intc_desc __initdata = {
  598. .name = "sh7722",
  599. .force_enable = ENABLED,
  600. .force_disable = DISABLED,
  601. .hw = INTC_HW_DESC(vectors, groups, mask_registers,
  602. prio_registers, sense_registers, ack_registers),
  603. };
  604. void __init plat_irq_setup(void)
  605. {
  606. register_intc_controller(&intc_desc);
  607. }
  608. void __init plat_mem_setup(void)
  609. {
  610. /* Register the URAM space as Node 1 */
  611. setup_bootmem_node(1, 0x055f0000, 0x05610000);
  612. }