setup-sh7763.c 15 KB

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