setup-sh7763.c 15 KB

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