setup-sh7723.c 17 KB

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