intc-sh7367.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. /*
  2. * sh7367 processor support - INTC hardware block
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/irq.h>
  23. #include <linux/io.h>
  24. #include <linux/sh_intc.h>
  25. #include <mach/intc.h>
  26. #include <mach/irqs.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. enum {
  30. UNUSED_INTCA = 0,
  31. ENABLED,
  32. DISABLED,
  33. /* interrupt sources INTCA */
  34. DIRC,
  35. CRYPT1_ERR, CRYPT2_STD,
  36. IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1,
  37. ARM11_IRQPMU, ARM11_COMMTX, ARM11_COMMRX,
  38. ETM11_ACQCMP, ETM11_FULL,
  39. MFI_MFIM, MFI_MFIS,
  40. BBIF1, BBIF2,
  41. USBDMAC_USHDMI,
  42. USBHS_USHI0, USBHS_USHI1,
  43. CMT1_CMT10, CMT1_CMT11, CMT1_CMT12, CMT1_CMT13, CMT2, CMT3,
  44. KEYSC_KEY,
  45. SCIFA0, SCIFA1, SCIFA2, SCIFA3,
  46. MSIOF2, MSIOF1,
  47. SCIFA4, SCIFA5, SCIFB,
  48. FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
  49. SDHI0,
  50. SDHI1,
  51. MSU_MSU, MSU_MSU2,
  52. IREM,
  53. SIU,
  54. SPU,
  55. IRDA,
  56. TPU0, TPU1, TPU2, TPU3, TPU4,
  57. LCRC,
  58. PINT1, PINT2,
  59. TTI20,
  60. MISTY,
  61. DDM,
  62. SDHI2,
  63. RWDT0, RWDT1,
  64. DMAC_1_DEI0, DMAC_1_DEI1, DMAC_1_DEI2, DMAC_1_DEI3,
  65. DMAC_2_DEI4, DMAC_2_DEI5, DMAC_2_DADERR,
  66. DMAC2_1_DEI0, DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3,
  67. DMAC2_2_DEI4, DMAC2_2_DEI5, DMAC2_2_DADERR,
  68. DMAC3_1_DEI0, DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3,
  69. DMAC3_2_DEI4, DMAC3_2_DEI5, DMAC3_2_DADERR,
  70. /* interrupt groups INTCA */
  71. DMAC_1, DMAC_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2,
  72. ETM11, ARM11, USBHS, FLCTL, IIC1
  73. };
  74. static struct intc_vect intca_vectors[] __initdata = {
  75. INTC_VECT(DIRC, 0x0560),
  76. INTC_VECT(CRYPT1_ERR, 0x05e0),
  77. INTC_VECT(CRYPT2_STD, 0x0700),
  78. INTC_VECT(IIC1_ALI1, 0x0780), INTC_VECT(IIC1_TACKI1, 0x07a0),
  79. INTC_VECT(IIC1_WAITI1, 0x07c0), INTC_VECT(IIC1_DTEI1, 0x07e0),
  80. INTC_VECT(ARM11_IRQPMU, 0x0800), INTC_VECT(ARM11_COMMTX, 0x0840),
  81. INTC_VECT(ARM11_COMMRX, 0x0860),
  82. INTC_VECT(ETM11_ACQCMP, 0x0880), INTC_VECT(ETM11_FULL, 0x08a0),
  83. INTC_VECT(MFI_MFIM, 0x0900), INTC_VECT(MFI_MFIS, 0x0920),
  84. INTC_VECT(BBIF1, 0x0940), INTC_VECT(BBIF2, 0x0960),
  85. INTC_VECT(USBDMAC_USHDMI, 0x0a00),
  86. INTC_VECT(USBHS_USHI0, 0x0a20), INTC_VECT(USBHS_USHI1, 0x0a40),
  87. INTC_VECT(CMT1_CMT10, 0x0b00), INTC_VECT(CMT1_CMT11, 0x0b20),
  88. INTC_VECT(CMT1_CMT12, 0x0b40), INTC_VECT(CMT1_CMT13, 0x0b60),
  89. INTC_VECT(CMT2, 0x0b80), INTC_VECT(CMT3, 0x0ba0),
  90. INTC_VECT(KEYSC_KEY, 0x0be0),
  91. INTC_VECT(SCIFA0, 0x0c00), INTC_VECT(SCIFA1, 0x0c20),
  92. INTC_VECT(SCIFA2, 0x0c40), INTC_VECT(SCIFA3, 0x0c60),
  93. INTC_VECT(MSIOF2, 0x0c80), INTC_VECT(MSIOF1, 0x0d00),
  94. INTC_VECT(SCIFA4, 0x0d20), INTC_VECT(SCIFA5, 0x0d40),
  95. INTC_VECT(SCIFB, 0x0d60),
  96. INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0),
  97. INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0),
  98. INTC_VECT(SDHI0, 0x0e00), INTC_VECT(SDHI0, 0x0e20),
  99. INTC_VECT(SDHI0, 0x0e40), INTC_VECT(SDHI0, 0x0e60),
  100. INTC_VECT(SDHI1, 0x0e80), INTC_VECT(SDHI1, 0x0ea0),
  101. INTC_VECT(SDHI1, 0x0ec0), INTC_VECT(SDHI1, 0x0ee0),
  102. INTC_VECT(MSU_MSU, 0x0f20), INTC_VECT(MSU_MSU2, 0x0f40),
  103. INTC_VECT(IREM, 0x0f60),
  104. INTC_VECT(SIU, 0x0fa0),
  105. INTC_VECT(SPU, 0x0fc0),
  106. INTC_VECT(IRDA, 0x0480),
  107. INTC_VECT(TPU0, 0x04a0), INTC_VECT(TPU1, 0x04c0),
  108. INTC_VECT(TPU2, 0x04e0), INTC_VECT(TPU3, 0x0500),
  109. INTC_VECT(TPU4, 0x0520),
  110. INTC_VECT(LCRC, 0x0540),
  111. INTC_VECT(PINT1, 0x1000), INTC_VECT(PINT2, 0x1020),
  112. INTC_VECT(TTI20, 0x1100),
  113. INTC_VECT(MISTY, 0x1120),
  114. INTC_VECT(DDM, 0x1140),
  115. INTC_VECT(SDHI2, 0x1200), INTC_VECT(SDHI2, 0x1220),
  116. INTC_VECT(SDHI2, 0x1240), INTC_VECT(SDHI2, 0x1260),
  117. INTC_VECT(RWDT0, 0x1280), INTC_VECT(RWDT1, 0x12a0),
  118. INTC_VECT(DMAC_1_DEI0, 0x2000), INTC_VECT(DMAC_1_DEI1, 0x2020),
  119. INTC_VECT(DMAC_1_DEI2, 0x2040), INTC_VECT(DMAC_1_DEI3, 0x2060),
  120. INTC_VECT(DMAC_2_DEI4, 0x2080), INTC_VECT(DMAC_2_DEI5, 0x20a0),
  121. INTC_VECT(DMAC_2_DADERR, 0x20c0),
  122. INTC_VECT(DMAC2_1_DEI0, 0x2100), INTC_VECT(DMAC2_1_DEI1, 0x2120),
  123. INTC_VECT(DMAC2_1_DEI2, 0x2140), INTC_VECT(DMAC2_1_DEI3, 0x2160),
  124. INTC_VECT(DMAC2_2_DEI4, 0x2180), INTC_VECT(DMAC2_2_DEI5, 0x21a0),
  125. INTC_VECT(DMAC2_2_DADERR, 0x21c0),
  126. INTC_VECT(DMAC3_1_DEI0, 0x2200), INTC_VECT(DMAC3_1_DEI1, 0x2220),
  127. INTC_VECT(DMAC3_1_DEI2, 0x2240), INTC_VECT(DMAC3_1_DEI3, 0x2260),
  128. INTC_VECT(DMAC3_2_DEI4, 0x2280), INTC_VECT(DMAC3_2_DEI5, 0x22a0),
  129. INTC_VECT(DMAC3_2_DADERR, 0x22c0),
  130. };
  131. static struct intc_group intca_groups[] __initdata = {
  132. INTC_GROUP(DMAC_1, DMAC_1_DEI0,
  133. DMAC_1_DEI1, DMAC_1_DEI2, DMAC_1_DEI3),
  134. INTC_GROUP(DMAC_2, DMAC_2_DEI4,
  135. DMAC_2_DEI5, DMAC_2_DADERR),
  136. INTC_GROUP(DMAC2_1, DMAC2_1_DEI0,
  137. DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3),
  138. INTC_GROUP(DMAC2_2, DMAC2_2_DEI4,
  139. DMAC2_2_DEI5, DMAC2_2_DADERR),
  140. INTC_GROUP(DMAC3_1, DMAC3_1_DEI0,
  141. DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3),
  142. INTC_GROUP(DMAC3_2, DMAC3_2_DEI4,
  143. DMAC3_2_DEI5, DMAC3_2_DADERR),
  144. INTC_GROUP(ETM11, ETM11_ACQCMP, ETM11_FULL),
  145. INTC_GROUP(ARM11, ARM11_IRQPMU, ARM11_COMMTX, ARM11_COMMTX),
  146. INTC_GROUP(USBHS, USBHS_USHI0, USBHS_USHI1),
  147. INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI,
  148. FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
  149. INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1),
  150. };
  151. static struct intc_mask_reg intca_mask_registers[] __initdata = {
  152. { 0xe6940080, 0xe69400c0, 8, /* IMR0A / IMCR0A */
  153. { DMAC2_1_DEI3, DMAC2_1_DEI2, DMAC2_1_DEI1, DMAC2_1_DEI0,
  154. ARM11_IRQPMU, 0, ARM11_COMMTX, ARM11_COMMRX } },
  155. { 0xe6940084, 0xe69400c4, 8, /* IMR1A / IMCR1A */
  156. { CRYPT1_ERR, CRYPT2_STD, DIRC, 0,
  157. DMAC_1_DEI3, DMAC_1_DEI2, DMAC_1_DEI1, DMAC_1_DEI0 } },
  158. { 0xe6940088, 0xe69400c8, 8, /* IMR2A / IMCR2A */
  159. { PINT1, PINT2, 0, 0,
  160. BBIF1, BBIF2, MFI_MFIS, MFI_MFIM } },
  161. { 0xe694008c, 0xe69400cc, 8, /* IMR3A / IMCR3A */
  162. { DMAC3_1_DEI3, DMAC3_1_DEI2, DMAC3_1_DEI1, DMAC3_1_DEI0,
  163. DMAC3_2_DADERR, DMAC3_2_DEI5, DMAC3_2_DEI4, IRDA } },
  164. { 0xe6940090, 0xe69400d0, 8, /* IMR4A / IMCR4A */
  165. { DDM, 0, 0, 0,
  166. 0, 0, ETM11_FULL, ETM11_ACQCMP } },
  167. { 0xe6940094, 0xe69400d4, 8, /* IMR5A / IMCR5A */
  168. { KEYSC_KEY, DMAC_2_DADERR, DMAC_2_DEI5, DMAC_2_DEI4,
  169. SCIFA3, SCIFA2, SCIFA1, SCIFA0 } },
  170. { 0xe6940098, 0xe69400d8, 8, /* IMR6A / IMCR6A */
  171. { SCIFB, SCIFA5, SCIFA4, MSIOF1,
  172. 0, 0, MSIOF2, 0 } },
  173. { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */
  174. { DISABLED, ENABLED, ENABLED, ENABLED,
  175. FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
  176. { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */
  177. { DISABLED, ENABLED, ENABLED, ENABLED,
  178. TTI20, USBDMAC_USHDMI, SPU, SIU } },
  179. { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */
  180. { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10,
  181. CMT2, USBHS_USHI1, USBHS_USHI0, 0 } },
  182. { 0xe69400a8, 0xe69400e8, 8, /* IMR10A / IMCR10A */
  183. { 0, DMAC2_2_DADERR, DMAC2_2_DEI5, DMAC2_2_DEI4,
  184. 0, 0, 0, 0 } },
  185. { 0xe69400ac, 0xe69400ec, 8, /* IMR11A / IMCR11A */
  186. { IIC1_DTEI1, IIC1_WAITI1, IIC1_TACKI1, IIC1_ALI1,
  187. LCRC, MSU_MSU2, IREM, MSU_MSU } },
  188. { 0xe69400b0, 0xe69400f0, 8, /* IMR12A / IMCR12A */
  189. { 0, 0, TPU0, TPU1,
  190. TPU2, TPU3, TPU4, 0 } },
  191. { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */
  192. { DISABLED, ENABLED, ENABLED, ENABLED,
  193. MISTY, CMT3, RWDT1, RWDT0 } },
  194. };
  195. static struct intc_prio_reg intca_prio_registers[] __initdata = {
  196. { 0xe6940000, 0, 16, 4, /* IPRAA */ { DMAC3_1, DMAC3_2, CMT2, LCRC } },
  197. { 0xe6940004, 0, 16, 4, /* IPRBA */ { IRDA, ETM11, BBIF1, BBIF2 } },
  198. { 0xe6940008, 0, 16, 4, /* IPRCA */ { CRYPT1_ERR, CRYPT2_STD,
  199. CMT1_CMT11, ARM11 } },
  200. { 0xe694000c, 0, 16, 4, /* IPRDA */ { PINT1, PINT2,
  201. CMT1_CMT12, TPU4 } },
  202. { 0xe6940010, 0, 16, 4, /* IPREA */ { DMAC_1, MFI_MFIS,
  203. MFI_MFIM, USBHS } },
  204. { 0xe6940014, 0, 16, 4, /* IPRFA */ { KEYSC_KEY, DMAC_2,
  205. 0, CMT1_CMT10 } },
  206. { 0xe6940018, 0, 16, 4, /* IPRGA */ { SCIFA0, SCIFA1,
  207. SCIFA2, SCIFA3 } },
  208. { 0xe694001c, 0, 16, 4, /* IPRGH */ { MSIOF2, USBDMAC_USHDMI,
  209. FLCTL, SDHI0 } },
  210. { 0xe6940020, 0, 16, 4, /* IPRIA */ { MSIOF1, SCIFA4, MSU_MSU, IIC1 } },
  211. { 0xe6940024, 0, 16, 4, /* IPRJA */ { DMAC2_1, DMAC2_2, SIU, TTI20 } },
  212. { 0xe6940028, 0, 16, 4, /* IPRKA */ { 0, CMT1_CMT13, IREM, SDHI1 } },
  213. { 0xe694002c, 0, 16, 4, /* IPRLA */ { TPU0, TPU1, TPU2, TPU3 } },
  214. { 0xe6940030, 0, 16, 4, /* IPRMA */ { MISTY, CMT3, RWDT1, RWDT0 } },
  215. { 0xe6940034, 0, 16, 4, /* IPRNA */ { SCIFB, SCIFA5, SPU, DDM } },
  216. { 0xe6940038, 0, 16, 4, /* IPROA */ { 0, 0, DIRC, SDHI2 } },
  217. };
  218. static struct intc_desc intca_desc __initdata = {
  219. .name = "sh7367-intca",
  220. .force_enable = ENABLED,
  221. .force_disable = DISABLED,
  222. .hw = INTC_HW_DESC(intca_vectors, intca_groups,
  223. intca_mask_registers, intca_prio_registers,
  224. NULL, NULL),
  225. };
  226. INTC_IRQ_PINS_16(intca_irq_pins, 0xe6900000,
  227. INTC_VECT, "sh7367-intca-irq-pins");
  228. enum {
  229. UNUSED_INTCS = 0,
  230. INTCS,
  231. /* interrupt sources INTCS */
  232. VIO2_VEU0, VIO2_VEU1, VIO2_VEU2, VIO2_VEU3,
  233. VIO3_VOU,
  234. RTDMAC_1_DEI0, RTDMAC_1_DEI1, RTDMAC_1_DEI2, RTDMAC_1_DEI3,
  235. VIO1_CEU, VIO1_BEU0, VIO1_BEU1, VIO1_BEU2,
  236. VPU,
  237. SGX530,
  238. _2DDMAC_2DDM0, _2DDMAC_2DDM1, _2DDMAC_2DDM2, _2DDMAC_2DDM3,
  239. IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2,
  240. IPMMU_IPMMUB, IPMMU_IPMMUS,
  241. RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR,
  242. MSIOF,
  243. IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0,
  244. TMU_TUNI0, TMU_TUNI1, TMU_TUNI2,
  245. CMT,
  246. TSIF,
  247. IPMMUI,
  248. MVI3,
  249. ICB,
  250. PEP,
  251. ASA,
  252. BEM,
  253. VE2HO,
  254. HQE,
  255. JPEG,
  256. LCDC,
  257. /* interrupt groups INTCS */
  258. _2DDMAC, RTDMAC_1, RTDMAC_2, VEU, BEU, IIC0, IPMMU, IIC2,
  259. };
  260. static struct intc_vect intcs_vectors[] = {
  261. INTCS_VECT(VIO2_VEU0, 0x700), INTCS_VECT(VIO2_VEU1, 0x720),
  262. INTCS_VECT(VIO2_VEU2, 0x740), INTCS_VECT(VIO2_VEU3, 0x760),
  263. INTCS_VECT(VIO3_VOU, 0x780),
  264. INTCS_VECT(RTDMAC_1_DEI0, 0x800), INTCS_VECT(RTDMAC_1_DEI1, 0x820),
  265. INTCS_VECT(RTDMAC_1_DEI2, 0x840), INTCS_VECT(RTDMAC_1_DEI3, 0x860),
  266. INTCS_VECT(VIO1_CEU, 0x880), INTCS_VECT(VIO1_BEU0, 0x8a0),
  267. INTCS_VECT(VIO1_BEU1, 0x8c0), INTCS_VECT(VIO1_BEU2, 0x8e0),
  268. INTCS_VECT(VPU, 0x980),
  269. INTCS_VECT(SGX530, 0x9e0),
  270. INTCS_VECT(_2DDMAC_2DDM0, 0xa00), INTCS_VECT(_2DDMAC_2DDM1, 0xa20),
  271. INTCS_VECT(_2DDMAC_2DDM2, 0xa40), INTCS_VECT(_2DDMAC_2DDM3, 0xa60),
  272. INTCS_VECT(IIC2_ALI2, 0xa80), INTCS_VECT(IIC2_TACKI2, 0xaa0),
  273. INTCS_VECT(IIC2_WAITI2, 0xac0), INTCS_VECT(IIC2_DTEI2, 0xae0),
  274. INTCS_VECT(IPMMU_IPMMUB, 0xb20), INTCS_VECT(IPMMU_IPMMUS, 0xb60),
  275. INTCS_VECT(RTDMAC_2_DEI4, 0xb80), INTCS_VECT(RTDMAC_2_DEI5, 0xba0),
  276. INTCS_VECT(RTDMAC_2_DADERR, 0xbc0),
  277. INTCS_VECT(MSIOF, 0xd20),
  278. INTCS_VECT(IIC0_ALI0, 0xe00), INTCS_VECT(IIC0_TACKI0, 0xe20),
  279. INTCS_VECT(IIC0_WAITI0, 0xe40), INTCS_VECT(IIC0_DTEI0, 0xe60),
  280. INTCS_VECT(TMU_TUNI0, 0xe80), INTCS_VECT(TMU_TUNI1, 0xea0),
  281. INTCS_VECT(TMU_TUNI2, 0xec0),
  282. INTCS_VECT(CMT, 0xf00),
  283. INTCS_VECT(TSIF, 0xf20),
  284. INTCS_VECT(IPMMUI, 0xf60),
  285. INTCS_VECT(MVI3, 0x420),
  286. INTCS_VECT(ICB, 0x480),
  287. INTCS_VECT(PEP, 0x4a0),
  288. INTCS_VECT(ASA, 0x4c0),
  289. INTCS_VECT(BEM, 0x4e0),
  290. INTCS_VECT(VE2HO, 0x520),
  291. INTCS_VECT(HQE, 0x540),
  292. INTCS_VECT(JPEG, 0x560),
  293. INTCS_VECT(LCDC, 0x580),
  294. INTC_VECT(INTCS, 0xf80),
  295. };
  296. static struct intc_group intcs_groups[] __initdata = {
  297. INTC_GROUP(_2DDMAC, _2DDMAC_2DDM0, _2DDMAC_2DDM1,
  298. _2DDMAC_2DDM2, _2DDMAC_2DDM3),
  299. INTC_GROUP(RTDMAC_1, RTDMAC_1_DEI0, RTDMAC_1_DEI1,
  300. RTDMAC_1_DEI2, RTDMAC_1_DEI3),
  301. INTC_GROUP(RTDMAC_2, RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR),
  302. INTC_GROUP(VEU, VIO2_VEU0, VIO2_VEU1, VIO2_VEU2, VIO2_VEU3),
  303. INTC_GROUP(BEU, VIO1_BEU0, VIO1_BEU1, VIO1_BEU2),
  304. INTC_GROUP(IIC0, IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0),
  305. INTC_GROUP(IPMMU, IPMMU_IPMMUS, IPMMU_IPMMUB),
  306. INTC_GROUP(IIC2, IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2),
  307. };
  308. static struct intc_mask_reg intcs_mask_registers[] = {
  309. { 0xffd20184, 0xffd201c4, 8, /* IMR1SA / IMCR1SA */
  310. { VIO1_BEU2, VIO1_BEU1, VIO1_BEU0, VIO1_CEU,
  311. VIO2_VEU3, VIO2_VEU2, VIO2_VEU1, VIO2_VEU0 } },
  312. { 0xffd20188, 0xffd201c8, 8, /* IMR2SA / IMCR2SA */
  313. { VIO3_VOU, 0, VE2HO, VPU,
  314. 0, 0, 0, 0 } },
  315. { 0xffd2018c, 0xffd201cc, 8, /* IMR3SA / IMCR3SA */
  316. { _2DDMAC_2DDM3, _2DDMAC_2DDM2, _2DDMAC_2DDM1, _2DDMAC_2DDM0,
  317. BEM, ASA, PEP, ICB } },
  318. { 0xffd20190, 0xffd201d0, 8, /* IMR4SA / IMCR4SA */
  319. { 0, 0, MVI3, 0,
  320. JPEG, HQE, 0, LCDC } },
  321. { 0xffd20194, 0xffd201d4, 8, /* IMR5SA / IMCR5SA */
  322. { 0, RTDMAC_2_DADERR, RTDMAC_2_DEI5, RTDMAC_2_DEI4,
  323. RTDMAC_1_DEI3, RTDMAC_1_DEI2, RTDMAC_1_DEI1, RTDMAC_1_DEI0 } },
  324. { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */
  325. { 0, 0, MSIOF, 0,
  326. SGX530, 0, 0, 0 } },
  327. { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */
  328. { 0, TMU_TUNI2, TMU_TUNI1, TMU_TUNI0,
  329. 0, 0, 0, 0 } },
  330. { 0xffd201a4, 0xffd201e4, 8, /* IMR9SA / IMCR9SA */
  331. { 0, 0, 0, CMT,
  332. IIC2_DTEI2, IIC2_WAITI2, IIC2_TACKI2, IIC2_ALI2 } },
  333. { 0xffd201a8, 0xffd201e8, 8, /* IMR10SA / IMCR10SA */
  334. { IPMMU_IPMMUS, 0, IPMMU_IPMMUB, 0,
  335. 0, 0, 0, 0 } },
  336. { 0xffd201ac, 0xffd201ec, 8, /* IMR11SA / IMCR11SA */
  337. { IIC0_DTEI0, IIC0_WAITI0, IIC0_TACKI0, IIC0_ALI0,
  338. 0, 0, IPMMUI, TSIF } },
  339. { 0xffd20104, 0, 16, /* INTAMASK */
  340. { 0, 0, 0, 0, 0, 0, 0, 0,
  341. 0, 0, 0, 0, 0, 0, 0, INTCS } },
  342. };
  343. /* Priority is needed for INTCA to receive the INTCS interrupt */
  344. static struct intc_prio_reg intcs_prio_registers[] = {
  345. { 0xffd20000, 0, 16, 4, /* IPRAS */ { 0, MVI3, _2DDMAC, ICB } },
  346. { 0xffd20004, 0, 16, 4, /* IPRBS */ { JPEG, LCDC, 0, 0 } },
  347. { 0xffd20008, 0, 16, 4, /* IPRCS */ { BBIF2, 0, 0, 0 } },
  348. { 0xffd20010, 0, 16, 4, /* IPRES */ { RTDMAC_1, VIO1_CEU, 0, VPU } },
  349. { 0xffd20014, 0, 16, 4, /* IPRFS */ { 0, RTDMAC_2, 0, CMT } },
  350. { 0xffd20018, 0, 16, 4, /* IPRGS */ { TMU_TUNI0, TMU_TUNI1,
  351. TMU_TUNI2, 0 } },
  352. { 0xffd2001c, 0, 16, 4, /* IPRHS */ { 0, VIO3_VOU, VEU, BEU } },
  353. { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF, IIC0 } },
  354. { 0xffd20024, 0, 16, 4, /* IPRJS */ { 0, SGX530, 0, 0 } },
  355. { 0xffd20028, 0, 16, 4, /* IPRKS */ { BEM, ASA, IPMMUI, PEP } },
  356. { 0xffd2002c, 0, 16, 4, /* IPRLS */ { IPMMU, 0, VE2HO, HQE } },
  357. { 0xffd20030, 0, 16, 4, /* IPRMS */ { IIC2, 0, 0, 0 } },
  358. };
  359. static struct resource intcs_resources[] __initdata = {
  360. [0] = {
  361. .start = 0xffd20000,
  362. .end = 0xffd2ffff,
  363. .flags = IORESOURCE_MEM,
  364. }
  365. };
  366. static struct intc_desc intcs_desc __initdata = {
  367. .name = "sh7367-intcs",
  368. .resource = intcs_resources,
  369. .num_resources = ARRAY_SIZE(intcs_resources),
  370. .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
  371. intcs_prio_registers, NULL, NULL),
  372. };
  373. static void intcs_demux(unsigned int irq, struct irq_desc *desc)
  374. {
  375. void __iomem *reg = (void *)irq_get_handler_data(irq);
  376. unsigned int evtcodeas = ioread32(reg);
  377. generic_handle_irq(intcs_evt2irq(evtcodeas));
  378. }
  379. void __init sh7367_init_irq(void)
  380. {
  381. void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
  382. register_intc_controller(&intca_desc);
  383. register_intc_controller(&intca_irq_pins_desc);
  384. register_intc_controller(&intcs_desc);
  385. /* demux using INTEVTSA */
  386. irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa);
  387. irq_set_chained_handler(evt2irq(0xf80), intcs_demux);
  388. }