setup-sh7734.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /*
  2. * arch/sh/kernel/cpu/sh4a/setup-sh7734.c
  3. * SH7734 Setup
  4. *
  5. * Copyright (C) 2011,2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  6. * Copyright (C) 2011,2012 Renesas Solutions Corp.
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/platform_device.h>
  13. #include <linux/init.h>
  14. #include <linux/serial.h>
  15. #include <linux/mm.h>
  16. #include <linux/dma-mapping.h>
  17. #include <linux/serial_sci.h>
  18. #include <linux/sh_timer.h>
  19. #include <linux/io.h>
  20. #include <asm/clock.h>
  21. #include <asm/irq.h>
  22. #include <cpu/sh7734.h>
  23. /* SCIF */
  24. static struct plat_sci_port scif0_platform_data = {
  25. .flags = UPF_BOOT_AUTOCONF,
  26. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  27. .type = PORT_SCIF,
  28. .regtype = SCIx_SH4_SCIF_REGTYPE,
  29. };
  30. static struct resource scif0_resources[] = {
  31. DEFINE_RES_MEM(0xffe40000, 0x100),
  32. DEFINE_RES_IRQ(evt2irq(0x8c0)),
  33. };
  34. static struct platform_device scif0_device = {
  35. .name = "sh-sci",
  36. .id = 0,
  37. .resource = scif0_resources,
  38. .num_resources = ARRAY_SIZE(scif0_resources),
  39. .dev = {
  40. .platform_data = &scif0_platform_data,
  41. },
  42. };
  43. static struct plat_sci_port scif1_platform_data = {
  44. .flags = UPF_BOOT_AUTOCONF,
  45. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  46. .type = PORT_SCIF,
  47. .regtype = SCIx_SH4_SCIF_REGTYPE,
  48. };
  49. static struct resource scif1_resources[] = {
  50. DEFINE_RES_MEM(0xffe41000, 0x100),
  51. DEFINE_RES_IRQ(evt2irq(0x8e0)),
  52. };
  53. static struct platform_device scif1_device = {
  54. .name = "sh-sci",
  55. .id = 1,
  56. .resource = scif1_resources,
  57. .num_resources = ARRAY_SIZE(scif1_resources),
  58. .dev = {
  59. .platform_data = &scif1_platform_data,
  60. },
  61. };
  62. static struct plat_sci_port scif2_platform_data = {
  63. .flags = UPF_BOOT_AUTOCONF,
  64. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  65. .type = PORT_SCIF,
  66. .regtype = SCIx_SH4_SCIF_REGTYPE,
  67. };
  68. static struct resource scif2_resources[] = {
  69. DEFINE_RES_MEM(0xffe42000, 0x100),
  70. DEFINE_RES_IRQ(evt2irq(0x900)),
  71. };
  72. static struct platform_device scif2_device = {
  73. .name = "sh-sci",
  74. .id = 2,
  75. .resource = scif2_resources,
  76. .num_resources = ARRAY_SIZE(scif2_resources),
  77. .dev = {
  78. .platform_data = &scif2_platform_data,
  79. },
  80. };
  81. static struct plat_sci_port scif3_platform_data = {
  82. .flags = UPF_BOOT_AUTOCONF,
  83. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
  84. .type = PORT_SCIF,
  85. .regtype = SCIx_SH4_SCIF_REGTYPE,
  86. };
  87. static struct resource scif3_resources[] = {
  88. DEFINE_RES_MEM(0xffe43000, 0x100),
  89. DEFINE_RES_IRQ(evt2irq(0x920)),
  90. };
  91. static struct platform_device scif3_device = {
  92. .name = "sh-sci",
  93. .id = 3,
  94. .resource = scif3_resources,
  95. .num_resources = ARRAY_SIZE(scif3_resources),
  96. .dev = {
  97. .platform_data = &scif3_platform_data,
  98. },
  99. };
  100. static struct plat_sci_port scif4_platform_data = {
  101. .flags = UPF_BOOT_AUTOCONF,
  102. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  103. .type = PORT_SCIF,
  104. .regtype = SCIx_SH4_SCIF_REGTYPE,
  105. };
  106. static struct resource scif4_resources[] = {
  107. DEFINE_RES_MEM(0xffe44000, 0x100),
  108. DEFINE_RES_IRQ(evt2irq(0x940)),
  109. };
  110. static struct platform_device scif4_device = {
  111. .name = "sh-sci",
  112. .id = 4,
  113. .resource = scif4_resources,
  114. .num_resources = ARRAY_SIZE(scif4_resources),
  115. .dev = {
  116. .platform_data = &scif4_platform_data,
  117. },
  118. };
  119. static struct plat_sci_port scif5_platform_data = {
  120. .flags = UPF_BOOT_AUTOCONF,
  121. .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
  122. .type = PORT_SCIF,
  123. .regtype = SCIx_SH4_SCIF_REGTYPE,
  124. };
  125. static struct resource scif5_resources[] = {
  126. DEFINE_RES_MEM(0xffe43000, 0x100),
  127. DEFINE_RES_IRQ(evt2irq(0x960)),
  128. };
  129. static struct platform_device scif5_device = {
  130. .name = "sh-sci",
  131. .id = 5,
  132. .resource = scif5_resources,
  133. .num_resources = ARRAY_SIZE(scif5_resources),
  134. .dev = {
  135. .platform_data = &scif5_platform_data,
  136. },
  137. };
  138. /* RTC */
  139. static struct resource rtc_resources[] = {
  140. [0] = {
  141. .name = "rtc",
  142. .start = 0xFFFC5000,
  143. .end = 0xFFFC5000 + 0x26 - 1,
  144. .flags = IORESOURCE_IO,
  145. },
  146. [1] = {
  147. .start = evt2irq(0xC00),
  148. .flags = IORESOURCE_IRQ,
  149. },
  150. };
  151. static struct platform_device rtc_device = {
  152. .name = "sh-rtc",
  153. .id = -1,
  154. .num_resources = ARRAY_SIZE(rtc_resources),
  155. .resource = rtc_resources,
  156. };
  157. /* I2C 0 */
  158. static struct resource i2c0_resources[] = {
  159. [0] = {
  160. .name = "IIC0",
  161. .start = 0xFFC70000,
  162. .end = 0xFFC7000A - 1,
  163. .flags = IORESOURCE_MEM,
  164. },
  165. [1] = {
  166. .start = evt2irq(0x860),
  167. .flags = IORESOURCE_IRQ,
  168. },
  169. };
  170. static struct platform_device i2c0_device = {
  171. .name = "i2c-sh7734",
  172. .id = 0,
  173. .num_resources = ARRAY_SIZE(i2c0_resources),
  174. .resource = i2c0_resources,
  175. };
  176. /* TMU */
  177. static struct sh_timer_config tmu0_platform_data = {
  178. .channels_mask = 7,
  179. };
  180. static struct resource tmu0_resources[] = {
  181. DEFINE_RES_MEM(0xffd80000, 0x30),
  182. DEFINE_RES_IRQ(evt2irq(0x400)),
  183. DEFINE_RES_IRQ(evt2irq(0x420)),
  184. DEFINE_RES_IRQ(evt2irq(0x440)),
  185. };
  186. static struct platform_device tmu0_device = {
  187. .name = "sh-tmu",
  188. .id = 0,
  189. .dev = {
  190. .platform_data = &tmu0_platform_data,
  191. },
  192. .resource = tmu0_resources,
  193. .num_resources = ARRAY_SIZE(tmu0_resources),
  194. };
  195. static struct sh_timer_config tmu1_platform_data = {
  196. .channels_mask = 7,
  197. };
  198. static struct resource tmu1_resources[] = {
  199. DEFINE_RES_MEM(0xffd81000, 0x30),
  200. DEFINE_RES_IRQ(evt2irq(0x480)),
  201. DEFINE_RES_IRQ(evt2irq(0x4a0)),
  202. DEFINE_RES_IRQ(evt2irq(0x4c0)),
  203. };
  204. static struct platform_device tmu1_device = {
  205. .name = "sh-tmu",
  206. .id = 1,
  207. .dev = {
  208. .platform_data = &tmu1_platform_data,
  209. },
  210. .resource = tmu1_resources,
  211. .num_resources = ARRAY_SIZE(tmu1_resources),
  212. };
  213. static struct sh_timer_config tmu2_platform_data = {
  214. .channels_mask = 7,
  215. };
  216. static struct resource tmu2_resources[] = {
  217. DEFINE_RES_MEM(0xffd82000, 0x30),
  218. DEFINE_RES_IRQ(evt2irq(0x500)),
  219. DEFINE_RES_IRQ(evt2irq(0x520)),
  220. DEFINE_RES_IRQ(evt2irq(0x540)),
  221. };
  222. static struct platform_device tmu2_device = {
  223. .name = "sh-tmu",
  224. .id = 2,
  225. .dev = {
  226. .platform_data = &tmu2_platform_data,
  227. },
  228. .resource = tmu2_resources,
  229. .num_resources = ARRAY_SIZE(tmu2_resources),
  230. };
  231. static struct platform_device *sh7734_devices[] __initdata = {
  232. &scif0_device,
  233. &scif1_device,
  234. &scif2_device,
  235. &scif3_device,
  236. &scif4_device,
  237. &scif5_device,
  238. &tmu0_device,
  239. &tmu1_device,
  240. &tmu2_device,
  241. &rtc_device,
  242. };
  243. static struct platform_device *sh7734_early_devices[] __initdata = {
  244. &scif0_device,
  245. &scif1_device,
  246. &scif2_device,
  247. &scif3_device,
  248. &scif4_device,
  249. &scif5_device,
  250. &tmu0_device,
  251. &tmu1_device,
  252. &tmu2_device,
  253. };
  254. void __init plat_early_device_setup(void)
  255. {
  256. early_platform_add_devices(sh7734_early_devices,
  257. ARRAY_SIZE(sh7734_early_devices));
  258. }
  259. #define GROUP 0
  260. enum {
  261. UNUSED = 0,
  262. /* interrupt sources */
  263. IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
  264. IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
  265. IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
  266. IRL0_HHLL, IRL0_HHLH, IRL0_HHHL,
  267. IRQ0, IRQ1, IRQ2, IRQ3,
  268. DU,
  269. TMU00, TMU10, TMU20, TMU21,
  270. TMU30, TMU40, TMU50, TMU51,
  271. TMU60, TMU70, TMU80,
  272. RESET_WDT,
  273. USB,
  274. HUDI,
  275. SHDMAC,
  276. SSI0, SSI1, SSI2, SSI3,
  277. VIN0,
  278. RGPVG,
  279. _2DG,
  280. MMC,
  281. HSPI,
  282. LBSCATA,
  283. I2C0,
  284. RCAN0,
  285. MIMLB,
  286. SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5,
  287. LBSCDMAC0, LBSCDMAC1, LBSCDMAC2,
  288. RCAN1,
  289. SDHI0, SDHI1,
  290. IEBUS,
  291. HPBDMAC0_3, HPBDMAC4_10, HPBDMAC11_18, HPBDMAC19_22, HPBDMAC23_25_27_28,
  292. RTC,
  293. VIN1,
  294. LCDC,
  295. SRC0, SRC1,
  296. GETHER,
  297. SDHI2,
  298. GPIO0_3, GPIO4_5,
  299. STIF0, STIF1,
  300. ADMAC,
  301. HIF,
  302. FLCTL,
  303. ADC,
  304. MTU2,
  305. RSPI,
  306. QSPI,
  307. HSCIF,
  308. VEU3F_VE3,
  309. /* Group */
  310. /* Mask */
  311. STIF_M,
  312. GPIO_M,
  313. HPBDMAC_M,
  314. LBSCDMAC_M,
  315. RCAN_M,
  316. SRC_M,
  317. SCIF_M,
  318. LCDC_M,
  319. _2DG_M,
  320. VIN_M,
  321. TMU_3_M,
  322. TMU_0_M,
  323. /* Priority */
  324. RCAN_P,
  325. LBSCDMAC_P,
  326. /* Common */
  327. SDHI,
  328. SSI,
  329. SPI,
  330. };
  331. static struct intc_vect vectors[] __initdata = {
  332. INTC_VECT(DU, 0x3E0),
  333. INTC_VECT(TMU00, 0x400),
  334. INTC_VECT(TMU10, 0x420),
  335. INTC_VECT(TMU20, 0x440),
  336. INTC_VECT(TMU30, 0x480),
  337. INTC_VECT(TMU40, 0x4A0),
  338. INTC_VECT(TMU50, 0x4C0),
  339. INTC_VECT(TMU51, 0x4E0),
  340. INTC_VECT(TMU60, 0x500),
  341. INTC_VECT(TMU70, 0x520),
  342. INTC_VECT(TMU80, 0x540),
  343. INTC_VECT(RESET_WDT, 0x560),
  344. INTC_VECT(USB, 0x580),
  345. INTC_VECT(HUDI, 0x600),
  346. INTC_VECT(SHDMAC, 0x620),
  347. INTC_VECT(SSI0, 0x6C0),
  348. INTC_VECT(SSI1, 0x6E0),
  349. INTC_VECT(SSI2, 0x700),
  350. INTC_VECT(SSI3, 0x720),
  351. INTC_VECT(VIN0, 0x740),
  352. INTC_VECT(RGPVG, 0x760),
  353. INTC_VECT(_2DG, 0x780),
  354. INTC_VECT(MMC, 0x7A0),
  355. INTC_VECT(HSPI, 0x7E0),
  356. INTC_VECT(LBSCATA, 0x840),
  357. INTC_VECT(I2C0, 0x860),
  358. INTC_VECT(RCAN0, 0x880),
  359. INTC_VECT(SCIF0, 0x8A0),
  360. INTC_VECT(SCIF1, 0x8C0),
  361. INTC_VECT(SCIF2, 0x900),
  362. INTC_VECT(SCIF3, 0x920),
  363. INTC_VECT(SCIF4, 0x940),
  364. INTC_VECT(SCIF5, 0x960),
  365. INTC_VECT(LBSCDMAC0, 0x9E0),
  366. INTC_VECT(LBSCDMAC1, 0xA00),
  367. INTC_VECT(LBSCDMAC2, 0xA20),
  368. INTC_VECT(RCAN1, 0xA60),
  369. INTC_VECT(SDHI0, 0xAE0),
  370. INTC_VECT(SDHI1, 0xB00),
  371. INTC_VECT(IEBUS, 0xB20),
  372. INTC_VECT(HPBDMAC0_3, 0xB60),
  373. INTC_VECT(HPBDMAC4_10, 0xB80),
  374. INTC_VECT(HPBDMAC11_18, 0xBA0),
  375. INTC_VECT(HPBDMAC19_22, 0xBC0),
  376. INTC_VECT(HPBDMAC23_25_27_28, 0xBE0),
  377. INTC_VECT(RTC, 0xC00),
  378. INTC_VECT(VIN1, 0xC20),
  379. INTC_VECT(LCDC, 0xC40),
  380. INTC_VECT(SRC0, 0xC60),
  381. INTC_VECT(SRC1, 0xC80),
  382. INTC_VECT(GETHER, 0xCA0),
  383. INTC_VECT(SDHI2, 0xCC0),
  384. INTC_VECT(GPIO0_3, 0xCE0),
  385. INTC_VECT(GPIO4_5, 0xD00),
  386. INTC_VECT(STIF0, 0xD20),
  387. INTC_VECT(STIF1, 0xD40),
  388. INTC_VECT(ADMAC, 0xDA0),
  389. INTC_VECT(HIF, 0xDC0),
  390. INTC_VECT(FLCTL, 0xDE0),
  391. INTC_VECT(ADC, 0xE00),
  392. INTC_VECT(MTU2, 0xE20),
  393. INTC_VECT(RSPI, 0xE40),
  394. INTC_VECT(QSPI, 0xE60),
  395. INTC_VECT(HSCIF, 0xFC0),
  396. INTC_VECT(VEU3F_VE3, 0xF40),
  397. };
  398. static struct intc_group groups[] __initdata = {
  399. /* Common */
  400. INTC_GROUP(SDHI, SDHI0, SDHI1, SDHI2),
  401. INTC_GROUP(SPI, HSPI, RSPI, QSPI),
  402. INTC_GROUP(SSI, SSI0, SSI1, SSI2, SSI3),
  403. /* Mask group */
  404. INTC_GROUP(STIF_M, STIF0, STIF1), /* 22 */
  405. INTC_GROUP(GPIO_M, GPIO0_3, GPIO4_5), /* 21 */
  406. INTC_GROUP(HPBDMAC_M, HPBDMAC0_3, HPBDMAC4_10, HPBDMAC11_18,
  407. HPBDMAC19_22, HPBDMAC23_25_27_28), /* 19 */
  408. INTC_GROUP(LBSCDMAC_M, LBSCDMAC0, LBSCDMAC1, LBSCDMAC2), /* 18 */
  409. INTC_GROUP(RCAN_M, RCAN0, RCAN1, IEBUS), /* 17 */
  410. INTC_GROUP(SRC_M, SRC0, SRC1), /* 16 */
  411. INTC_GROUP(SCIF_M, SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5,
  412. HSCIF), /* 14 */
  413. INTC_GROUP(LCDC_M, LCDC, MIMLB), /* 13 */
  414. INTC_GROUP(_2DG_M, _2DG, RGPVG), /* 12 */
  415. INTC_GROUP(VIN_M, VIN0, VIN1), /* 10 */
  416. INTC_GROUP(TMU_3_M, TMU30, TMU40, TMU50, TMU51,
  417. TMU60, TMU60, TMU70, TMU80), /* 2 */
  418. INTC_GROUP(TMU_0_M, TMU00, TMU10, TMU20, TMU21), /* 1 */
  419. /* Priority group*/
  420. INTC_GROUP(RCAN_P, RCAN0, RCAN1), /* INT2PRI5 */
  421. INTC_GROUP(LBSCDMAC_P, LBSCDMAC0, LBSCDMAC1), /* INT2PRI5 */
  422. };
  423. static struct intc_mask_reg mask_registers[] __initdata = {
  424. { 0xFF804040, 0xFF804044, 32, /* INT2MSKRG / INT2MSKCR */
  425. { 0,
  426. VEU3F_VE3,
  427. SDHI, /* SDHI 0-2 */
  428. ADMAC,
  429. FLCTL,
  430. RESET_WDT,
  431. HIF,
  432. ADC,
  433. MTU2,
  434. STIF_M, /* STIF 0,1 */
  435. GPIO_M, /* GPIO 0-5*/
  436. GETHER,
  437. HPBDMAC_M, /* HPBDMAC 0_3 - 23_25_27_28 */
  438. LBSCDMAC_M, /* LBSCDMAC 0 - 2 */
  439. RCAN_M, /* RCAN, IEBUS */
  440. SRC_M, /* SRC 0,1 */
  441. LBSCATA,
  442. SCIF_M, /* SCIF 0-5, HSCIF */
  443. LCDC_M, /* LCDC, MIMLB */
  444. _2DG_M, /* 2DG, RGPVG */
  445. SPI, /* HSPI, RSPI, QSPI */
  446. VIN_M, /* VIN0, 1 */
  447. SSI, /* SSI 0-3 */
  448. USB,
  449. SHDMAC,
  450. HUDI,
  451. MMC,
  452. RTC,
  453. I2C0, /* I2C */ /* I2C 0, 1*/
  454. TMU_3_M, /* TMU30 - TMU80 */
  455. TMU_0_M, /* TMU00 - TMU21 */
  456. DU } },
  457. };
  458. static struct intc_prio_reg prio_registers[] __initdata = {
  459. { 0xFF804000, 0, 32, 8, /* INT2PRI0 */
  460. { DU, TMU00, TMU10, TMU20 } },
  461. { 0xFF804004, 0, 32, 8, /* INT2PRI1 */
  462. { TMU30, TMU60, RTC, SDHI } },
  463. { 0xFF804008, 0, 32, 8, /* INT2PRI2 */
  464. { HUDI, SHDMAC, USB, SSI } },
  465. { 0xFF80400C, 0, 32, 8, /* INT2PRI3 */
  466. { VIN0, SPI, _2DG, LBSCATA } },
  467. { 0xFF804010, 0, 32, 8, /* INT2PRI4 */
  468. { SCIF0, SCIF3, HSCIF, LCDC } },
  469. { 0xFF804014, 0, 32, 8, /* INT2PRI5 */
  470. { RCAN_P, LBSCDMAC_P, LBSCDMAC2, MMC } },
  471. { 0xFF804018, 0, 32, 8, /* INT2PRI6 */
  472. { HPBDMAC0_3, HPBDMAC4_10, HPBDMAC11_18, HPBDMAC19_22 } },
  473. { 0xFF80401C, 0, 32, 8, /* INT2PRI7 */
  474. { HPBDMAC23_25_27_28, I2C0, SRC0, SRC1 } },
  475. { 0xFF804020, 0, 32, 8, /* INT2PRI8 */
  476. { 0 /* ADIF */, VIN1, RESET_WDT, HIF } },
  477. { 0xFF804024, 0, 32, 8, /* INT2PRI9 */
  478. { ADMAC, FLCTL, GPIO0_3, GPIO4_5 } },
  479. { 0xFF804028, 0, 32, 8, /* INT2PRI10 */
  480. { STIF0, STIF1, VEU3F_VE3, GETHER } },
  481. { 0xFF80402C, 0, 32, 8, /* INT2PRI11 */
  482. { MTU2, RGPVG, MIMLB, IEBUS } },
  483. };
  484. static DECLARE_INTC_DESC(intc_desc, "sh7734", vectors, groups,
  485. mask_registers, prio_registers, NULL);
  486. /* Support for external interrupt pins in IRQ mode */
  487. static struct intc_vect irq3210_vectors[] __initdata = {
  488. INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
  489. INTC_VECT(IRQ2, 0x2C0), INTC_VECT(IRQ3, 0x300),
  490. };
  491. static struct intc_sense_reg irq3210_sense_registers[] __initdata = {
  492. { 0xFF80201C, 32, 2, /* ICR1 */
  493. { IRQ0, IRQ1, IRQ2, IRQ3, } },
  494. };
  495. static struct intc_mask_reg irq3210_ack_registers[] __initdata = {
  496. { 0xFF802024, 0, 32, /* INTREQ */
  497. { IRQ0, IRQ1, IRQ2, IRQ3, } },
  498. };
  499. static struct intc_mask_reg irq3210_mask_registers[] __initdata = {
  500. { 0xFF802044, 0xFF802064, 32, /* INTMSK0 / INTMSKCLR0 */
  501. { IRQ0, IRQ1, IRQ2, IRQ3, } },
  502. };
  503. static struct intc_prio_reg irq3210_prio_registers[] __initdata = {
  504. { 0xFF802010, 0, 32, 4, /* INTPRI */
  505. { IRQ0, IRQ1, IRQ2, IRQ3, } },
  506. };
  507. static DECLARE_INTC_DESC_ACK(intc_desc_irq3210, "sh7734-irq3210",
  508. irq3210_vectors, NULL,
  509. irq3210_mask_registers, irq3210_prio_registers,
  510. irq3210_sense_registers, irq3210_ack_registers);
  511. /* External interrupt pins in IRL mode */
  512. static struct intc_vect vectors_irl3210[] __initdata = {
  513. INTC_VECT(IRL0_LLLL, 0x200), INTC_VECT(IRL0_LLLH, 0x220),
  514. INTC_VECT(IRL0_LLHL, 0x240), INTC_VECT(IRL0_LLHH, 0x260),
  515. INTC_VECT(IRL0_LHLL, 0x280), INTC_VECT(IRL0_LHLH, 0x2a0),
  516. INTC_VECT(IRL0_LHHL, 0x2c0), INTC_VECT(IRL0_LHHH, 0x2e0),
  517. INTC_VECT(IRL0_HLLL, 0x300), INTC_VECT(IRL0_HLLH, 0x320),
  518. INTC_VECT(IRL0_HLHL, 0x340), INTC_VECT(IRL0_HLHH, 0x360),
  519. INTC_VECT(IRL0_HHLL, 0x380), INTC_VECT(IRL0_HHLH, 0x3a0),
  520. INTC_VECT(IRL0_HHHL, 0x3c0),
  521. };
  522. static DECLARE_INTC_DESC(intc_desc_irl3210, "sh7734-irl3210",
  523. vectors_irl3210, NULL, mask_registers, NULL, NULL);
  524. #define INTC_ICR0 0xFF802000
  525. #define INTC_INTMSK0 0xFF802044
  526. #define INTC_INTMSK1 0xFF802048
  527. #define INTC_INTMSKCLR0 0xFF802064
  528. #define INTC_INTMSKCLR1 0xFF802068
  529. void __init plat_irq_setup(void)
  530. {
  531. /* disable IRQ3-0 */
  532. __raw_writel(0xF0000000, INTC_INTMSK0);
  533. /* disable IRL3-0 */
  534. __raw_writel(0x80000000, INTC_INTMSK1);
  535. /* select IRL mode for IRL3-0 */
  536. __raw_writel(__raw_readl(INTC_ICR0) & ~0x00800000, INTC_ICR0);
  537. /* disable holding function, ie enable "SH-4 Mode (LVLMODE)" */
  538. __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
  539. register_intc_controller(&intc_desc);
  540. }
  541. void __init plat_irq_setup_pins(int mode)
  542. {
  543. switch (mode) {
  544. case IRQ_MODE_IRQ3210:
  545. /* select IRQ mode for IRL3-0 */
  546. __raw_writel(__raw_readl(INTC_ICR0) | 0x00800000, INTC_ICR0);
  547. register_intc_controller(&intc_desc_irq3210);
  548. break;
  549. case IRQ_MODE_IRL3210:
  550. /* enable IRL0-3 but don't provide any masking */
  551. __raw_writel(0x80000000, INTC_INTMSKCLR1);
  552. __raw_writel(0xf0000000, INTC_INTMSKCLR0);
  553. break;
  554. case IRQ_MODE_IRL3210_MASK:
  555. /* enable IRL0-3 and mask using cpu intc controller */
  556. __raw_writel(0x80000000, INTC_INTMSKCLR0);
  557. register_intc_controller(&intc_desc_irl3210);
  558. break;
  559. default:
  560. BUG();
  561. }
  562. }