setup-sh7723.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. /*
  2. * SH7723 Setup
  3. *
  4. * Copyright (C) 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/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/serial.h>
  13. #include <linux/mm.h>
  14. #include <linux/serial_sci.h>
  15. #include <linux/uio_driver.h>
  16. #include <linux/usb/r8a66597.h>
  17. #include <linux/sh_timer.h>
  18. #include <linux/io.h>
  19. #include <asm/clock.h>
  20. #include <asm/mmzone.h>
  21. #include <cpu/sh7723.h>
  22. /* Serial */
  23. static struct plat_sci_port scif0_platform_data = {
  24. .mapbase = 0xffe00000,
  25. .flags = UPF_BOOT_AUTOCONF,
  26. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  27. .scbrr_algo_id = SCBRR_ALGO_2,
  28. .type = PORT_SCIF,
  29. .irqs = { 80, 80, 80, 80 },
  30. };
  31. static struct platform_device scif0_device = {
  32. .name = "sh-sci",
  33. .id = 0,
  34. .dev = {
  35. .platform_data = &scif0_platform_data,
  36. },
  37. };
  38. static struct plat_sci_port scif1_platform_data = {
  39. .mapbase = 0xffe10000,
  40. .flags = UPF_BOOT_AUTOCONF,
  41. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  42. .scbrr_algo_id = SCBRR_ALGO_2,
  43. .type = PORT_SCIF,
  44. .irqs = { 81, 81, 81, 81 },
  45. };
  46. static struct platform_device scif1_device = {
  47. .name = "sh-sci",
  48. .id = 1,
  49. .dev = {
  50. .platform_data = &scif1_platform_data,
  51. },
  52. };
  53. static struct plat_sci_port scif2_platform_data = {
  54. .mapbase = 0xffe20000,
  55. .flags = UPF_BOOT_AUTOCONF,
  56. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  57. .scbrr_algo_id = SCBRR_ALGO_2,
  58. .type = PORT_SCIF,
  59. .irqs = { 82, 82, 82, 82 },
  60. };
  61. static struct platform_device scif2_device = {
  62. .name = "sh-sci",
  63. .id = 2,
  64. .dev = {
  65. .platform_data = &scif2_platform_data,
  66. },
  67. };
  68. static struct plat_sci_port scif3_platform_data = {
  69. .mapbase = 0xa4e30000,
  70. .flags = UPF_BOOT_AUTOCONF,
  71. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  72. .scbrr_algo_id = SCBRR_ALGO_3,
  73. .type = PORT_SCIFA,
  74. .irqs = { 56, 56, 56, 56 },
  75. };
  76. static struct platform_device scif3_device = {
  77. .name = "sh-sci",
  78. .id = 3,
  79. .dev = {
  80. .platform_data = &scif3_platform_data,
  81. },
  82. };
  83. static struct plat_sci_port scif4_platform_data = {
  84. .mapbase = 0xa4e40000,
  85. .flags = UPF_BOOT_AUTOCONF,
  86. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  87. .scbrr_algo_id = SCBRR_ALGO_3,
  88. .type = PORT_SCIFA,
  89. .irqs = { 88, 88, 88, 88 },
  90. };
  91. static struct platform_device scif4_device = {
  92. .name = "sh-sci",
  93. .id = 4,
  94. .dev = {
  95. .platform_data = &scif4_platform_data,
  96. },
  97. };
  98. static struct plat_sci_port scif5_platform_data = {
  99. .mapbase = 0xa4e50000,
  100. .flags = UPF_BOOT_AUTOCONF,
  101. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  102. .scbrr_algo_id = SCBRR_ALGO_3,
  103. .type = PORT_SCIFA,
  104. .irqs = { 109, 109, 109, 109 },
  105. };
  106. static struct platform_device scif5_device = {
  107. .name = "sh-sci",
  108. .id = 5,
  109. .dev = {
  110. .platform_data = &scif5_platform_data,
  111. },
  112. };
  113. static struct uio_info vpu_platform_data = {
  114. .name = "VPU5",
  115. .version = "0",
  116. .irq = 60,
  117. };
  118. static struct resource vpu_resources[] = {
  119. [0] = {
  120. .name = "VPU",
  121. .start = 0xfe900000,
  122. .end = 0xfe902807,
  123. .flags = IORESOURCE_MEM,
  124. },
  125. [1] = {
  126. /* place holder for contiguous memory */
  127. },
  128. };
  129. static struct platform_device vpu_device = {
  130. .name = "uio_pdrv_genirq",
  131. .id = 0,
  132. .dev = {
  133. .platform_data = &vpu_platform_data,
  134. },
  135. .resource = vpu_resources,
  136. .num_resources = ARRAY_SIZE(vpu_resources),
  137. .archdata = {
  138. .hwblk_id = HWBLK_VPU,
  139. },
  140. };
  141. static struct uio_info veu0_platform_data = {
  142. .name = "VEU2H",
  143. .version = "0",
  144. .irq = 54,
  145. };
  146. static struct resource veu0_resources[] = {
  147. [0] = {
  148. .name = "VEU2H0",
  149. .start = 0xfe920000,
  150. .end = 0xfe92027b,
  151. .flags = IORESOURCE_MEM,
  152. },
  153. [1] = {
  154. /* place holder for contiguous memory */
  155. },
  156. };
  157. static struct platform_device veu0_device = {
  158. .name = "uio_pdrv_genirq",
  159. .id = 1,
  160. .dev = {
  161. .platform_data = &veu0_platform_data,
  162. },
  163. .resource = veu0_resources,
  164. .num_resources = ARRAY_SIZE(veu0_resources),
  165. .archdata = {
  166. .hwblk_id = HWBLK_VEU2H0,
  167. },
  168. };
  169. static struct uio_info veu1_platform_data = {
  170. .name = "VEU2H",
  171. .version = "0",
  172. .irq = 27,
  173. };
  174. static struct resource veu1_resources[] = {
  175. [0] = {
  176. .name = "VEU2H1",
  177. .start = 0xfe924000,
  178. .end = 0xfe92427b,
  179. .flags = IORESOURCE_MEM,
  180. },
  181. [1] = {
  182. /* place holder for contiguous memory */
  183. },
  184. };
  185. static struct platform_device veu1_device = {
  186. .name = "uio_pdrv_genirq",
  187. .id = 2,
  188. .dev = {
  189. .platform_data = &veu1_platform_data,
  190. },
  191. .resource = veu1_resources,
  192. .num_resources = ARRAY_SIZE(veu1_resources),
  193. .archdata = {
  194. .hwblk_id = HWBLK_VEU2H1,
  195. },
  196. };
  197. static struct sh_timer_config cmt_platform_data = {
  198. .channel_offset = 0x60,
  199. .timer_bit = 5,
  200. .clockevent_rating = 125,
  201. .clocksource_rating = 125,
  202. };
  203. static struct resource cmt_resources[] = {
  204. [0] = {
  205. .start = 0x044a0060,
  206. .end = 0x044a006b,
  207. .flags = IORESOURCE_MEM,
  208. },
  209. [1] = {
  210. .start = 104,
  211. .flags = IORESOURCE_IRQ,
  212. },
  213. };
  214. static struct platform_device cmt_device = {
  215. .name = "sh_cmt",
  216. .id = 0,
  217. .dev = {
  218. .platform_data = &cmt_platform_data,
  219. },
  220. .resource = cmt_resources,
  221. .num_resources = ARRAY_SIZE(cmt_resources),
  222. .archdata = {
  223. .hwblk_id = HWBLK_CMT,
  224. },
  225. };
  226. static struct sh_timer_config tmu0_platform_data = {
  227. .channel_offset = 0x04,
  228. .timer_bit = 0,
  229. .clockevent_rating = 200,
  230. };
  231. static struct resource tmu0_resources[] = {
  232. [0] = {
  233. .start = 0xffd80008,
  234. .end = 0xffd80013,
  235. .flags = IORESOURCE_MEM,
  236. },
  237. [1] = {
  238. .start = 16,
  239. .flags = IORESOURCE_IRQ,
  240. },
  241. };
  242. static struct platform_device tmu0_device = {
  243. .name = "sh_tmu",
  244. .id = 0,
  245. .dev = {
  246. .platform_data = &tmu0_platform_data,
  247. },
  248. .resource = tmu0_resources,
  249. .num_resources = ARRAY_SIZE(tmu0_resources),
  250. .archdata = {
  251. .hwblk_id = HWBLK_TMU0,
  252. },
  253. };
  254. static struct sh_timer_config tmu1_platform_data = {
  255. .channel_offset = 0x10,
  256. .timer_bit = 1,
  257. .clocksource_rating = 200,
  258. };
  259. static struct resource tmu1_resources[] = {
  260. [0] = {
  261. .start = 0xffd80014,
  262. .end = 0xffd8001f,
  263. .flags = IORESOURCE_MEM,
  264. },
  265. [1] = {
  266. .start = 17,
  267. .flags = IORESOURCE_IRQ,
  268. },
  269. };
  270. static struct platform_device tmu1_device = {
  271. .name = "sh_tmu",
  272. .id = 1,
  273. .dev = {
  274. .platform_data = &tmu1_platform_data,
  275. },
  276. .resource = tmu1_resources,
  277. .num_resources = ARRAY_SIZE(tmu1_resources),
  278. .archdata = {
  279. .hwblk_id = HWBLK_TMU0,
  280. },
  281. };
  282. static struct sh_timer_config tmu2_platform_data = {
  283. .channel_offset = 0x1c,
  284. .timer_bit = 2,
  285. };
  286. static struct resource tmu2_resources[] = {
  287. [0] = {
  288. .start = 0xffd80020,
  289. .end = 0xffd8002b,
  290. .flags = IORESOURCE_MEM,
  291. },
  292. [1] = {
  293. .start = 18,
  294. .flags = IORESOURCE_IRQ,
  295. },
  296. };
  297. static struct platform_device tmu2_device = {
  298. .name = "sh_tmu",
  299. .id = 2,
  300. .dev = {
  301. .platform_data = &tmu2_platform_data,
  302. },
  303. .resource = tmu2_resources,
  304. .num_resources = ARRAY_SIZE(tmu2_resources),
  305. .archdata = {
  306. .hwblk_id = HWBLK_TMU0,
  307. },
  308. };
  309. static struct sh_timer_config tmu3_platform_data = {
  310. .channel_offset = 0x04,
  311. .timer_bit = 0,
  312. };
  313. static struct resource tmu3_resources[] = {
  314. [0] = {
  315. .start = 0xffd90008,
  316. .end = 0xffd90013,
  317. .flags = IORESOURCE_MEM,
  318. },
  319. [1] = {
  320. .start = 57,
  321. .flags = IORESOURCE_IRQ,
  322. },
  323. };
  324. static struct platform_device tmu3_device = {
  325. .name = "sh_tmu",
  326. .id = 3,
  327. .dev = {
  328. .platform_data = &tmu3_platform_data,
  329. },
  330. .resource = tmu3_resources,
  331. .num_resources = ARRAY_SIZE(tmu3_resources),
  332. .archdata = {
  333. .hwblk_id = HWBLK_TMU1,
  334. },
  335. };
  336. static struct sh_timer_config tmu4_platform_data = {
  337. .channel_offset = 0x10,
  338. .timer_bit = 1,
  339. };
  340. static struct resource tmu4_resources[] = {
  341. [0] = {
  342. .start = 0xffd90014,
  343. .end = 0xffd9001f,
  344. .flags = IORESOURCE_MEM,
  345. },
  346. [1] = {
  347. .start = 58,
  348. .flags = IORESOURCE_IRQ,
  349. },
  350. };
  351. static struct platform_device tmu4_device = {
  352. .name = "sh_tmu",
  353. .id = 4,
  354. .dev = {
  355. .platform_data = &tmu4_platform_data,
  356. },
  357. .resource = tmu4_resources,
  358. .num_resources = ARRAY_SIZE(tmu4_resources),
  359. .archdata = {
  360. .hwblk_id = HWBLK_TMU1,
  361. },
  362. };
  363. static struct sh_timer_config tmu5_platform_data = {
  364. .channel_offset = 0x1c,
  365. .timer_bit = 2,
  366. };
  367. static struct resource tmu5_resources[] = {
  368. [0] = {
  369. .start = 0xffd90020,
  370. .end = 0xffd9002b,
  371. .flags = IORESOURCE_MEM,
  372. },
  373. [1] = {
  374. .start = 57,
  375. .flags = IORESOURCE_IRQ,
  376. },
  377. };
  378. static struct platform_device tmu5_device = {
  379. .name = "sh_tmu",
  380. .id = 5,
  381. .dev = {
  382. .platform_data = &tmu5_platform_data,
  383. },
  384. .resource = tmu5_resources,
  385. .num_resources = ARRAY_SIZE(tmu5_resources),
  386. .archdata = {
  387. .hwblk_id = HWBLK_TMU1,
  388. },
  389. };
  390. static struct resource rtc_resources[] = {
  391. [0] = {
  392. .start = 0xa465fec0,
  393. .end = 0xa465fec0 + 0x58 - 1,
  394. .flags = IORESOURCE_IO,
  395. },
  396. [1] = {
  397. /* Period IRQ */
  398. .start = 69,
  399. .flags = IORESOURCE_IRQ,
  400. },
  401. [2] = {
  402. /* Carry IRQ */
  403. .start = 70,
  404. .flags = IORESOURCE_IRQ,
  405. },
  406. [3] = {
  407. /* Alarm IRQ */
  408. .start = 68,
  409. .flags = IORESOURCE_IRQ,
  410. },
  411. };
  412. static struct platform_device rtc_device = {
  413. .name = "sh-rtc",
  414. .id = -1,
  415. .num_resources = ARRAY_SIZE(rtc_resources),
  416. .resource = rtc_resources,
  417. .archdata = {
  418. .hwblk_id = HWBLK_RTC,
  419. },
  420. };
  421. static struct r8a66597_platdata r8a66597_data = {
  422. .on_chip = 1,
  423. };
  424. static struct resource sh7723_usb_host_resources[] = {
  425. [0] = {
  426. .start = 0xa4d80000,
  427. .end = 0xa4d800ff,
  428. .flags = IORESOURCE_MEM,
  429. },
  430. [1] = {
  431. .start = 65,
  432. .end = 65,
  433. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  434. },
  435. };
  436. static struct platform_device sh7723_usb_host_device = {
  437. .name = "r8a66597_hcd",
  438. .id = 0,
  439. .dev = {
  440. .dma_mask = NULL, /* not use dma */
  441. .coherent_dma_mask = 0xffffffff,
  442. .platform_data = &r8a66597_data,
  443. },
  444. .num_resources = ARRAY_SIZE(sh7723_usb_host_resources),
  445. .resource = sh7723_usb_host_resources,
  446. .archdata = {
  447. .hwblk_id = HWBLK_USB,
  448. },
  449. };
  450. static struct resource iic_resources[] = {
  451. [0] = {
  452. .name = "IIC",
  453. .start = 0x04470000,
  454. .end = 0x04470017,
  455. .flags = IORESOURCE_MEM,
  456. },
  457. [1] = {
  458. .start = 96,
  459. .end = 99,
  460. .flags = IORESOURCE_IRQ,
  461. },
  462. };
  463. static struct platform_device iic_device = {
  464. .name = "i2c-sh_mobile",
  465. .id = 0, /* "i2c0" clock */
  466. .num_resources = ARRAY_SIZE(iic_resources),
  467. .resource = iic_resources,
  468. .archdata = {
  469. .hwblk_id = HWBLK_IIC,
  470. },
  471. };
  472. static struct platform_device *sh7723_devices[] __initdata = {
  473. &scif0_device,
  474. &scif1_device,
  475. &scif2_device,
  476. &scif3_device,
  477. &scif4_device,
  478. &scif5_device,
  479. &cmt_device,
  480. &tmu0_device,
  481. &tmu1_device,
  482. &tmu2_device,
  483. &tmu3_device,
  484. &tmu4_device,
  485. &tmu5_device,
  486. &rtc_device,
  487. &iic_device,
  488. &sh7723_usb_host_device,
  489. &vpu_device,
  490. &veu0_device,
  491. &veu1_device,
  492. };
  493. static int __init sh7723_devices_setup(void)
  494. {
  495. platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
  496. platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
  497. platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
  498. return platform_add_devices(sh7723_devices,
  499. ARRAY_SIZE(sh7723_devices));
  500. }
  501. arch_initcall(sh7723_devices_setup);
  502. static struct platform_device *sh7723_early_devices[] __initdata = {
  503. &scif0_device,
  504. &scif1_device,
  505. &scif2_device,
  506. &scif3_device,
  507. &scif4_device,
  508. &scif5_device,
  509. &cmt_device,
  510. &tmu0_device,
  511. &tmu1_device,
  512. &tmu2_device,
  513. &tmu3_device,
  514. &tmu4_device,
  515. &tmu5_device,
  516. };
  517. void __init plat_early_device_setup(void)
  518. {
  519. early_platform_add_devices(sh7723_early_devices,
  520. ARRAY_SIZE(sh7723_early_devices));
  521. }
  522. #define RAMCR_CACHE_L2FC 0x0002
  523. #define RAMCR_CACHE_L2E 0x0001
  524. #define L2_CACHE_ENABLE (RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC)
  525. void l2_cache_init(void)
  526. {
  527. /* Enable L2 cache */
  528. __raw_writel(L2_CACHE_ENABLE, RAMCR);
  529. }
  530. enum {
  531. UNUSED=0,
  532. ENABLED,
  533. DISABLED,
  534. /* interrupt sources */
  535. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  536. HUDI,
  537. DMAC1A_DEI0,DMAC1A_DEI1,DMAC1A_DEI2,DMAC1A_DEI3,
  538. _2DG_TRI,_2DG_INI,_2DG_CEI,
  539. DMAC0A_DEI0,DMAC0A_DEI1,DMAC0A_DEI2,DMAC0A_DEI3,
  540. VIO_CEUI,VIO_BEUI,VIO_VEU2HI,VIO_VOUI,
  541. SCIFA_SCIFA0,
  542. VPU_VPUI,
  543. TPU_TPUI,
  544. ADC_ADI,
  545. USB_USI0,
  546. RTC_ATI,RTC_PRI,RTC_CUI,
  547. DMAC1B_DEI4,DMAC1B_DEI5,DMAC1B_DADERR,
  548. DMAC0B_DEI4,DMAC0B_DEI5,DMAC0B_DADERR,
  549. KEYSC_KEYI,
  550. SCIF_SCIF0,SCIF_SCIF1,SCIF_SCIF2,
  551. MSIOF_MSIOFI0,MSIOF_MSIOFI1,
  552. SCIFA_SCIFA1,
  553. FLCTL_FLSTEI,FLCTL_FLTENDI,FLCTL_FLTREQ0I,FLCTL_FLTREQ1I,
  554. I2C_ALI,I2C_TACKI,I2C_WAITI,I2C_DTEI,
  555. CMT_CMTI,
  556. TSIF_TSIFI,
  557. SIU_SIUI,
  558. SCIFA_SCIFA2,
  559. TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2,
  560. IRDA_IRDAI,
  561. ATAPI_ATAPII,
  562. VEU2H1_VEU2HI,
  563. LCDC_LCDCI,
  564. TMU1_TUNI0,TMU1_TUNI1,TMU1_TUNI2,
  565. /* interrupt groups */
  566. DMAC1A, DMAC0A, VIO, DMAC0B, FLCTL, I2C, _2DG,
  567. SDHI1, RTC, DMAC1B, SDHI0,
  568. };
  569. static struct intc_vect vectors[] __initdata = {
  570. INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
  571. INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
  572. INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
  573. INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
  574. INTC_VECT(DMAC1A_DEI0,0x700),
  575. INTC_VECT(DMAC1A_DEI1,0x720),
  576. INTC_VECT(DMAC1A_DEI2,0x740),
  577. INTC_VECT(DMAC1A_DEI3,0x760),
  578. INTC_VECT(_2DG_TRI, 0x780),
  579. INTC_VECT(_2DG_INI, 0x7A0),
  580. INTC_VECT(_2DG_CEI, 0x7C0),
  581. INTC_VECT(DMAC0A_DEI0,0x800),
  582. INTC_VECT(DMAC0A_DEI1,0x820),
  583. INTC_VECT(DMAC0A_DEI2,0x840),
  584. INTC_VECT(DMAC0A_DEI3,0x860),
  585. INTC_VECT(VIO_CEUI,0x880),
  586. INTC_VECT(VIO_BEUI,0x8A0),
  587. INTC_VECT(VIO_VEU2HI,0x8C0),
  588. INTC_VECT(VIO_VOUI,0x8E0),
  589. INTC_VECT(SCIFA_SCIFA0,0x900),
  590. INTC_VECT(VPU_VPUI,0x980),
  591. INTC_VECT(TPU_TPUI,0x9A0),
  592. INTC_VECT(ADC_ADI,0x9E0),
  593. INTC_VECT(USB_USI0,0xA20),
  594. INTC_VECT(RTC_ATI,0xA80),
  595. INTC_VECT(RTC_PRI,0xAA0),
  596. INTC_VECT(RTC_CUI,0xAC0),
  597. INTC_VECT(DMAC1B_DEI4,0xB00),
  598. INTC_VECT(DMAC1B_DEI5,0xB20),
  599. INTC_VECT(DMAC1B_DADERR,0xB40),
  600. INTC_VECT(DMAC0B_DEI4,0xB80),
  601. INTC_VECT(DMAC0B_DEI5,0xBA0),
  602. INTC_VECT(DMAC0B_DADERR,0xBC0),
  603. INTC_VECT(KEYSC_KEYI,0xBE0),
  604. INTC_VECT(SCIF_SCIF0,0xC00),
  605. INTC_VECT(SCIF_SCIF1,0xC20),
  606. INTC_VECT(SCIF_SCIF2,0xC40),
  607. INTC_VECT(MSIOF_MSIOFI0,0xC80),
  608. INTC_VECT(MSIOF_MSIOFI1,0xCA0),
  609. INTC_VECT(SCIFA_SCIFA1,0xD00),
  610. INTC_VECT(FLCTL_FLSTEI,0xD80),
  611. INTC_VECT(FLCTL_FLTENDI,0xDA0),
  612. INTC_VECT(FLCTL_FLTREQ0I,0xDC0),
  613. INTC_VECT(FLCTL_FLTREQ1I,0xDE0),
  614. INTC_VECT(I2C_ALI,0xE00),
  615. INTC_VECT(I2C_TACKI,0xE20),
  616. INTC_VECT(I2C_WAITI,0xE40),
  617. INTC_VECT(I2C_DTEI,0xE60),
  618. INTC_VECT(SDHI0, 0xE80),
  619. INTC_VECT(SDHI0, 0xEA0),
  620. INTC_VECT(SDHI0, 0xEC0),
  621. INTC_VECT(CMT_CMTI,0xF00),
  622. INTC_VECT(TSIF_TSIFI,0xF20),
  623. INTC_VECT(SIU_SIUI,0xF80),
  624. INTC_VECT(SCIFA_SCIFA2,0xFA0),
  625. INTC_VECT(TMU0_TUNI0,0x400),
  626. INTC_VECT(TMU0_TUNI1,0x420),
  627. INTC_VECT(TMU0_TUNI2,0x440),
  628. INTC_VECT(IRDA_IRDAI,0x480),
  629. INTC_VECT(ATAPI_ATAPII,0x4A0),
  630. INTC_VECT(SDHI1, 0x4E0),
  631. INTC_VECT(SDHI1, 0x500),
  632. INTC_VECT(SDHI1, 0x520),
  633. INTC_VECT(VEU2H1_VEU2HI,0x560),
  634. INTC_VECT(LCDC_LCDCI,0x580),
  635. INTC_VECT(TMU1_TUNI0,0x920),
  636. INTC_VECT(TMU1_TUNI1,0x940),
  637. INTC_VECT(TMU1_TUNI2,0x960),
  638. };
  639. static struct intc_group groups[] __initdata = {
  640. INTC_GROUP(DMAC1A,DMAC1A_DEI0,DMAC1A_DEI1,DMAC1A_DEI2,DMAC1A_DEI3),
  641. INTC_GROUP(DMAC0A,DMAC0A_DEI0,DMAC0A_DEI1,DMAC0A_DEI2,DMAC0A_DEI3),
  642. INTC_GROUP(VIO, VIO_CEUI,VIO_BEUI,VIO_VEU2HI,VIO_VOUI),
  643. INTC_GROUP(DMAC0B, DMAC0B_DEI4,DMAC0B_DEI5,DMAC0B_DADERR),
  644. INTC_GROUP(FLCTL,FLCTL_FLSTEI,FLCTL_FLTENDI,FLCTL_FLTREQ0I,FLCTL_FLTREQ1I),
  645. INTC_GROUP(I2C,I2C_ALI,I2C_TACKI,I2C_WAITI,I2C_DTEI),
  646. INTC_GROUP(_2DG, _2DG_TRI,_2DG_INI,_2DG_CEI),
  647. INTC_GROUP(RTC, RTC_ATI,RTC_PRI,RTC_CUI),
  648. INTC_GROUP(DMAC1B, DMAC1B_DEI4,DMAC1B_DEI5,DMAC1B_DADERR),
  649. };
  650. static struct intc_mask_reg mask_registers[] __initdata = {
  651. { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
  652. { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
  653. 0, ENABLED, ENABLED, ENABLED } },
  654. { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
  655. { VIO_VOUI, VIO_VEU2HI,VIO_BEUI,VIO_CEUI,DMAC0A_DEI3,DMAC0A_DEI2,DMAC0A_DEI1,DMAC0A_DEI0 } },
  656. { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
  657. { 0, 0, 0, VPU_VPUI,0,0,0,SCIFA_SCIFA0 } },
  658. { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
  659. { DMAC1A_DEI3,DMAC1A_DEI2,DMAC1A_DEI1,DMAC1A_DEI0,0,0,0,IRDA_IRDAI } },
  660. { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
  661. { 0,TMU0_TUNI2,TMU0_TUNI1,TMU0_TUNI0,VEU2H1_VEU2HI,0,0,LCDC_LCDCI } },
  662. { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
  663. { KEYSC_KEYI,DMAC0B_DADERR,DMAC0B_DEI5,DMAC0B_DEI4,0,SCIF_SCIF2,SCIF_SCIF1,SCIF_SCIF0 } },
  664. { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
  665. { 0,0,0,SCIFA_SCIFA1,ADC_ADI,0,MSIOF_MSIOFI1,MSIOF_MSIOFI0 } },
  666. { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
  667. { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
  668. FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
  669. { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
  670. { 0, ENABLED, ENABLED, ENABLED,
  671. 0, 0, SCIFA_SCIFA2, SIU_SIUI } },
  672. { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
  673. { 0, 0, 0, CMT_CMTI, 0, 0, USB_USI0,0 } },
  674. { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
  675. { 0, DMAC1B_DADERR,DMAC1B_DEI5,DMAC1B_DEI4,0,RTC_ATI,RTC_PRI,RTC_CUI } },
  676. { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
  677. { 0,_2DG_CEI,_2DG_INI,_2DG_TRI,0,TPU_TPUI,0,TSIF_TSIFI } },
  678. { 0xa40800b0, 0xa40800f0, 8, /* IMR12 / IMCR12 */
  679. { 0,0,0,0,0,0,0,ATAPI_ATAPII } },
  680. { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
  681. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  682. };
  683. static struct intc_prio_reg prio_registers[] __initdata = {
  684. { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2, IRDA_IRDAI } },
  685. { 0xa4080004, 0, 16, 4, /* IPRB */ { VEU2H1_VEU2HI, LCDC_LCDCI, DMAC1A, 0} },
  686. { 0xa4080008, 0, 16, 4, /* IPRC */ { TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2, 0} },
  687. { 0xa408000c, 0, 16, 4, /* IPRD */ { } },
  688. { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0A, VIO, SCIFA_SCIFA0, VPU_VPUI } },
  689. { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC_KEYI, DMAC0B, USB_USI0, CMT_CMTI } },
  690. { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF_SCIF0, SCIF_SCIF1, SCIF_SCIF2,0 } },
  691. { 0xa408001c, 0, 16, 4, /* IPRH */ { MSIOF_MSIOFI0,MSIOF_MSIOFI1, FLCTL, I2C } },
  692. { 0xa4080020, 0, 16, 4, /* IPRI */ { SCIFA_SCIFA1,0,TSIF_TSIFI,_2DG } },
  693. { 0xa4080024, 0, 16, 4, /* IPRJ */ { ADC_ADI,0,SIU_SIUI,SDHI1 } },
  694. { 0xa4080028, 0, 16, 4, /* IPRK */ { RTC,DMAC1B,0,SDHI0 } },
  695. { 0xa408002c, 0, 16, 4, /* IPRL */ { SCIFA_SCIFA2,0,TPU_TPUI,ATAPI_ATAPII } },
  696. { 0xa4140010, 0, 32, 4, /* INTPRI00 */
  697. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  698. };
  699. static struct intc_sense_reg sense_registers[] __initdata = {
  700. { 0xa414001c, 16, 2, /* ICR1 */
  701. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  702. };
  703. static struct intc_mask_reg ack_registers[] __initdata = {
  704. { 0xa4140024, 0, 8, /* INTREQ00 */
  705. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  706. };
  707. static struct intc_desc intc_desc __initdata = {
  708. .name = "sh7723",
  709. .force_enable = ENABLED,
  710. .force_disable = DISABLED,
  711. .hw = INTC_HW_DESC(vectors, groups, mask_registers,
  712. prio_registers, sense_registers, ack_registers),
  713. };
  714. void __init plat_irq_setup(void)
  715. {
  716. register_intc_controller(&intc_desc);
  717. }