setup-sh7763.c 15 KB

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