setup-sh7780.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. /*
  2. * SH7780 Setup
  3. *
  4. * Copyright (C) 2006 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/io.h>
  14. #include <linux/serial_sci.h>
  15. #include <linux/sh_dma.h>
  16. #include <linux/sh_timer.h>
  17. #include <cpu/dma-register.h>
  18. static struct plat_sci_port scif0_platform_data = {
  19. .mapbase = 0xffe00000,
  20. .flags = UPF_BOOT_AUTOCONF,
  21. .type = PORT_SCIF,
  22. .irqs = { 40, 40, 40, 40 },
  23. };
  24. static struct platform_device scif0_device = {
  25. .name = "sh-sci",
  26. .id = 0,
  27. .dev = {
  28. .platform_data = &scif0_platform_data,
  29. },
  30. };
  31. static struct plat_sci_port scif1_platform_data = {
  32. .mapbase = 0xffe10000,
  33. .flags = UPF_BOOT_AUTOCONF,
  34. .type = PORT_SCIF,
  35. .irqs = { 76, 76, 76, 76 },
  36. };
  37. static struct platform_device scif1_device = {
  38. .name = "sh-sci",
  39. .id = 1,
  40. .dev = {
  41. .platform_data = &scif1_platform_data,
  42. },
  43. };
  44. static struct sh_timer_config tmu0_platform_data = {
  45. .channel_offset = 0x04,
  46. .timer_bit = 0,
  47. .clockevent_rating = 200,
  48. };
  49. static struct resource tmu0_resources[] = {
  50. [0] = {
  51. .start = 0xffd80008,
  52. .end = 0xffd80013,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. [1] = {
  56. .start = 28,
  57. .flags = IORESOURCE_IRQ,
  58. },
  59. };
  60. static struct platform_device tmu0_device = {
  61. .name = "sh_tmu",
  62. .id = 0,
  63. .dev = {
  64. .platform_data = &tmu0_platform_data,
  65. },
  66. .resource = tmu0_resources,
  67. .num_resources = ARRAY_SIZE(tmu0_resources),
  68. };
  69. static struct sh_timer_config tmu1_platform_data = {
  70. .channel_offset = 0x10,
  71. .timer_bit = 1,
  72. .clocksource_rating = 200,
  73. };
  74. static struct resource tmu1_resources[] = {
  75. [0] = {
  76. .start = 0xffd80014,
  77. .end = 0xffd8001f,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .start = 29,
  82. .flags = IORESOURCE_IRQ,
  83. },
  84. };
  85. static struct platform_device tmu1_device = {
  86. .name = "sh_tmu",
  87. .id = 1,
  88. .dev = {
  89. .platform_data = &tmu1_platform_data,
  90. },
  91. .resource = tmu1_resources,
  92. .num_resources = ARRAY_SIZE(tmu1_resources),
  93. };
  94. static struct sh_timer_config tmu2_platform_data = {
  95. .channel_offset = 0x1c,
  96. .timer_bit = 2,
  97. };
  98. static struct resource tmu2_resources[] = {
  99. [0] = {
  100. .start = 0xffd80020,
  101. .end = 0xffd8002f,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. [1] = {
  105. .start = 30,
  106. .flags = IORESOURCE_IRQ,
  107. },
  108. };
  109. static struct platform_device tmu2_device = {
  110. .name = "sh_tmu",
  111. .id = 2,
  112. .dev = {
  113. .platform_data = &tmu2_platform_data,
  114. },
  115. .resource = tmu2_resources,
  116. .num_resources = ARRAY_SIZE(tmu2_resources),
  117. };
  118. static struct sh_timer_config tmu3_platform_data = {
  119. .channel_offset = 0x04,
  120. .timer_bit = 0,
  121. };
  122. static struct resource tmu3_resources[] = {
  123. [0] = {
  124. .start = 0xffdc0008,
  125. .end = 0xffdc0013,
  126. .flags = IORESOURCE_MEM,
  127. },
  128. [1] = {
  129. .start = 96,
  130. .flags = IORESOURCE_IRQ,
  131. },
  132. };
  133. static struct platform_device tmu3_device = {
  134. .name = "sh_tmu",
  135. .id = 3,
  136. .dev = {
  137. .platform_data = &tmu3_platform_data,
  138. },
  139. .resource = tmu3_resources,
  140. .num_resources = ARRAY_SIZE(tmu3_resources),
  141. };
  142. static struct sh_timer_config tmu4_platform_data = {
  143. .channel_offset = 0x10,
  144. .timer_bit = 1,
  145. };
  146. static struct resource tmu4_resources[] = {
  147. [0] = {
  148. .start = 0xffdc0014,
  149. .end = 0xffdc001f,
  150. .flags = IORESOURCE_MEM,
  151. },
  152. [1] = {
  153. .start = 97,
  154. .flags = IORESOURCE_IRQ,
  155. },
  156. };
  157. static struct platform_device tmu4_device = {
  158. .name = "sh_tmu",
  159. .id = 4,
  160. .dev = {
  161. .platform_data = &tmu4_platform_data,
  162. },
  163. .resource = tmu4_resources,
  164. .num_resources = ARRAY_SIZE(tmu4_resources),
  165. };
  166. static struct sh_timer_config tmu5_platform_data = {
  167. .channel_offset = 0x1c,
  168. .timer_bit = 2,
  169. };
  170. static struct resource tmu5_resources[] = {
  171. [0] = {
  172. .start = 0xffdc0020,
  173. .end = 0xffdc002b,
  174. .flags = IORESOURCE_MEM,
  175. },
  176. [1] = {
  177. .start = 98,
  178. .flags = IORESOURCE_IRQ,
  179. },
  180. };
  181. static struct platform_device tmu5_device = {
  182. .name = "sh_tmu",
  183. .id = 5,
  184. .dev = {
  185. .platform_data = &tmu5_platform_data,
  186. },
  187. .resource = tmu5_resources,
  188. .num_resources = ARRAY_SIZE(tmu5_resources),
  189. };
  190. static struct resource rtc_resources[] = {
  191. [0] = {
  192. .start = 0xffe80000,
  193. .end = 0xffe80000 + 0x58 - 1,
  194. .flags = IORESOURCE_IO,
  195. },
  196. [1] = {
  197. /* Shared Period/Carry/Alarm IRQ */
  198. .start = 20,
  199. .flags = IORESOURCE_IRQ,
  200. },
  201. };
  202. static struct platform_device rtc_device = {
  203. .name = "sh-rtc",
  204. .id = -1,
  205. .num_resources = ARRAY_SIZE(rtc_resources),
  206. .resource = rtc_resources,
  207. };
  208. /* DMA */
  209. static const struct sh_dmae_channel sh7780_dmae0_channels[] = {
  210. {
  211. .offset = 0,
  212. .dmars = 0,
  213. .dmars_bit = 0,
  214. }, {
  215. .offset = 0x10,
  216. .dmars = 0,
  217. .dmars_bit = 8,
  218. }, {
  219. .offset = 0x20,
  220. .dmars = 4,
  221. .dmars_bit = 0,
  222. }, {
  223. .offset = 0x30,
  224. .dmars = 4,
  225. .dmars_bit = 8,
  226. }, {
  227. .offset = 0x50,
  228. .dmars = 8,
  229. .dmars_bit = 0,
  230. }, {
  231. .offset = 0x60,
  232. .dmars = 8,
  233. .dmars_bit = 8,
  234. }
  235. };
  236. static const struct sh_dmae_channel sh7780_dmae1_channels[] = {
  237. {
  238. .offset = 0,
  239. }, {
  240. .offset = 0x10,
  241. }, {
  242. .offset = 0x20,
  243. }, {
  244. .offset = 0x30,
  245. }, {
  246. .offset = 0x50,
  247. }, {
  248. .offset = 0x60,
  249. }
  250. };
  251. static const unsigned int ts_shift[] = TS_SHIFT;
  252. static struct sh_dmae_pdata dma0_platform_data = {
  253. .channel = sh7780_dmae0_channels,
  254. .channel_num = ARRAY_SIZE(sh7780_dmae0_channels),
  255. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  256. .ts_low_mask = CHCR_TS_LOW_MASK,
  257. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  258. .ts_high_mask = CHCR_TS_HIGH_MASK,
  259. .ts_shift = ts_shift,
  260. .ts_shift_num = ARRAY_SIZE(ts_shift),
  261. .dmaor_init = DMAOR_INIT,
  262. };
  263. static struct sh_dmae_pdata dma1_platform_data = {
  264. .channel = sh7780_dmae1_channels,
  265. .channel_num = ARRAY_SIZE(sh7780_dmae1_channels),
  266. .ts_low_shift = CHCR_TS_LOW_SHIFT,
  267. .ts_low_mask = CHCR_TS_LOW_MASK,
  268. .ts_high_shift = CHCR_TS_HIGH_SHIFT,
  269. .ts_high_mask = CHCR_TS_HIGH_MASK,
  270. .ts_shift = ts_shift,
  271. .ts_shift_num = ARRAY_SIZE(ts_shift),
  272. .dmaor_init = DMAOR_INIT,
  273. };
  274. static struct resource sh7780_dmae0_resources[] = {
  275. [0] = {
  276. /* Channel registers and DMAOR */
  277. .start = 0xfc808020,
  278. .end = 0xfc80808f,
  279. .flags = IORESOURCE_MEM,
  280. },
  281. [1] = {
  282. /* DMARSx */
  283. .start = 0xfc809000,
  284. .end = 0xfc80900b,
  285. .flags = IORESOURCE_MEM,
  286. },
  287. {
  288. /* Real DMA error IRQ is 38, and channel IRQs are 34-37, 44-45 */
  289. .start = 34,
  290. .end = 34,
  291. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  292. },
  293. };
  294. static struct resource sh7780_dmae1_resources[] = {
  295. [0] = {
  296. /* Channel registers and DMAOR */
  297. .start = 0xfc818020,
  298. .end = 0xfc81808f,
  299. .flags = IORESOURCE_MEM,
  300. },
  301. /* DMAC1 has no DMARS */
  302. {
  303. /* Real DMA error IRQ is 38, and channel IRQs are 46-47, 92-95 */
  304. .start = 46,
  305. .end = 46,
  306. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
  307. },
  308. };
  309. static struct platform_device dma0_device = {
  310. .name = "sh-dma-engine",
  311. .id = 0,
  312. .resource = sh7780_dmae0_resources,
  313. .num_resources = ARRAY_SIZE(sh7780_dmae0_resources),
  314. .dev = {
  315. .platform_data = &dma0_platform_data,
  316. },
  317. };
  318. static struct platform_device dma1_device = {
  319. .name = "sh-dma-engine",
  320. .id = 1,
  321. .resource = sh7780_dmae1_resources,
  322. .num_resources = ARRAY_SIZE(sh7780_dmae1_resources),
  323. .dev = {
  324. .platform_data = &dma1_platform_data,
  325. },
  326. };
  327. static struct platform_device *sh7780_devices[] __initdata = {
  328. &scif0_device,
  329. &scif1_device,
  330. &tmu0_device,
  331. &tmu1_device,
  332. &tmu2_device,
  333. &tmu3_device,
  334. &tmu4_device,
  335. &tmu5_device,
  336. &rtc_device,
  337. &dma0_device,
  338. &dma1_device,
  339. };
  340. static int __init sh7780_devices_setup(void)
  341. {
  342. return platform_add_devices(sh7780_devices,
  343. ARRAY_SIZE(sh7780_devices));
  344. }
  345. arch_initcall(sh7780_devices_setup);
  346. static struct platform_device *sh7780_early_devices[] __initdata = {
  347. &scif0_device,
  348. &scif1_device,
  349. &tmu0_device,
  350. &tmu1_device,
  351. &tmu2_device,
  352. &tmu3_device,
  353. &tmu4_device,
  354. &tmu5_device,
  355. };
  356. void __init plat_early_device_setup(void)
  357. {
  358. early_platform_add_devices(sh7780_early_devices,
  359. ARRAY_SIZE(sh7780_early_devices));
  360. }
  361. enum {
  362. UNUSED = 0,
  363. /* interrupt sources */
  364. IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  365. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  366. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  367. IRL_HHLL, IRL_HHLH, IRL_HHHL,
  368. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  369. RTC, WDT, TMU0, TMU1, TMU2, TMU2_TICPI,
  370. HUDI, DMAC0, SCIF0, DMAC1, CMT, HAC,
  371. PCISERR, PCIINTA, PCIINTB, PCIINTC, PCIINTD, PCIC5,
  372. SCIF1, SIOF, HSPI, MMCIF, TMU3, TMU4, TMU5, SSI, FLCTL, GPIO,
  373. /* interrupt groups */
  374. TMU012, TMU345,
  375. };
  376. static struct intc_vect vectors[] __initdata = {
  377. INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),
  378. INTC_VECT(RTC, 0x4c0),
  379. INTC_VECT(WDT, 0x560),
  380. INTC_VECT(TMU0, 0x580), INTC_VECT(TMU1, 0x5a0),
  381. INTC_VECT(TMU2, 0x5c0), INTC_VECT(TMU2_TICPI, 0x5e0),
  382. INTC_VECT(HUDI, 0x600),
  383. INTC_VECT(DMAC0, 0x640), INTC_VECT(DMAC0, 0x660),
  384. INTC_VECT(DMAC0, 0x680), INTC_VECT(DMAC0, 0x6a0),
  385. INTC_VECT(DMAC0, 0x6c0),
  386. INTC_VECT(SCIF0, 0x700), INTC_VECT(SCIF0, 0x720),
  387. INTC_VECT(SCIF0, 0x740), INTC_VECT(SCIF0, 0x760),
  388. INTC_VECT(DMAC0, 0x780), INTC_VECT(DMAC0, 0x7a0),
  389. INTC_VECT(DMAC1, 0x7c0), INTC_VECT(DMAC1, 0x7e0),
  390. INTC_VECT(CMT, 0x900), INTC_VECT(HAC, 0x980),
  391. INTC_VECT(PCISERR, 0xa00), INTC_VECT(PCIINTA, 0xa20),
  392. INTC_VECT(PCIINTB, 0xa40), INTC_VECT(PCIINTC, 0xa60),
  393. INTC_VECT(PCIINTD, 0xa80), INTC_VECT(PCIC5, 0xaa0),
  394. INTC_VECT(PCIC5, 0xac0), INTC_VECT(PCIC5, 0xae0),
  395. INTC_VECT(PCIC5, 0xb00), INTC_VECT(PCIC5, 0xb20),
  396. INTC_VECT(SCIF1, 0xb80), INTC_VECT(SCIF1, 0xba0),
  397. INTC_VECT(SCIF1, 0xbc0), INTC_VECT(SCIF1, 0xbe0),
  398. INTC_VECT(SIOF, 0xc00), INTC_VECT(HSPI, 0xc80),
  399. INTC_VECT(MMCIF, 0xd00), INTC_VECT(MMCIF, 0xd20),
  400. INTC_VECT(MMCIF, 0xd40), INTC_VECT(MMCIF, 0xd60),
  401. INTC_VECT(DMAC1, 0xd80), INTC_VECT(DMAC1, 0xda0),
  402. INTC_VECT(DMAC1, 0xdc0), INTC_VECT(DMAC1, 0xde0),
  403. INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20),
  404. INTC_VECT(TMU5, 0xe40),
  405. INTC_VECT(SSI, 0xe80),
  406. INTC_VECT(FLCTL, 0xf00), INTC_VECT(FLCTL, 0xf20),
  407. INTC_VECT(FLCTL, 0xf40), INTC_VECT(FLCTL, 0xf60),
  408. INTC_VECT(GPIO, 0xf80), INTC_VECT(GPIO, 0xfa0),
  409. INTC_VECT(GPIO, 0xfc0), INTC_VECT(GPIO, 0xfe0),
  410. };
  411. static struct intc_group groups[] __initdata = {
  412. INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI),
  413. INTC_GROUP(TMU345, TMU3, TMU4, TMU5),
  414. };
  415. static struct intc_mask_reg mask_registers[] __initdata = {
  416. { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
  417. { 0, 0, 0, 0, 0, 0, GPIO, FLCTL,
  418. SSI, MMCIF, HSPI, SIOF, PCIC5, PCIINTD, PCIINTC, PCIINTB,
  419. PCIINTA, PCISERR, HAC, CMT, 0, 0, DMAC1, DMAC0,
  420. HUDI, 0, WDT, SCIF1, SCIF0, RTC, TMU345, TMU012 } },
  421. };
  422. static struct intc_prio_reg prio_registers[] __initdata = {
  423. { 0xffd40000, 0, 32, 8, /* INT2PRI0 */ { TMU0, TMU1,
  424. TMU2, TMU2_TICPI } },
  425. { 0xffd40004, 0, 32, 8, /* INT2PRI1 */ { TMU3, TMU4, TMU5, RTC } },
  426. { 0xffd40008, 0, 32, 8, /* INT2PRI2 */ { SCIF0, SCIF1, WDT } },
  427. { 0xffd4000c, 0, 32, 8, /* INT2PRI3 */ { HUDI, DMAC0, DMAC1 } },
  428. { 0xffd40010, 0, 32, 8, /* INT2PRI4 */ { CMT, HAC,
  429. PCISERR, PCIINTA, } },
  430. { 0xffd40014, 0, 32, 8, /* INT2PRI5 */ { PCIINTB, PCIINTC,
  431. PCIINTD, PCIC5 } },
  432. { 0xffd40018, 0, 32, 8, /* INT2PRI6 */ { SIOF, HSPI, MMCIF, SSI } },
  433. { 0xffd4001c, 0, 32, 8, /* INT2PRI7 */ { FLCTL, GPIO } },
  434. };
  435. static DECLARE_INTC_DESC(intc_desc, "sh7780", vectors, groups,
  436. mask_registers, prio_registers, NULL);
  437. /* Support for external interrupt pins in IRQ mode */
  438. static struct intc_vect irq_vectors[] __initdata = {
  439. INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
  440. INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
  441. INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380),
  442. INTC_VECT(IRQ6, 0x3c0), INTC_VECT(IRQ7, 0x200),
  443. };
  444. static struct intc_mask_reg irq_mask_registers[] __initdata = {
  445. { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
  446. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  447. };
  448. static struct intc_prio_reg irq_prio_registers[] __initdata = {
  449. { 0xffd00010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,
  450. IRQ4, IRQ5, IRQ6, IRQ7 } },
  451. };
  452. static struct intc_sense_reg irq_sense_registers[] __initdata = {
  453. { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
  454. IRQ4, IRQ5, IRQ6, IRQ7 } },
  455. };
  456. static struct intc_mask_reg irq_ack_registers[] __initdata = {
  457. { 0xffd00024, 0, 32, /* INTREQ */
  458. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  459. };
  460. static DECLARE_INTC_DESC_ACK(intc_irq_desc, "sh7780-irq", irq_vectors,
  461. NULL, irq_mask_registers, irq_prio_registers,
  462. irq_sense_registers, irq_ack_registers);
  463. /* External interrupt pins in IRL mode */
  464. static struct intc_vect irl_vectors[] __initdata = {
  465. INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220),
  466. INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260),
  467. INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0),
  468. INTC_VECT(IRL_LHHL, 0x2c0), INTC_VECT(IRL_LHHH, 0x2e0),
  469. INTC_VECT(IRL_HLLL, 0x300), INTC_VECT(IRL_HLLH, 0x320),
  470. INTC_VECT(IRL_HLHL, 0x340), INTC_VECT(IRL_HLHH, 0x360),
  471. INTC_VECT(IRL_HHLL, 0x380), INTC_VECT(IRL_HHLH, 0x3a0),
  472. INTC_VECT(IRL_HHHL, 0x3c0),
  473. };
  474. static struct intc_mask_reg irl3210_mask_registers[] __initdata = {
  475. { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
  476. { IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  477. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  478. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  479. IRL_HHLL, IRL_HHLH, IRL_HHHL, } },
  480. };
  481. static struct intc_mask_reg irl7654_mask_registers[] __initdata = {
  482. { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
  483. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  484. IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  485. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  486. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  487. IRL_HHLL, IRL_HHLH, IRL_HHHL, } },
  488. };
  489. static DECLARE_INTC_DESC(intc_irl7654_desc, "sh7780-irl7654", irl_vectors,
  490. NULL, irl7654_mask_registers, NULL, NULL);
  491. static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7780-irl3210", irl_vectors,
  492. NULL, irl3210_mask_registers, NULL, NULL);
  493. #define INTC_ICR0 0xffd00000
  494. #define INTC_INTMSK0 0xffd00044
  495. #define INTC_INTMSK1 0xffd00048
  496. #define INTC_INTMSK2 0xffd40080
  497. #define INTC_INTMSKCLR1 0xffd00068
  498. #define INTC_INTMSKCLR2 0xffd40084
  499. void __init plat_irq_setup(void)
  500. {
  501. /* disable IRQ7-0 */
  502. __raw_writel(0xff000000, INTC_INTMSK0);
  503. /* disable IRL3-0 + IRL7-4 */
  504. __raw_writel(0xc0000000, INTC_INTMSK1);
  505. __raw_writel(0xfffefffe, INTC_INTMSK2);
  506. /* select IRL mode for IRL3-0 + IRL7-4 */
  507. __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
  508. /* disable holding function, ie enable "SH-4 Mode" */
  509. __raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);
  510. register_intc_controller(&intc_desc);
  511. }
  512. void __init plat_irq_setup_pins(int mode)
  513. {
  514. switch (mode) {
  515. case IRQ_MODE_IRQ:
  516. /* select IRQ mode for IRL3-0 + IRL7-4 */
  517. __raw_writel(__raw_readl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
  518. register_intc_controller(&intc_irq_desc);
  519. break;
  520. case IRQ_MODE_IRL7654:
  521. /* enable IRL7-4 but don't provide any masking */
  522. __raw_writel(0x40000000, INTC_INTMSKCLR1);
  523. __raw_writel(0x0000fffe, INTC_INTMSKCLR2);
  524. break;
  525. case IRQ_MODE_IRL3210:
  526. /* enable IRL0-3 but don't provide any masking */
  527. __raw_writel(0x80000000, INTC_INTMSKCLR1);
  528. __raw_writel(0xfffe0000, INTC_INTMSKCLR2);
  529. break;
  530. case IRQ_MODE_IRL7654_MASK:
  531. /* enable IRL7-4 and mask using cpu intc controller */
  532. __raw_writel(0x40000000, INTC_INTMSKCLR1);
  533. register_intc_controller(&intc_irl7654_desc);
  534. break;
  535. case IRQ_MODE_IRL3210_MASK:
  536. /* enable IRL0-3 and mask using cpu intc controller */
  537. __raw_writel(0x80000000, INTC_INTMSKCLR1);
  538. register_intc_controller(&intc_irl3210_desc);
  539. break;
  540. default:
  541. BUG();
  542. }
  543. }