blob: 0ba8b7b69f608e63e4e588d863990666f998804b [file] [log] [blame]
Magnus Damme4e430c2010-02-09 03:36:03 +00001/*
2 * sh7372 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>
Magnus Dammda5713e2011-10-12 16:21:34 +090025#include <mach/intc.h>
Rob Herring250a2722012-01-03 16:57:33 -060026#include <mach/irqs.h>
Magnus Damme4e430c2010-02-09 03:36:03 +000027#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30enum {
31 UNUSED_INTCA = 0,
32
33 /* interrupt sources INTCA */
Magnus Damme4e430c2010-02-09 03:36:03 +000034 DIRC,
35 CRYPT_STD,
36 IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1,
37 AP_ARM_IRQPMU, AP_ARM_COMMTX, AP_ARM_COMMRX,
38 MFI_MFIM, MFI_MFIS,
39 BBIF1, BBIF2,
Kuninori Morimotodeded432010-02-12 09:55:08 +000040 USBHSDMAC0_USHDMI,
Magnus Damme4e430c2010-02-09 03:36:03 +000041 _3DG_SGX540,
42 CMT1_CMT10, CMT1_CMT11, CMT1_CMT12, CMT1_CMT13, CMT2, CMT3,
43 KEYSC_KEY,
44 SCIFA0, SCIFA1, SCIFA2, SCIFA3,
45 MSIOF2, MSIOF1,
46 SCIFA4, SCIFA5, SCIFB,
47 FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
Simon Horman2007aea2011-04-27 07:43:58 +000048 SDHI0_SDHI0I0, SDHI0_SDHI0I1, SDHI0_SDHI0I2, SDHI0_SDHI0I3,
49 SDHI1_SDHI1I0, SDHI1_SDHI1I1, SDHI1_SDHI1I2,
Magnus Damme4e430c2010-02-09 03:36:03 +000050 IRREM,
51 IRDA,
52 TPU0,
53 TTI20,
54 DDM,
Simon Horman2007aea2011-04-27 07:43:58 +000055 SDHI2_SDHI2I0, SDHI2_SDHI2I1, SDHI2_SDHI2I2, SDHI2_SDHI2I3,
Magnus Damme4e430c2010-02-09 03:36:03 +000056 RWDT0,
Kuninori Morimotodeded432010-02-12 09:55:08 +000057 DMAC1_1_DEI0, DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3,
58 DMAC1_2_DEI4, DMAC1_2_DEI5, DMAC1_2_DADERR,
Magnus Damme4e430c2010-02-09 03:36:03 +000059 DMAC2_1_DEI0, DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3,
60 DMAC2_2_DEI4, DMAC2_2_DEI5, DMAC2_2_DADERR,
61 DMAC3_1_DEI0, DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3,
62 DMAC3_2_DEI4, DMAC3_2_DEI5, DMAC3_2_DADERR,
63 SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM,
64 HDMI,
65 SPU2_SPU0, SPU2_SPU1,
66 FSI, FMSI,
67 MIPI_HSI,
68 IPMMU_IPMMUD,
Kuninori Morimotodeded432010-02-12 09:55:08 +000069 CEC_1, CEC_2,
Magnus Damme4e430c2010-02-09 03:36:03 +000070 AP_ARM_CTIIRQ, AP_ARM_DMAEXTERRIRQ, AP_ARM_DMAIRQ, AP_ARM_DMASIRQ,
71 MFIS2,
72 CPORTR2S,
73 CMT14, CMT15,
74 MMC_MMC_ERR, MMC_MMC_NOR,
75 IIC4_ALI4, IIC4_TACKI4, IIC4_WAITI4, IIC4_DTEI4,
76 IIC3_ALI3, IIC3_TACKI3, IIC3_WAITI3, IIC3_DTEI3,
77 USB0_USB0I1, USB0_USB0I0,
78 USB1_USB1I1, USB1_USB1I0,
Kuninori Morimotodeded432010-02-12 09:55:08 +000079 USBHSDMAC1_USHDMI,
Magnus Damme4e430c2010-02-09 03:36:03 +000080
81 /* interrupt groups INTCA */
Kuninori Morimotodeded432010-02-12 09:55:08 +000082 DMAC1_1, DMAC1_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2, SHWYSTAT,
Simon Horman2007aea2011-04-27 07:43:58 +000083 AP_ARM1, AP_ARM2, SPU2, FLCTL, IIC1, SDHI0, SDHI1, SDHI2
Magnus Damme4e430c2010-02-09 03:36:03 +000084};
85
Kuninori Morimotodeded432010-02-12 09:55:08 +000086static struct intc_vect intca_vectors[] __initdata = {
Magnus Damme4e430c2010-02-09 03:36:03 +000087 INTC_VECT(DIRC, 0x0560),
88 INTC_VECT(CRYPT_STD, 0x0700),
89 INTC_VECT(IIC1_ALI1, 0x0780), INTC_VECT(IIC1_TACKI1, 0x07a0),
90 INTC_VECT(IIC1_WAITI1, 0x07c0), INTC_VECT(IIC1_DTEI1, 0x07e0),
91 INTC_VECT(AP_ARM_IRQPMU, 0x0800), INTC_VECT(AP_ARM_COMMTX, 0x0840),
92 INTC_VECT(AP_ARM_COMMRX, 0x0860),
93 INTC_VECT(MFI_MFIM, 0x0900), INTC_VECT(MFI_MFIS, 0x0920),
94 INTC_VECT(BBIF1, 0x0940), INTC_VECT(BBIF2, 0x0960),
Kuninori Morimotodeded432010-02-12 09:55:08 +000095 INTC_VECT(USBHSDMAC0_USHDMI, 0x0a00),
Magnus Damme4e430c2010-02-09 03:36:03 +000096 INTC_VECT(_3DG_SGX540, 0x0a60),
97 INTC_VECT(CMT1_CMT10, 0x0b00), INTC_VECT(CMT1_CMT11, 0x0b20),
98 INTC_VECT(CMT1_CMT12, 0x0b40), INTC_VECT(CMT1_CMT13, 0x0b60),
99 INTC_VECT(CMT2, 0x0b80), INTC_VECT(CMT3, 0x0ba0),
100 INTC_VECT(KEYSC_KEY, 0x0be0),
101 INTC_VECT(SCIFA0, 0x0c00), INTC_VECT(SCIFA1, 0x0c20),
102 INTC_VECT(SCIFA2, 0x0c40), INTC_VECT(SCIFA3, 0x0c60),
103 INTC_VECT(MSIOF2, 0x0c80), INTC_VECT(MSIOF1, 0x0d00),
104 INTC_VECT(SCIFA4, 0x0d20), INTC_VECT(SCIFA5, 0x0d40),
105 INTC_VECT(SCIFB, 0x0d60),
106 INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0),
107 INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0),
Simon Horman2007aea2011-04-27 07:43:58 +0000108 INTC_VECT(SDHI0_SDHI0I0, 0x0e00), INTC_VECT(SDHI0_SDHI0I1, 0x0e20),
109 INTC_VECT(SDHI0_SDHI0I2, 0x0e40), INTC_VECT(SDHI0_SDHI0I3, 0x0e60),
110 INTC_VECT(SDHI1_SDHI1I0, 0x0e80), INTC_VECT(SDHI1_SDHI1I1, 0x0ea0),
111 INTC_VECT(SDHI1_SDHI1I2, 0x0ec0),
Magnus Damme4e430c2010-02-09 03:36:03 +0000112 INTC_VECT(IRREM, 0x0f60),
113 INTC_VECT(IRDA, 0x0480),
114 INTC_VECT(TPU0, 0x04a0),
115 INTC_VECT(TTI20, 0x1100),
116 INTC_VECT(DDM, 0x1140),
Simon Horman2007aea2011-04-27 07:43:58 +0000117 INTC_VECT(SDHI2_SDHI2I0, 0x1200), INTC_VECT(SDHI2_SDHI2I1, 0x1220),
118 INTC_VECT(SDHI2_SDHI2I2, 0x1240), INTC_VECT(SDHI2_SDHI2I3, 0x1260),
Magnus Damme4e430c2010-02-09 03:36:03 +0000119 INTC_VECT(RWDT0, 0x1280),
Kuninori Morimotodeded432010-02-12 09:55:08 +0000120 INTC_VECT(DMAC1_1_DEI0, 0x2000), INTC_VECT(DMAC1_1_DEI1, 0x2020),
121 INTC_VECT(DMAC1_1_DEI2, 0x2040), INTC_VECT(DMAC1_1_DEI3, 0x2060),
122 INTC_VECT(DMAC1_2_DEI4, 0x2080), INTC_VECT(DMAC1_2_DEI5, 0x20a0),
123 INTC_VECT(DMAC1_2_DADERR, 0x20c0),
Magnus Damme4e430c2010-02-09 03:36:03 +0000124 INTC_VECT(DMAC2_1_DEI0, 0x2100), INTC_VECT(DMAC2_1_DEI1, 0x2120),
125 INTC_VECT(DMAC2_1_DEI2, 0x2140), INTC_VECT(DMAC2_1_DEI3, 0x2160),
126 INTC_VECT(DMAC2_2_DEI4, 0x2180), INTC_VECT(DMAC2_2_DEI5, 0x21a0),
127 INTC_VECT(DMAC2_2_DADERR, 0x21c0),
128 INTC_VECT(DMAC3_1_DEI0, 0x2200), INTC_VECT(DMAC3_1_DEI1, 0x2220),
129 INTC_VECT(DMAC3_1_DEI2, 0x2240), INTC_VECT(DMAC3_1_DEI3, 0x2260),
130 INTC_VECT(DMAC3_2_DEI4, 0x2280), INTC_VECT(DMAC3_2_DEI5, 0x22a0),
131 INTC_VECT(DMAC3_2_DADERR, 0x22c0),
Kuninori Morimotodeded432010-02-12 09:55:08 +0000132 INTC_VECT(SHWYSTAT_RT, 0x1300), INTC_VECT(SHWYSTAT_HS, 0x1320),
Magnus Damme4e430c2010-02-09 03:36:03 +0000133 INTC_VECT(SHWYSTAT_COM, 0x1340),
134 INTC_VECT(HDMI, 0x17e0),
135 INTC_VECT(SPU2_SPU0, 0x1800), INTC_VECT(SPU2_SPU1, 0x1820),
136 INTC_VECT(FSI, 0x1840),
137 INTC_VECT(FMSI, 0x1860),
138 INTC_VECT(MIPI_HSI, 0x18e0),
139 INTC_VECT(IPMMU_IPMMUD, 0x1920),
Kuninori Morimotodeded432010-02-12 09:55:08 +0000140 INTC_VECT(CEC_1, 0x1940), INTC_VECT(CEC_2, 0x1960),
Magnus Damme4e430c2010-02-09 03:36:03 +0000141 INTC_VECT(AP_ARM_CTIIRQ, 0x1980),
142 INTC_VECT(AP_ARM_DMAEXTERRIRQ, 0x19a0),
143 INTC_VECT(AP_ARM_DMAIRQ, 0x19c0),
144 INTC_VECT(AP_ARM_DMASIRQ, 0x19e0),
145 INTC_VECT(MFIS2, 0x1a00),
146 INTC_VECT(CPORTR2S, 0x1a20),
147 INTC_VECT(CMT14, 0x1a40), INTC_VECT(CMT15, 0x1a60),
148 INTC_VECT(MMC_MMC_ERR, 0x1ac0), INTC_VECT(MMC_MMC_NOR, 0x1ae0),
149 INTC_VECT(IIC4_ALI4, 0x1b00), INTC_VECT(IIC4_TACKI4, 0x1b20),
150 INTC_VECT(IIC4_WAITI4, 0x1b40), INTC_VECT(IIC4_DTEI4, 0x1b60),
151 INTC_VECT(IIC3_ALI3, 0x1b80), INTC_VECT(IIC3_TACKI3, 0x1ba0),
152 INTC_VECT(IIC3_WAITI3, 0x1bc0), INTC_VECT(IIC3_DTEI3, 0x1be0),
153 INTC_VECT(USB0_USB0I1, 0x1c80), INTC_VECT(USB0_USB0I0, 0x1ca0),
154 INTC_VECT(USB1_USB1I1, 0x1cc0), INTC_VECT(USB1_USB1I0, 0x1ce0),
Kuninori Morimotodeded432010-02-12 09:55:08 +0000155 INTC_VECT(USBHSDMAC1_USHDMI, 0x1d00),
Magnus Damme4e430c2010-02-09 03:36:03 +0000156};
157
158static struct intc_group intca_groups[] __initdata = {
Kuninori Morimotodeded432010-02-12 09:55:08 +0000159 INTC_GROUP(DMAC1_1, DMAC1_1_DEI0,
160 DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3),
161 INTC_GROUP(DMAC1_2, DMAC1_2_DEI4,
162 DMAC1_2_DEI5, DMAC1_2_DADERR),
Magnus Damme4e430c2010-02-09 03:36:03 +0000163 INTC_GROUP(DMAC2_1, DMAC2_1_DEI0,
164 DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3),
165 INTC_GROUP(DMAC2_2, DMAC2_2_DEI4,
166 DMAC2_2_DEI5, DMAC2_2_DADERR),
167 INTC_GROUP(DMAC3_1, DMAC3_1_DEI0,
168 DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3),
169 INTC_GROUP(DMAC3_2, DMAC3_2_DEI4,
170 DMAC3_2_DEI5, DMAC3_2_DADERR),
Kuninori Morimotodeded432010-02-12 09:55:08 +0000171 INTC_GROUP(AP_ARM1, AP_ARM_IRQPMU, AP_ARM_COMMTX, AP_ARM_COMMRX),
172 INTC_GROUP(AP_ARM2, AP_ARM_CTIIRQ, AP_ARM_DMAEXTERRIRQ,
173 AP_ARM_DMAIRQ, AP_ARM_DMASIRQ),
Magnus Damme4e430c2010-02-09 03:36:03 +0000174 INTC_GROUP(SPU2, SPU2_SPU0, SPU2_SPU1),
175 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI,
176 FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
177 INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1),
Simon Horman2007aea2011-04-27 07:43:58 +0000178 INTC_GROUP(SDHI0, SDHI0_SDHI0I0, SDHI0_SDHI0I1,
179 SDHI0_SDHI0I2, SDHI0_SDHI0I3),
180 INTC_GROUP(SDHI1, SDHI1_SDHI1I0, SDHI1_SDHI1I1,
181 SDHI1_SDHI1I2),
182 INTC_GROUP(SDHI2, SDHI2_SDHI2I0, SDHI2_SDHI2I1,
183 SDHI2_SDHI2I2, SDHI2_SDHI2I3),
Magnus Damme4e430c2010-02-09 03:36:03 +0000184 INTC_GROUP(SHWYSTAT, SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM),
185};
186
Kuninori Morimotodeded432010-02-12 09:55:08 +0000187static struct intc_mask_reg intca_mask_registers[] __initdata = {
Magnus Damme4e430c2010-02-09 03:36:03 +0000188 { 0xe6940080, 0xe69400c0, 8, /* IMR0A / IMCR0A */
189 { DMAC2_1_DEI3, DMAC2_1_DEI2, DMAC2_1_DEI1, DMAC2_1_DEI0,
190 AP_ARM_IRQPMU, 0, AP_ARM_COMMTX, AP_ARM_COMMRX } },
191 { 0xe6940084, 0xe69400c4, 8, /* IMR1A / IMCR1A */
192 { 0, CRYPT_STD, DIRC, 0,
Kuninori Morimotodeded432010-02-12 09:55:08 +0000193 DMAC1_1_DEI3, DMAC1_1_DEI2, DMAC1_1_DEI1, DMAC1_1_DEI0 } },
Magnus Damme4e430c2010-02-09 03:36:03 +0000194 { 0xe6940088, 0xe69400c8, 8, /* IMR2A / IMCR2A */
195 { 0, 0, 0, 0,
196 BBIF1, BBIF2, MFI_MFIS, MFI_MFIM } },
197 { 0xe694008c, 0xe69400cc, 8, /* IMR3A / IMCR3A */
198 { DMAC3_1_DEI3, DMAC3_1_DEI2, DMAC3_1_DEI1, DMAC3_1_DEI0,
199 DMAC3_2_DADERR, DMAC3_2_DEI5, DMAC3_2_DEI4, IRDA } },
200 { 0xe6940090, 0xe69400d0, 8, /* IMR4A / IMCR4A */
201 { DDM, 0, 0, 0,
202 0, 0, 0, 0 } },
203 { 0xe6940094, 0xe69400d4, 8, /* IMR5A / IMCR5A */
Kuninori Morimotodeded432010-02-12 09:55:08 +0000204 { KEYSC_KEY, DMAC1_2_DADERR, DMAC1_2_DEI5, DMAC1_2_DEI4,
Magnus Damme4e430c2010-02-09 03:36:03 +0000205 SCIFA3, SCIFA2, SCIFA1, SCIFA0 } },
206 { 0xe6940098, 0xe69400d8, 8, /* IMR6A / IMCR6A */
207 { SCIFB, SCIFA5, SCIFA4, MSIOF1,
208 0, 0, MSIOF2, 0 } },
209 { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */
Simon Horman2007aea2011-04-27 07:43:58 +0000210 { SDHI0_SDHI0I3, SDHI0_SDHI0I2, SDHI0_SDHI0I1, SDHI0_SDHI0I0,
Magnus Damme4e430c2010-02-09 03:36:03 +0000211 FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
212 { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */
Simon Horman2007aea2011-04-27 07:43:58 +0000213 { 0, SDHI1_SDHI1I2, SDHI1_SDHI1I1, SDHI1_SDHI1I0,
Kuninori Morimotodeded432010-02-12 09:55:08 +0000214 TTI20, USBHSDMAC0_USHDMI, 0, 0 } },
Magnus Damme4e430c2010-02-09 03:36:03 +0000215 { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */
216 { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10,
217 CMT2, 0, 0, _3DG_SGX540 } },
218 { 0xe69400a8, 0xe69400e8, 8, /* IMR10A / IMCR10A */
219 { 0, DMAC2_2_DADERR, DMAC2_2_DEI5, DMAC2_2_DEI4,
220 0, 0, 0, 0 } },
221 { 0xe69400ac, 0xe69400ec, 8, /* IMR11A / IMCR11A */
222 { IIC1_DTEI1, IIC1_WAITI1, IIC1_TACKI1, IIC1_ALI1,
223 0, 0, IRREM, 0 } },
224 { 0xe69400b0, 0xe69400f0, 8, /* IMR12A / IMCR12A */
225 { 0, 0, TPU0, 0,
226 0, 0, 0, 0 } },
227 { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */
Simon Horman2007aea2011-04-27 07:43:58 +0000228 { SDHI2_SDHI2I3, SDHI2_SDHI2I2, SDHI2_SDHI2I1, SDHI2_SDHI2I0,
Magnus Damme4e430c2010-02-09 03:36:03 +0000229 0, CMT3, 0, RWDT0 } },
230 { 0xe6950080, 0xe69500c0, 8, /* IMR0A3 / IMCR0A3 */
231 { SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM, 0,
232 0, 0, 0, 0 } },
233 { 0xe6950090, 0xe69500d0, 8, /* IMR4A3 / IMCR4A3 */
234 { 0, 0, 0, 0,
235 0, 0, 0, HDMI } },
236 { 0xe6950094, 0xe69500d4, 8, /* IMR5A3 / IMCR5A3 */
237 { SPU2_SPU0, SPU2_SPU1, FSI, FMSI,
238 0, 0, 0, MIPI_HSI } },
239 { 0xe6950098, 0xe69500d8, 8, /* IMR6A3 / IMCR6A3 */
Kuninori Morimotodeded432010-02-12 09:55:08 +0000240 { 0, IPMMU_IPMMUD, CEC_1, CEC_2,
Magnus Damme4e430c2010-02-09 03:36:03 +0000241 AP_ARM_CTIIRQ, AP_ARM_DMAEXTERRIRQ,
242 AP_ARM_DMAIRQ, AP_ARM_DMASIRQ } },
243 { 0xe695009c, 0xe69500dc, 8, /* IMR7A3 / IMCR7A3 */
244 { MFIS2, CPORTR2S, CMT14, CMT15,
245 0, 0, MMC_MMC_ERR, MMC_MMC_NOR } },
246 { 0xe69500a0, 0xe69500e0, 8, /* IMR8A3 / IMCR8A3 */
247 { IIC4_ALI4, IIC4_TACKI4, IIC4_WAITI4, IIC4_DTEI4,
248 IIC3_ALI3, IIC3_TACKI3, IIC3_WAITI3, IIC3_DTEI3 } },
249 { 0xe69500a4, 0xe69500e4, 8, /* IMR9A3 / IMCR9A3 */
250 { 0, 0, 0, 0,
251 USB0_USB0I1, USB0_USB0I0, USB1_USB1I1, USB1_USB1I0 } },
252 { 0xe69500a8, 0xe69500e8, 8, /* IMR10A3 / IMCR10A3 */
Kuninori Morimotodeded432010-02-12 09:55:08 +0000253 { USBHSDMAC1_USHDMI, 0, 0, 0,
Magnus Damme4e430c2010-02-09 03:36:03 +0000254 0, 0, 0, 0 } },
255};
256
Kuninori Morimotodeded432010-02-12 09:55:08 +0000257static struct intc_prio_reg intca_prio_registers[] __initdata = {
Magnus Damme4e430c2010-02-09 03:36:03 +0000258 { 0xe6940000, 0, 16, 4, /* IPRAA */ { DMAC3_1, DMAC3_2, CMT2, 0 } },
259 { 0xe6940004, 0, 16, 4, /* IPRBA */ { IRDA, 0, BBIF1, BBIF2 } },
260 { 0xe6940008, 0, 16, 4, /* IPRCA */ { 0, CRYPT_STD,
261 CMT1_CMT11, AP_ARM1 } },
262 { 0xe694000c, 0, 16, 4, /* IPRDA */ { 0, 0,
263 CMT1_CMT12, 0 } },
Kuninori Morimotodeded432010-02-12 09:55:08 +0000264 { 0xe6940010, 0, 16, 4, /* IPREA */ { DMAC1_1, MFI_MFIS,
Magnus Damme4e430c2010-02-09 03:36:03 +0000265 MFI_MFIM, 0 } },
Kuninori Morimotodeded432010-02-12 09:55:08 +0000266 { 0xe6940014, 0, 16, 4, /* IPRFA */ { KEYSC_KEY, DMAC1_2,
Magnus Damme4e430c2010-02-09 03:36:03 +0000267 _3DG_SGX540, CMT1_CMT10 } },
268 { 0xe6940018, 0, 16, 4, /* IPRGA */ { SCIFA0, SCIFA1,
269 SCIFA2, SCIFA3 } },
Kuninori Morimotodeded432010-02-12 09:55:08 +0000270 { 0xe694001c, 0, 16, 4, /* IPRGH */ { MSIOF2, USBHSDMAC0_USHDMI,
Magnus Damme4e430c2010-02-09 03:36:03 +0000271 FLCTL, SDHI0 } },
Kuninori Morimotodeded432010-02-12 09:55:08 +0000272 { 0xe6940020, 0, 16, 4, /* IPRIA */ { MSIOF1, SCIFA4,
273 0/* MSU */, IIC1 } },
274 { 0xe6940024, 0, 16, 4, /* IPRJA */ { DMAC2_1, DMAC2_2,
275 0/* MSUG */, TTI20 } },
Magnus Damme4e430c2010-02-09 03:36:03 +0000276 { 0xe6940028, 0, 16, 4, /* IPRKA */ { 0, CMT1_CMT13, IRREM, SDHI1 } },
277 { 0xe694002c, 0, 16, 4, /* IPRLA */ { TPU0, 0, 0, 0 } },
278 { 0xe6940030, 0, 16, 4, /* IPRMA */ { 0, CMT3, 0, RWDT0 } },
279 { 0xe6940034, 0, 16, 4, /* IPRNA */ { SCIFB, SCIFA5, 0, DDM } },
280 { 0xe6940038, 0, 16, 4, /* IPROA */ { 0, 0, DIRC, SDHI2 } },
281 { 0xe6950000, 0, 16, 4, /* IPRAA3 */ { SHWYSTAT, 0, 0, 0 } },
282 { 0xe6950024, 0, 16, 4, /* IPRJA3 */ { 0, 0, 0, HDMI } },
283 { 0xe6950028, 0, 16, 4, /* IPRKA3 */ { SPU2, 0, FSI, FMSI } },
284 { 0xe695002c, 0, 16, 4, /* IPRLA3 */ { 0, 0, 0, MIPI_HSI } },
285 { 0xe6950030, 0, 16, 4, /* IPRMA3 */ { IPMMU_IPMMUD, 0,
Kuninori Morimotodeded432010-02-12 09:55:08 +0000286 CEC_1, CEC_2 } },
Magnus Damme4e430c2010-02-09 03:36:03 +0000287 { 0xe6950034, 0, 16, 4, /* IPRNA3 */ { AP_ARM2, 0, 0, 0 } },
288 { 0xe6950038, 0, 16, 4, /* IPROA3 */ { MFIS2, CPORTR2S,
289 CMT14, CMT15 } },
Kuninori Morimoto0fff9ec2010-04-13 06:16:25 +0000290 { 0xe695003c, 0, 16, 4, /* IPRPA3 */ { 0, 0,
Magnus Damme4e430c2010-02-09 03:36:03 +0000291 MMC_MMC_ERR, MMC_MMC_NOR } },
Kuninori Morimoto0fff9ec2010-04-13 06:16:25 +0000292 { 0xe6950040, 0, 16, 4, /* IPRQA3 */ { IIC4_ALI4, IIC4_TACKI4,
Magnus Damme4e430c2010-02-09 03:36:03 +0000293 IIC4_WAITI4, IIC4_DTEI4 } },
Kuninori Morimoto0fff9ec2010-04-13 06:16:25 +0000294 { 0xe6950044, 0, 16, 4, /* IPRRA3 */ { IIC3_ALI3, IIC3_TACKI3,
Magnus Damme4e430c2010-02-09 03:36:03 +0000295 IIC3_WAITI3, IIC3_DTEI3 } },
Kuninori Morimoto0fff9ec2010-04-13 06:16:25 +0000296 { 0xe6950048, 0, 16, 4, /* IPRSA3 */ { 0/*ERI*/, 0/*RXI*/,
Kuninori Morimotodeded432010-02-12 09:55:08 +0000297 0/*TXI*/, 0/*TEI*/} },
Kuninori Morimoto0fff9ec2010-04-13 06:16:25 +0000298 { 0xe695004c, 0, 16, 4, /* IPRTA3 */ { USB0_USB0I1, USB0_USB0I0,
Magnus Damme4e430c2010-02-09 03:36:03 +0000299 USB1_USB1I1, USB1_USB1I0 } },
Kuninori Morimoto0fff9ec2010-04-13 06:16:25 +0000300 { 0xe6950050, 0, 16, 4, /* IPRUA3 */ { USBHSDMAC1_USHDMI, 0, 0, 0 } },
Magnus Damme4e430c2010-02-09 03:36:03 +0000301};
302
Magnus Dammda5713e2011-10-12 16:21:34 +0900303static DECLARE_INTC_DESC(intca_desc, "sh7372-intca",
304 intca_vectors, intca_groups,
305 intca_mask_registers, intca_prio_registers,
306 NULL);
Magnus Damme4e430c2010-02-09 03:36:03 +0000307
Magnus Damm2ff65302012-03-28 19:23:03 +0900308INTC_IRQ_PINS_16(intca_irq_pins_lo, 0xe6900000,
309 INTC_VECT, "sh7372-intca-irq-lo");
310
311INTC_IRQ_PINS_16H(intca_irq_pins_hi, 0xe6900000,
312 INTC_VECT, "sh7372-intca-irq-hi");
313
Magnus Dammf4dd6182010-03-11 05:42:21 +0000314enum {
315 UNUSED_INTCS = 0,
Magnus Damma2bc19e2011-01-18 03:13:44 +0000316 ENABLED_INTCS,
Magnus Dammf4dd6182010-03-11 05:42:21 +0000317
318 INTCS,
319
320 /* interrupt sources INTCS */
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000321
322 /* IRQ0S - IRQ31S */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000323 VEU_VEU0, VEU_VEU1, VEU_VEU2, VEU_VEU3,
324 RTDMAC_1_DEI0, RTDMAC_1_DEI1, RTDMAC_1_DEI2, RTDMAC_1_DEI3,
325 CEU, BEU_BEU0, BEU_BEU1, BEU_BEU2,
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000326 /* MFI */
327 /* BBIF2 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000328 VPU,
329 TSIF1,
Magnus Damm4861da42011-08-10 05:45:30 +0000330 /* 3DG */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000331 _2DDMAC,
332 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2,
333 IPMMU_IPMMUR, IPMMU_IPMMUR2,
334 RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR,
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000335 /* KEYSC */
336 /* TTI20 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000337 MSIOF,
338 IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0,
339 TMU_TUNI0, TMU_TUNI1, TMU_TUNI2,
340 CMT0,
341 TSIF0,
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000342 /* CMT2 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000343 LMB,
344 CTI,
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000345 /* RWDT0 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000346 ICB,
347 JPU_JPEG,
348 LCDC,
349 LCRC,
350 RTDMAC2_1_DEI0, RTDMAC2_1_DEI1, RTDMAC2_1_DEI2, RTDMAC2_1_DEI3,
351 RTDMAC2_2_DEI4, RTDMAC2_2_DEI5, RTDMAC2_2_DADERR,
352 ISP,
353 LCDC1,
354 CSIRX,
355 DSITX_DSITX0,
356 DSITX_DSITX1,
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000357 /* SPU2 */
358 /* FSI */
359 /* FMSI */
360 /* HDMI */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000361 TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2,
362 CMT4,
363 DSITX1_DSITX1_0,
364 DSITX1_DSITX1_1,
Magnus Damma2bc19e2011-01-18 03:13:44 +0000365 MFIS2_INTCS, /* Priority always enabled using ENABLED_INTCS */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000366 CPORTS2R,
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000367 /* CEC */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000368 JPU6E,
369
370 /* interrupt groups INTCS */
371 RTDMAC_1, RTDMAC_2, VEU, BEU, IIC0, IPMMU, IIC2,
372 RTDMAC2_1, RTDMAC2_2, TMU1, DSITX,
373};
374
375static struct intc_vect intcs_vectors[] = {
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000376 /* IRQ0S - IRQ31S */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000377 INTCS_VECT(VEU_VEU0, 0x700), INTCS_VECT(VEU_VEU1, 0x720),
378 INTCS_VECT(VEU_VEU2, 0x740), INTCS_VECT(VEU_VEU3, 0x760),
379 INTCS_VECT(RTDMAC_1_DEI0, 0x800), INTCS_VECT(RTDMAC_1_DEI1, 0x820),
380 INTCS_VECT(RTDMAC_1_DEI2, 0x840), INTCS_VECT(RTDMAC_1_DEI3, 0x860),
381 INTCS_VECT(CEU, 0x880), INTCS_VECT(BEU_BEU0, 0x8a0),
382 INTCS_VECT(BEU_BEU1, 0x8c0), INTCS_VECT(BEU_BEU2, 0x8e0),
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000383 /* MFI */
384 /* BBIF2 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000385 INTCS_VECT(VPU, 0x980),
386 INTCS_VECT(TSIF1, 0x9a0),
Magnus Damm4861da42011-08-10 05:45:30 +0000387 /* 3DG */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000388 INTCS_VECT(_2DDMAC, 0xa00),
389 INTCS_VECT(IIC2_ALI2, 0xa80), INTCS_VECT(IIC2_TACKI2, 0xaa0),
390 INTCS_VECT(IIC2_WAITI2, 0xac0), INTCS_VECT(IIC2_DTEI2, 0xae0),
391 INTCS_VECT(IPMMU_IPMMUR, 0xb00), INTCS_VECT(IPMMU_IPMMUR2, 0xb20),
392 INTCS_VECT(RTDMAC_2_DEI4, 0xb80), INTCS_VECT(RTDMAC_2_DEI5, 0xba0),
393 INTCS_VECT(RTDMAC_2_DADERR, 0xbc0),
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000394 /* KEYSC */
395 /* TTI20 */
396 INTCS_VECT(MSIOF, 0x0d20),
Magnus Dammf4dd6182010-03-11 05:42:21 +0000397 INTCS_VECT(IIC0_ALI0, 0xe00), INTCS_VECT(IIC0_TACKI0, 0xe20),
398 INTCS_VECT(IIC0_WAITI0, 0xe40), INTCS_VECT(IIC0_DTEI0, 0xe60),
399 INTCS_VECT(TMU_TUNI0, 0xe80), INTCS_VECT(TMU_TUNI1, 0xea0),
400 INTCS_VECT(TMU_TUNI2, 0xec0),
401 INTCS_VECT(CMT0, 0xf00),
402 INTCS_VECT(TSIF0, 0xf20),
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000403 /* CMT2 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000404 INTCS_VECT(LMB, 0xf60),
405 INTCS_VECT(CTI, 0x400),
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000406 /* RWDT0 */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000407 INTCS_VECT(ICB, 0x480),
408 INTCS_VECT(JPU_JPEG, 0x560),
409 INTCS_VECT(LCDC, 0x580),
410 INTCS_VECT(LCRC, 0x5a0),
411 INTCS_VECT(RTDMAC2_1_DEI0, 0x1300), INTCS_VECT(RTDMAC2_1_DEI1, 0x1320),
412 INTCS_VECT(RTDMAC2_1_DEI2, 0x1340), INTCS_VECT(RTDMAC2_1_DEI3, 0x1360),
413 INTCS_VECT(RTDMAC2_2_DEI4, 0x1380), INTCS_VECT(RTDMAC2_2_DEI5, 0x13a0),
414 INTCS_VECT(RTDMAC2_2_DADERR, 0x13c0),
415 INTCS_VECT(ISP, 0x1720),
416 INTCS_VECT(LCDC1, 0x1780),
417 INTCS_VECT(CSIRX, 0x17a0),
418 INTCS_VECT(DSITX_DSITX0, 0x17c0),
419 INTCS_VECT(DSITX_DSITX1, 0x17e0),
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000420 /* SPU2 */
421 /* FSI */
422 /* FMSI */
423 /* HDMI */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000424 INTCS_VECT(TMU1_TUNI0, 0x1900), INTCS_VECT(TMU1_TUNI1, 0x1920),
425 INTCS_VECT(TMU1_TUNI2, 0x1940),
426 INTCS_VECT(CMT4, 0x1980),
427 INTCS_VECT(DSITX1_DSITX1_0, 0x19a0),
428 INTCS_VECT(DSITX1_DSITX1_1, 0x19c0),
Magnus Damma2bc19e2011-01-18 03:13:44 +0000429 INTCS_VECT(MFIS2_INTCS, 0x1a00),
Magnus Dammf4dd6182010-03-11 05:42:21 +0000430 INTCS_VECT(CPORTS2R, 0x1a20),
Kuninori Morimoto7923ac12010-09-03 05:36:43 +0000431 /* CEC */
Magnus Dammf4dd6182010-03-11 05:42:21 +0000432 INTCS_VECT(JPU6E, 0x1a80),
433
434 INTC_VECT(INTCS, 0xf80),
435};
436
437static struct intc_group intcs_groups[] __initdata = {
438 INTC_GROUP(RTDMAC_1, RTDMAC_1_DEI0, RTDMAC_1_DEI1,
439 RTDMAC_1_DEI2, RTDMAC_1_DEI3),
440 INTC_GROUP(RTDMAC_2, RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR),
441 INTC_GROUP(VEU, VEU_VEU0, VEU_VEU1, VEU_VEU2, VEU_VEU3),
442 INTC_GROUP(BEU, BEU_BEU0, BEU_BEU1, BEU_BEU2),
443 INTC_GROUP(IIC0, IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0),
444 INTC_GROUP(IPMMU, IPMMU_IPMMUR, IPMMU_IPMMUR2),
445 INTC_GROUP(IIC2, IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2),
446 INTC_GROUP(RTDMAC2_1, RTDMAC2_1_DEI0, RTDMAC2_1_DEI1,
447 RTDMAC2_1_DEI2, RTDMAC2_1_DEI3),
448 INTC_GROUP(RTDMAC2_2, RTDMAC2_2_DEI4,
449 RTDMAC2_2_DEI5, RTDMAC2_2_DADERR),
450 INTC_GROUP(TMU1, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0),
451 INTC_GROUP(DSITX, DSITX_DSITX0, DSITX_DSITX1),
452};
453
454static struct intc_mask_reg intcs_mask_registers[] = {
455 { 0xffd20184, 0xffd201c4, 8, /* IMR1SA / IMCR1SA */
456 { BEU_BEU2, BEU_BEU1, BEU_BEU0, CEU,
457 VEU_VEU3, VEU_VEU2, VEU_VEU1, VEU_VEU0 } },
458 { 0xffd20188, 0xffd201c8, 8, /* IMR2SA / IMCR2SA */
459 { 0, 0, 0, VPU,
460 0, 0, 0, 0 } },
461 { 0xffd2018c, 0xffd201cc, 8, /* IMR3SA / IMCR3SA */
462 { 0, 0, 0, _2DDMAC,
463 0, 0, 0, ICB } },
464 { 0xffd20190, 0xffd201d0, 8, /* IMR4SA / IMCR4SA */
465 { 0, 0, 0, CTI,
466 JPU_JPEG, 0, LCRC, LCDC } },
467 { 0xffd20194, 0xffd201d4, 8, /* IMR5SA / IMCR5SA */
468 { 0, RTDMAC_2_DADERR, RTDMAC_2_DEI5, RTDMAC_2_DEI4,
469 RTDMAC_1_DEI3, RTDMAC_1_DEI2, RTDMAC_1_DEI1, RTDMAC_1_DEI0 } },
470 { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */
471 { 0, 0, MSIOF, 0,
Magnus Damm4861da42011-08-10 05:45:30 +0000472 0, 0, 0, 0 } },
Magnus Dammf4dd6182010-03-11 05:42:21 +0000473 { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */
474 { 0, TMU_TUNI2, TMU_TUNI1, TMU_TUNI0,
475 0, 0, 0, 0 } },
476 { 0xffd201a4, 0xffd201e4, 8, /* IMR9SA / IMCR9SA */
477 { 0, 0, 0, CMT0,
478 IIC2_DTEI2, IIC2_WAITI2, IIC2_TACKI2, IIC2_ALI2 } },
479 { 0xffd201a8, 0xffd201e8, 8, /* IMR10SA / IMCR10SA */
480 { 0, 0, IPMMU_IPMMUR2, IPMMU_IPMMUR,
481 0, 0, 0, 0 } },
482 { 0xffd201ac, 0xffd201ec, 8, /* IMR11SA / IMCR11SA */
483 { IIC0_DTEI0, IIC0_WAITI0, IIC0_TACKI0, IIC0_ALI0,
484 0, TSIF1, LMB, TSIF0 } },
485 { 0xffd50180, 0xffd501c0, 8, /* IMR0SA3 / IMCR0SA3 */
486 { 0, RTDMAC2_2_DADERR, RTDMAC2_2_DEI5, RTDMAC2_2_DEI4,
487 RTDMAC2_1_DEI3, RTDMAC2_1_DEI2, RTDMAC2_1_DEI1, RTDMAC2_1_DEI0 } },
488 { 0xffd50190, 0xffd501d0, 8, /* IMR4SA3 / IMCR4SA3 */
489 { 0, ISP, 0, 0,
490 LCDC1, CSIRX, DSITX_DSITX0, DSITX_DSITX1 } },
491 { 0xffd50198, 0xffd501d8, 8, /* IMR6SA3 / IMCR6SA3 */
492 { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
493 CMT4, DSITX1_DSITX1_0, DSITX1_DSITX1_1, 0 } },
494 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */
Magnus Damma2bc19e2011-01-18 03:13:44 +0000495 { MFIS2_INTCS, CPORTS2R, 0, 0,
Magnus Dammf4dd6182010-03-11 05:42:21 +0000496 JPU6E, 0, 0, 0 } },
497 { 0xffd20104, 0, 16, /* INTAMASK */
498 { 0, 0, 0, 0, 0, 0, 0, 0,
499 0, 0, 0, 0, 0, 0, 0, INTCS } },
500};
501
502/* Priority is needed for INTCA to receive the INTCS interrupt */
503static struct intc_prio_reg intcs_prio_registers[] = {
504 { 0xffd20000, 0, 16, 4, /* IPRAS */ { CTI, 0, _2DDMAC, ICB } },
505 { 0xffd20004, 0, 16, 4, /* IPRBS */ { JPU_JPEG, LCDC, 0, LCRC } },
506 { 0xffd20010, 0, 16, 4, /* IPRES */ { RTDMAC_1, CEU, 0, VPU } },
507 { 0xffd20014, 0, 16, 4, /* IPRFS */ { 0, RTDMAC_2, 0, CMT0 } },
508 { 0xffd20018, 0, 16, 4, /* IPRGS */ { TMU_TUNI0, TMU_TUNI1,
509 TMU_TUNI2, TSIF1 } },
510 { 0xffd2001c, 0, 16, 4, /* IPRHS */ { 0, 0, VEU, BEU } },
511 { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF0, IIC0 } },
Magnus Dammf4dd6182010-03-11 05:42:21 +0000512 { 0xffd20028, 0, 16, 4, /* IPRKS */ { 0, 0, LMB, 0 } },
513 { 0xffd2002c, 0, 16, 4, /* IPRLS */ { IPMMU, 0, 0, 0 } },
514 { 0xffd20030, 0, 16, 4, /* IPRMS */ { IIC2, 0, 0, 0 } },
515 { 0xffd50000, 0, 16, 4, /* IPRAS3 */ { RTDMAC2_1, 0, 0, 0 } },
516 { 0xffd50004, 0, 16, 4, /* IPRBS3 */ { RTDMAC2_2, 0, 0, 0 } },
517 { 0xffd50020, 0, 16, 4, /* IPRIS3 */ { 0, ISP, 0, 0 } },
518 { 0xffd50024, 0, 16, 4, /* IPRJS3 */ { LCDC1, CSIRX, DSITX, 0 } },
519 { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, 0 } },
520 { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, DSITX1_DSITX1_0,
521 DSITX1_DSITX1_1, 0 } },
Magnus Damma2bc19e2011-01-18 03:13:44 +0000522 { 0xffd50038, 0, 16, 4, /* IPROS3 */ { ENABLED_INTCS, CPORTS2R,
523 0, 0 } },
Magnus Dammf4dd6182010-03-11 05:42:21 +0000524 { 0xffd5003c, 0, 16, 4, /* IPRPS3 */ { JPU6E, 0, 0, 0 } },
525};
526
527static struct resource intcs_resources[] __initdata = {
528 [0] = {
529 .start = 0xffd20000,
530 .end = 0xffd201ff,
531 .flags = IORESOURCE_MEM,
532 },
533 [1] = {
534 .start = 0xffd50000,
535 .end = 0xffd501ff,
536 .flags = IORESOURCE_MEM,
537 }
538};
539
540static struct intc_desc intcs_desc __initdata = {
541 .name = "sh7372-intcs",
Magnus Damma2bc19e2011-01-18 03:13:44 +0000542 .force_enable = ENABLED_INTCS,
Rafael J. Wysocki0f966d72011-12-23 01:23:30 +0100543 .skip_syscore_suspend = true,
Magnus Dammf4dd6182010-03-11 05:42:21 +0000544 .resource = intcs_resources,
545 .num_resources = ARRAY_SIZE(intcs_resources),
546 .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
547 intcs_prio_registers, NULL, NULL),
548};
549
550static void intcs_demux(unsigned int irq, struct irq_desc *desc)
551{
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100552 void __iomem *reg = (void *)irq_get_handler_data(irq);
Magnus Dammf4dd6182010-03-11 05:42:21 +0000553 unsigned int evtcodeas = ioread32(reg);
554
555 generic_handle_irq(intcs_evt2irq(evtcodeas));
556}
557
Magnus Damm382414b2011-10-19 23:52:50 +0200558static void __iomem *intcs_ffd2;
559static void __iomem *intcs_ffd5;
560
Magnus Damme4e430c2010-02-09 03:36:03 +0000561void __init sh7372_init_irq(void)
562{
Magnus Damm382414b2011-10-19 23:52:50 +0200563 void __iomem *intevtsa;
564
565 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE);
566 intevtsa = intcs_ffd2 + 0x100;
567 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE);
Magnus Dammf4dd6182010-03-11 05:42:21 +0000568
Magnus Damme4e430c2010-02-09 03:36:03 +0000569 register_intc_controller(&intca_desc);
Magnus Damm2ff65302012-03-28 19:23:03 +0900570 register_intc_controller(&intca_irq_pins_lo_desc);
571 register_intc_controller(&intca_irq_pins_hi_desc);
Magnus Dammf4dd6182010-03-11 05:42:21 +0000572 register_intc_controller(&intcs_desc);
573
574 /* demux using INTEVTSA */
Thomas Gleixner6845664a2011-03-24 13:25:22 +0100575 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa);
576 irq_set_chained_handler(evt2irq(0xf80), intcs_demux);
Magnus Damme4e430c2010-02-09 03:36:03 +0000577}
Magnus Damm382414b2011-10-19 23:52:50 +0200578
579static unsigned short ffd2[0x200];
580static unsigned short ffd5[0x100];
581
582void sh7372_intcs_suspend(void)
583{
584 int k;
585
586 for (k = 0x00; k <= 0x30; k += 4)
587 ffd2[k] = __raw_readw(intcs_ffd2 + k);
588
589 for (k = 0x80; k <= 0xb0; k += 4)
590 ffd2[k] = __raw_readb(intcs_ffd2 + k);
591
592 for (k = 0x180; k <= 0x188; k += 4)
593 ffd2[k] = __raw_readb(intcs_ffd2 + k);
594
595 for (k = 0x00; k <= 0x3c; k += 4)
596 ffd5[k] = __raw_readw(intcs_ffd5 + k);
597
598 for (k = 0x80; k <= 0x9c; k += 4)
599 ffd5[k] = __raw_readb(intcs_ffd5 + k);
600}
601
602void sh7372_intcs_resume(void)
603{
604 int k;
605
606 for (k = 0x00; k <= 0x30; k += 4)
607 __raw_writew(ffd2[k], intcs_ffd2 + k);
608
609 for (k = 0x80; k <= 0xb0; k += 4)
610 __raw_writeb(ffd2[k], intcs_ffd2 + k);
611
612 for (k = 0x180; k <= 0x188; k += 4)
613 __raw_writeb(ffd2[k], intcs_ffd2 + k);
614
615 for (k = 0x00; k <= 0x3c; k += 4)
616 __raw_writew(ffd5[k], intcs_ffd5 + k);
617
618 for (k = 0x80; k <= 0x9c; k += 4)
619 __raw_writeb(ffd5[k], intcs_ffd5 + k);
620}
Magnus Dammf7dadb32011-12-23 01:23:07 +0100621
622static unsigned short e694[0x200];
623static unsigned short e695[0x200];
624
625void sh7372_intca_suspend(void)
626{
627 int k;
628
629 for (k = 0x00; k <= 0x38; k += 4)
630 e694[k] = __raw_readw(0xe6940000 + k);
631
632 for (k = 0x80; k <= 0xb4; k += 4)
633 e694[k] = __raw_readb(0xe6940000 + k);
634
635 for (k = 0x180; k <= 0x1b4; k += 4)
636 e694[k] = __raw_readb(0xe6940000 + k);
637
638 for (k = 0x00; k <= 0x50; k += 4)
639 e695[k] = __raw_readw(0xe6950000 + k);
640
641 for (k = 0x80; k <= 0xa8; k += 4)
642 e695[k] = __raw_readb(0xe6950000 + k);
643
644 for (k = 0x180; k <= 0x1a8; k += 4)
645 e695[k] = __raw_readb(0xe6950000 + k);
646}
647
648void sh7372_intca_resume(void)
649{
650 int k;
651
652 for (k = 0x00; k <= 0x38; k += 4)
653 __raw_writew(e694[k], 0xe6940000 + k);
654
655 for (k = 0x80; k <= 0xb4; k += 4)
656 __raw_writeb(e694[k], 0xe6940000 + k);
657
658 for (k = 0x180; k <= 0x1b4; k += 4)
659 __raw_writeb(e694[k], 0xe6940000 + k);
660
661 for (k = 0x00; k <= 0x50; k += 4)
662 __raw_writew(e695[k], 0xe6950000 + k);
663
664 for (k = 0x80; k <= 0xa8; k += 4)
665 __raw_writeb(e695[k], 0xe6950000 + k);
666
667 for (k = 0x180; k <= 0x1a8; k += 4)
668 __raw_writeb(e695[k], 0xe6950000 + k);
669}