setup-sh7763.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /*
  2. * SH7763 Setup
  3. *
  4. * Copyright (C) 2006 Paul Mundt
  5. * Copyright (C) 2007 Yoshihiro Shimoda
  6. * Copyright (C) 2008, 2009 Nobuhiro Iwamatsu
  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/sh_timer.h>
  16. #include <linux/io.h>
  17. #include <linux/serial_sci.h>
  18. static struct resource rtc_resources[] = {
  19. [0] = {
  20. .start = 0xffe80000,
  21. .end = 0xffe80000 + 0x58 - 1,
  22. .flags = IORESOURCE_IO,
  23. },
  24. [1] = {
  25. /* Shared Period/Carry/Alarm IRQ */
  26. .start = 20,
  27. .flags = IORESOURCE_IRQ,
  28. },
  29. };
  30. static struct platform_device rtc_device = {
  31. .name = "sh-rtc",
  32. .id = -1,
  33. .num_resources = ARRAY_SIZE(rtc_resources),
  34. .resource = rtc_resources,
  35. };
  36. static struct plat_sci_port sci_platform_data[] = {
  37. {
  38. .mapbase = 0xffe00000,
  39. .flags = UPF_BOOT_AUTOCONF,
  40. .type = PORT_SCIF,
  41. .irqs = { 40, 40, 40, 40 },
  42. }, {
  43. .mapbase = 0xffe08000,
  44. .flags = UPF_BOOT_AUTOCONF,
  45. .type = PORT_SCIF,
  46. .irqs = { 76, 76, 76, 76 },
  47. }, {
  48. .mapbase = 0xffe10000,
  49. .flags = UPF_BOOT_AUTOCONF,
  50. .type = PORT_SCIF,
  51. .irqs = { 104, 104, 104, 104 },
  52. }, {
  53. .flags = 0,
  54. }
  55. };
  56. static struct platform_device sci_device = {
  57. .name = "sh-sci",
  58. .id = -1,
  59. .dev = {
  60. .platform_data = sci_platform_data,
  61. },
  62. };
  63. static struct resource usb_ohci_resources[] = {
  64. [0] = {
  65. .start = 0xffec8000,
  66. .end = 0xffec80ff,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. .start = 83,
  71. .end = 83,
  72. .flags = IORESOURCE_IRQ,
  73. },
  74. };
  75. static u64 usb_ohci_dma_mask = 0xffffffffUL;
  76. static struct platform_device usb_ohci_device = {
  77. .name = "sh_ohci",
  78. .id = -1,
  79. .dev = {
  80. .dma_mask = &usb_ohci_dma_mask,
  81. .coherent_dma_mask = 0xffffffff,
  82. },
  83. .num_resources = ARRAY_SIZE(usb_ohci_resources),
  84. .resource = usb_ohci_resources,
  85. };
  86. static struct resource usbf_resources[] = {
  87. [0] = {
  88. .start = 0xffec0000,
  89. .end = 0xffec00ff,
  90. .flags = IORESOURCE_MEM,
  91. },
  92. [1] = {
  93. .start = 84,
  94. .end = 84,
  95. .flags = IORESOURCE_IRQ,
  96. },
  97. };
  98. static struct platform_device usbf_device = {
  99. .name = "sh_udc",
  100. .id = -1,
  101. .dev = {
  102. .dma_mask = NULL,
  103. .coherent_dma_mask = 0xffffffff,
  104. },
  105. .num_resources = ARRAY_SIZE(usbf_resources),
  106. .resource = usbf_resources,
  107. };
  108. static struct sh_timer_config tmu0_platform_data = {
  109. .name = "TMU0",
  110. .channel_offset = 0x04,
  111. .timer_bit = 0,
  112. .clk = "peripheral_clk",
  113. .clockevent_rating = 200,
  114. };
  115. static struct resource tmu0_resources[] = {
  116. [0] = {
  117. .name = "TMU0",
  118. .start = 0xffd80008,
  119. .end = 0xffd80013,
  120. .flags = IORESOURCE_MEM,
  121. },
  122. [1] = {
  123. .start = 28,
  124. .flags = IORESOURCE_IRQ,
  125. },
  126. };
  127. static struct platform_device tmu0_device = {
  128. .name = "sh_tmu",
  129. .id = 0,
  130. .dev = {
  131. .platform_data = &tmu0_platform_data,
  132. },
  133. .resource = tmu0_resources,
  134. .num_resources = ARRAY_SIZE(tmu0_resources),
  135. };
  136. static struct sh_timer_config tmu1_platform_data = {
  137. .name = "TMU1",
  138. .channel_offset = 0x10,
  139. .timer_bit = 1,
  140. .clk = "peripheral_clk",
  141. .clocksource_rating = 200,
  142. };
  143. static struct resource tmu1_resources[] = {
  144. [0] = {
  145. .name = "TMU1",
  146. .start = 0xffd80014,
  147. .end = 0xffd8001f,
  148. .flags = IORESOURCE_MEM,
  149. },
  150. [1] = {
  151. .start = 29,
  152. .flags = IORESOURCE_IRQ,
  153. },
  154. };
  155. static struct platform_device tmu1_device = {
  156. .name = "sh_tmu",
  157. .id = 1,
  158. .dev = {
  159. .platform_data = &tmu1_platform_data,
  160. },
  161. .resource = tmu1_resources,
  162. .num_resources = ARRAY_SIZE(tmu1_resources),
  163. };
  164. static struct sh_timer_config tmu2_platform_data = {
  165. .name = "TMU2",
  166. .channel_offset = 0x1c,
  167. .timer_bit = 2,
  168. .clk = "peripheral_clk",
  169. };
  170. static struct resource tmu2_resources[] = {
  171. [0] = {
  172. .name = "TMU2",
  173. .start = 0xffd80020,
  174. .end = 0xffd8002f,
  175. .flags = IORESOURCE_MEM,
  176. },
  177. [1] = {
  178. .start = 30,
  179. .flags = IORESOURCE_IRQ,
  180. },
  181. };
  182. static struct platform_device tmu2_device = {
  183. .name = "sh_tmu",
  184. .id = 2,
  185. .dev = {
  186. .platform_data = &tmu2_platform_data,
  187. },
  188. .resource = tmu2_resources,
  189. .num_resources = ARRAY_SIZE(tmu2_resources),
  190. };
  191. static struct sh_timer_config tmu3_platform_data = {
  192. .name = "TMU3",
  193. .channel_offset = 0x04,
  194. .timer_bit = 0,
  195. .clk = "peripheral_clk",
  196. };
  197. static struct resource tmu3_resources[] = {
  198. [0] = {
  199. .name = "TMU3",
  200. .start = 0xffd88008,
  201. .end = 0xffd88013,
  202. .flags = IORESOURCE_MEM,
  203. },
  204. [1] = {
  205. .start = 96,
  206. .flags = IORESOURCE_IRQ,
  207. },
  208. };
  209. static struct platform_device tmu3_device = {
  210. .name = "sh_tmu",
  211. .id = 3,
  212. .dev = {
  213. .platform_data = &tmu3_platform_data,
  214. },
  215. .resource = tmu3_resources,
  216. .num_resources = ARRAY_SIZE(tmu3_resources),
  217. };
  218. static struct sh_timer_config tmu4_platform_data = {
  219. .name = "TMU4",
  220. .channel_offset = 0x10,
  221. .timer_bit = 1,
  222. .clk = "peripheral_clk",
  223. };
  224. static struct resource tmu4_resources[] = {
  225. [0] = {
  226. .name = "TMU4",
  227. .start = 0xffd88014,
  228. .end = 0xffd8801f,
  229. .flags = IORESOURCE_MEM,
  230. },
  231. [1] = {
  232. .start = 97,
  233. .flags = IORESOURCE_IRQ,
  234. },
  235. };
  236. static struct platform_device tmu4_device = {
  237. .name = "sh_tmu",
  238. .id = 4,
  239. .dev = {
  240. .platform_data = &tmu4_platform_data,
  241. },
  242. .resource = tmu4_resources,
  243. .num_resources = ARRAY_SIZE(tmu4_resources),
  244. };
  245. static struct sh_timer_config tmu5_platform_data = {
  246. .name = "TMU5",
  247. .channel_offset = 0x1c,
  248. .timer_bit = 2,
  249. .clk = "peripheral_clk",
  250. };
  251. static struct resource tmu5_resources[] = {
  252. [0] = {
  253. .name = "TMU5",
  254. .start = 0xffd88020,
  255. .end = 0xffd8802b,
  256. .flags = IORESOURCE_MEM,
  257. },
  258. [1] = {
  259. .start = 98,
  260. .flags = IORESOURCE_IRQ,
  261. },
  262. };
  263. static struct platform_device tmu5_device = {
  264. .name = "sh_tmu",
  265. .id = 5,
  266. .dev = {
  267. .platform_data = &tmu5_platform_data,
  268. },
  269. .resource = tmu5_resources,
  270. .num_resources = ARRAY_SIZE(tmu5_resources),
  271. };
  272. static struct platform_device *sh7763_devices[] __initdata = {
  273. &tmu0_device,
  274. &tmu1_device,
  275. &tmu2_device,
  276. &tmu3_device,
  277. &tmu4_device,
  278. &tmu5_device,
  279. &rtc_device,
  280. &sci_device,
  281. &usb_ohci_device,
  282. &usbf_device,
  283. };
  284. static int __init sh7763_devices_setup(void)
  285. {
  286. return platform_add_devices(sh7763_devices,
  287. ARRAY_SIZE(sh7763_devices));
  288. }
  289. arch_initcall(sh7763_devices_setup);
  290. static struct platform_device *sh7763_early_devices[] __initdata = {
  291. &tmu0_device,
  292. &tmu1_device,
  293. &tmu2_device,
  294. &tmu3_device,
  295. &tmu4_device,
  296. &tmu5_device,
  297. };
  298. void __init plat_early_device_setup(void)
  299. {
  300. early_platform_add_devices(sh7763_early_devices,
  301. ARRAY_SIZE(sh7763_early_devices));
  302. }
  303. enum {
  304. UNUSED = 0,
  305. /* interrupt sources */
  306. IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  307. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  308. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  309. IRL_HHLL, IRL_HHLH, IRL_HHHL,
  310. IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
  311. RTC, WDT, TMU0, TMU1, TMU2, TMU2_TICPI,
  312. HUDI, LCDC, DMAC, SCIF0, IIC0, IIC1, CMT, GETHER, HAC,
  313. PCISERR, PCIINTA, PCIINTB, PCIINTC, PCIINTD, PCIC5,
  314. STIF0, STIF1, SCIF1, SIOF0, SIOF1, SIOF2,
  315. USBH, USBF, TPU, PCC, MMCIF, SIM,
  316. TMU3, TMU4, TMU5, ADC, SSI0, SSI1, SSI2, SSI3,
  317. SCIF2, GPIO,
  318. /* interrupt groups */
  319. TMU012, TMU345,
  320. };
  321. static struct intc_vect vectors[] __initdata = {
  322. INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),
  323. INTC_VECT(RTC, 0x4c0),
  324. INTC_VECT(WDT, 0x560), INTC_VECT(TMU0, 0x580),
  325. INTC_VECT(TMU1, 0x5a0), INTC_VECT(TMU2, 0x5c0),
  326. INTC_VECT(TMU2_TICPI, 0x5e0), INTC_VECT(HUDI, 0x600),
  327. INTC_VECT(LCDC, 0x620),
  328. INTC_VECT(DMAC, 0x640), INTC_VECT(DMAC, 0x660),
  329. INTC_VECT(DMAC, 0x680), INTC_VECT(DMAC, 0x6a0),
  330. INTC_VECT(DMAC, 0x6c0),
  331. INTC_VECT(SCIF0, 0x700), INTC_VECT(SCIF0, 0x720),
  332. INTC_VECT(SCIF0, 0x740), INTC_VECT(SCIF0, 0x760),
  333. INTC_VECT(DMAC, 0x780), INTC_VECT(DMAC, 0x7a0),
  334. INTC_VECT(IIC0, 0x8A0), INTC_VECT(IIC1, 0x8C0),
  335. INTC_VECT(CMT, 0x900), INTC_VECT(GETHER, 0x920),
  336. INTC_VECT(GETHER, 0x940), INTC_VECT(GETHER, 0x960),
  337. INTC_VECT(HAC, 0x980),
  338. INTC_VECT(PCISERR, 0xa00), INTC_VECT(PCIINTA, 0xa20),
  339. INTC_VECT(PCIINTB, 0xa40), INTC_VECT(PCIINTC, 0xa60),
  340. INTC_VECT(PCIINTD, 0xa80), INTC_VECT(PCIC5, 0xaa0),
  341. INTC_VECT(PCIC5, 0xac0), INTC_VECT(PCIC5, 0xae0),
  342. INTC_VECT(PCIC5, 0xb00), INTC_VECT(PCIC5, 0xb20),
  343. INTC_VECT(STIF0, 0xb40), INTC_VECT(STIF1, 0xb60),
  344. INTC_VECT(SCIF1, 0xb80), INTC_VECT(SCIF1, 0xba0),
  345. INTC_VECT(SCIF1, 0xbc0), INTC_VECT(SCIF1, 0xbe0),
  346. INTC_VECT(SIOF0, 0xc00), INTC_VECT(SIOF1, 0xc20),
  347. INTC_VECT(USBH, 0xc60), INTC_VECT(USBF, 0xc80),
  348. INTC_VECT(USBF, 0xca0),
  349. INTC_VECT(TPU, 0xcc0), INTC_VECT(PCC, 0xce0),
  350. INTC_VECT(MMCIF, 0xd00), INTC_VECT(MMCIF, 0xd20),
  351. INTC_VECT(MMCIF, 0xd40), INTC_VECT(MMCIF, 0xd60),
  352. INTC_VECT(SIM, 0xd80), INTC_VECT(SIM, 0xda0),
  353. INTC_VECT(SIM, 0xdc0), INTC_VECT(SIM, 0xde0),
  354. INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20),
  355. INTC_VECT(TMU5, 0xe40), INTC_VECT(ADC, 0xe60),
  356. INTC_VECT(SSI0, 0xe80), INTC_VECT(SSI1, 0xea0),
  357. INTC_VECT(SSI2, 0xec0), INTC_VECT(SSI3, 0xee0),
  358. INTC_VECT(SCIF2, 0xf00), INTC_VECT(SCIF2, 0xf20),
  359. INTC_VECT(SCIF2, 0xf40), INTC_VECT(SCIF2, 0xf60),
  360. INTC_VECT(GPIO, 0xf80), INTC_VECT(GPIO, 0xfa0),
  361. INTC_VECT(GPIO, 0xfc0), INTC_VECT(GPIO, 0xfe0),
  362. };
  363. static struct intc_group groups[] __initdata = {
  364. INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI),
  365. INTC_GROUP(TMU345, TMU3, TMU4, TMU5),
  366. };
  367. static struct intc_mask_reg mask_registers[] __initdata = {
  368. { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
  369. { 0, 0, 0, 0, 0, 0, GPIO, 0,
  370. SSI0, MMCIF, 0, SIOF0, PCIC5, PCIINTD, PCIINTC, PCIINTB,
  371. PCIINTA, PCISERR, HAC, CMT, 0, 0, 0, DMAC,
  372. HUDI, 0, WDT, SCIF1, SCIF0, RTC, TMU345, TMU012 } },
  373. { 0xffd400d0, 0xffd400d4, 32, /* INT2MSKR1 / INT2MSKCR1 */
  374. { 0, 0, 0, 0, 0, 0, SCIF2, USBF,
  375. 0, 0, STIF1, STIF0, 0, 0, USBH, GETHER,
  376. PCC, 0, 0, ADC, TPU, SIM, SIOF2, SIOF1,
  377. LCDC, 0, IIC1, IIC0, SSI3, SSI2, SSI1, 0 } },
  378. };
  379. static struct intc_prio_reg prio_registers[] __initdata = {
  380. { 0xffd40000, 0, 32, 8, /* INT2PRI0 */ { TMU0, TMU1,
  381. TMU2, TMU2_TICPI } },
  382. { 0xffd40004, 0, 32, 8, /* INT2PRI1 */ { TMU3, TMU4, TMU5, RTC } },
  383. { 0xffd40008, 0, 32, 8, /* INT2PRI2 */ { SCIF0, SCIF1, WDT } },
  384. { 0xffd4000c, 0, 32, 8, /* INT2PRI3 */ { HUDI, DMAC, ADC } },
  385. { 0xffd40010, 0, 32, 8, /* INT2PRI4 */ { CMT, HAC,
  386. PCISERR, PCIINTA } },
  387. { 0xffd40014, 0, 32, 8, /* INT2PRI5 */ { PCIINTB, PCIINTC,
  388. PCIINTD, PCIC5 } },
  389. { 0xffd40018, 0, 32, 8, /* INT2PRI6 */ { SIOF0, USBF, MMCIF, SSI0 } },
  390. { 0xffd4001c, 0, 32, 8, /* INT2PRI7 */ { SCIF2, GPIO } },
  391. { 0xffd400a0, 0, 32, 8, /* INT2PRI8 */ { SSI3, SSI2, SSI1, 0 } },
  392. { 0xffd400a4, 0, 32, 8, /* INT2PRI9 */ { LCDC, 0, IIC1, IIC0 } },
  393. { 0xffd400a8, 0, 32, 8, /* INT2PRI10 */ { TPU, SIM, SIOF2, SIOF1 } },
  394. { 0xffd400ac, 0, 32, 8, /* INT2PRI11 */ { PCC } },
  395. { 0xffd400b0, 0, 32, 8, /* INT2PRI12 */ { 0, 0, USBH, GETHER } },
  396. { 0xffd400b4, 0, 32, 8, /* INT2PRI13 */ { 0, 0, STIF1, STIF0 } },
  397. };
  398. static DECLARE_INTC_DESC(intc_desc, "sh7763", vectors, groups,
  399. mask_registers, prio_registers, NULL);
  400. /* Support for external interrupt pins in IRQ mode */
  401. static struct intc_vect irq_vectors[] __initdata = {
  402. INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
  403. INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
  404. INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380),
  405. INTC_VECT(IRQ6, 0x3c0), INTC_VECT(IRQ7, 0x200),
  406. };
  407. static struct intc_mask_reg irq_mask_registers[] __initdata = {
  408. { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
  409. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  410. };
  411. static struct intc_prio_reg irq_prio_registers[] __initdata = {
  412. { 0xffd00010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,
  413. IRQ4, IRQ5, IRQ6, IRQ7 } },
  414. };
  415. static struct intc_sense_reg irq_sense_registers[] __initdata = {
  416. { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
  417. IRQ4, IRQ5, IRQ6, IRQ7 } },
  418. };
  419. static struct intc_mask_reg irq_ack_registers[] __initdata = {
  420. { 0xffd00024, 0, 32, /* INTREQ */
  421. { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
  422. };
  423. static DECLARE_INTC_DESC_ACK(intc_irq_desc, "sh7763-irq", irq_vectors,
  424. NULL, irq_mask_registers, irq_prio_registers,
  425. irq_sense_registers, irq_ack_registers);
  426. /* External interrupt pins in IRL mode */
  427. static struct intc_vect irl_vectors[] __initdata = {
  428. INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220),
  429. INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260),
  430. INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0),
  431. INTC_VECT(IRL_LHHL, 0x2c0), INTC_VECT(IRL_LHHH, 0x2e0),
  432. INTC_VECT(IRL_HLLL, 0x300), INTC_VECT(IRL_HLLH, 0x320),
  433. INTC_VECT(IRL_HLHL, 0x340), INTC_VECT(IRL_HLHH, 0x360),
  434. INTC_VECT(IRL_HHLL, 0x380), INTC_VECT(IRL_HHLH, 0x3a0),
  435. INTC_VECT(IRL_HHHL, 0x3c0),
  436. };
  437. static struct intc_mask_reg irl3210_mask_registers[] __initdata = {
  438. { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
  439. { IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  440. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  441. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  442. IRL_HHLL, IRL_HHLH, IRL_HHHL, } },
  443. };
  444. static struct intc_mask_reg irl7654_mask_registers[] __initdata = {
  445. { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
  446. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  447. IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
  448. IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
  449. IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
  450. IRL_HHLL, IRL_HHLH, IRL_HHHL, } },
  451. };
  452. static DECLARE_INTC_DESC(intc_irl7654_desc, "sh7763-irl7654", irl_vectors,
  453. NULL, irl7654_mask_registers, NULL, NULL);
  454. static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7763-irl3210", irl_vectors,
  455. NULL, irl3210_mask_registers, NULL, NULL);
  456. #define INTC_ICR0 0xffd00000
  457. #define INTC_INTMSK0 0xffd00044
  458. #define INTC_INTMSK1 0xffd00048
  459. #define INTC_INTMSK2 0xffd40080
  460. #define INTC_INTMSKCLR1 0xffd00068
  461. #define INTC_INTMSKCLR2 0xffd40084
  462. void __init plat_irq_setup(void)
  463. {
  464. /* disable IRQ7-0 */
  465. ctrl_outl(0xff000000, INTC_INTMSK0);
  466. /* disable IRL3-0 + IRL7-4 */
  467. ctrl_outl(0xc0000000, INTC_INTMSK1);
  468. ctrl_outl(0xfffefffe, INTC_INTMSK2);
  469. register_intc_controller(&intc_desc);
  470. }
  471. void __init plat_irq_setup_pins(int mode)
  472. {
  473. switch (mode) {
  474. case IRQ_MODE_IRQ:
  475. /* select IRQ mode for IRL3-0 + IRL7-4 */
  476. ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00c00000, INTC_ICR0);
  477. register_intc_controller(&intc_irq_desc);
  478. break;
  479. case IRQ_MODE_IRL7654:
  480. /* enable IRL7-4 but don't provide any masking */
  481. ctrl_outl(0x40000000, INTC_INTMSKCLR1);
  482. ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
  483. break;
  484. case IRQ_MODE_IRL3210:
  485. /* enable IRL0-3 but don't provide any masking */
  486. ctrl_outl(0x80000000, INTC_INTMSKCLR1);
  487. ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
  488. break;
  489. case IRQ_MODE_IRL7654_MASK:
  490. /* enable IRL7-4 and mask using cpu intc controller */
  491. ctrl_outl(0x40000000, INTC_INTMSKCLR1);
  492. register_intc_controller(&intc_irl7654_desc);
  493. break;
  494. case IRQ_MODE_IRL3210_MASK:
  495. /* enable IRL0-3 and mask using cpu intc controller */
  496. ctrl_outl(0x80000000, INTC_INTMSKCLR1);
  497. register_intc_controller(&intc_irl3210_desc);
  498. break;
  499. default:
  500. BUG();
  501. }
  502. }