openpicreg.h revision 1.1 1 1.1 matt /*-
2 1.1 matt * Copyright (c) 2010 The NetBSD Foundation, Inc.
3 1.1 matt * All rights reserved.
4 1.1 matt *
5 1.1 matt * This code is derived from software contributed to The NetBSD Foundation
6 1.1 matt * by Matt Thomas of 3am Software Foundry.
7 1.1 matt *
8 1.1 matt * Redistribution and use in source and binary forms, with or without
9 1.1 matt * modification, are permitted provided that the following conditions
10 1.1 matt * are met:
11 1.1 matt * 1. Redistributions of source code must retain the above copyright
12 1.1 matt * notice, this list of conditions and the following disclaimer.
13 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 matt * notice, this list of conditions and the following disclaimer in the
15 1.1 matt * documentation and/or other materials provided with the distribution.
16 1.1 matt *
17 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 1.1 matt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 1.1 matt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 1.1 matt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 1.1 matt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 1.1 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 1.1 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 1.1 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 1.1 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 1.1 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 1.1 matt * POSSIBILITY OF SUCH DAMAGE.
28 1.1 matt */
29 1.1 matt
30 1.1 matt #ifndef _POWERPC_BOOKE_OPENPICREG_H_
31 1.1 matt #define _POWERPC_BOOKE_OPENPICREG_H_
32 1.1 matt
33 1.1 matt /*
34 1.1 matt * Common definition of VPR registers (IPIVPR, GTVPR, ...)
35 1.1 matt */
36 1.1 matt #define VPR_MSK 0x80000000 /* Mask */
37 1.1 matt #define VPR_A 0x40000000 /* Activity */
38 1.1 matt #define VPR_P 0x00800000 /* Polatity */
39 1.1 matt #define VPR_P_HIGH 0x00800000 /* Active High */
40 1.1 matt #define VPR_S 0x00400000 /* Sense */
41 1.1 matt #define VPR_S_LEVEL 0x00400000 /* Level Sensitive */
42 1.1 matt #define VPR_PRIORITY 0x000f0000 /* Priority */
43 1.1 matt #define VPR_PRIORITY_GET(n) (((n) >> 16) & 0x000f)
44 1.1 matt #define VPR_PRIORITY_MAKE(n) (((n) & 0x000f) << 16)
45 1.1 matt #define VPR_VECTOR 0x0000ffff /* Vector */
46 1.1 matt #define VPR_VECTOR_GET(n) (((n) >> 0) & 0xffff)
47 1.1 matt #define VPR_VECTOR_MAKE(n) (((n) & 0xffff) << 0)
48 1.1 matt
49 1.1 matt #define VPR_LEVEL_LOW (VPR_S_LEVEL)
50 1.1 matt #define VPR_LEVEL_HIGH (VPR_S_LEVEL | VPR_P_HIGH)
51 1.1 matt
52 1.1 matt /*
53 1.1 matt * Common definition of DR registers (IPIVPR, GTVPR, ...)
54 1.1 matt */
55 1.1 matt #define DR_EP 0x80000000 /* external signal */
56 1.1 matt #define DR_CI(n) (1 << (30 - (n))) /* critical intr cpu n */
57 1.1 matt #define DR_P(n) (1 << (n)) /* intr cpu n */
58 1.1 matt
59 1.1 matt
60 1.1 matt #define OPENPIC_BRR1 0x0000 /* Block Revision 1 */
61 1.1 matt #define BRR1_IPID(n) (((n) >> 16) & 0xffff)
62 1.1 matt #define BRR1_IPMJ(n) (((n) >> 8) & 0x00ff)
63 1.1 matt #define BRR1_IPMN(n) (((n) >> 0) & 0x00ff)
64 1.1 matt #define OPENPIC_BRR2 0x0010 /* Block Revision 2 */
65 1.1 matt #define BRR2_IPINT0(n) (((n) >> 16) & 0xff)
66 1.1 matt #define BRR2_IPCFG0(n) (((n) >> 0) & 0xff)
67 1.1 matt
68 1.1 matt #define OPENPIC_IPIDR(n) (0x0040 + 0x10 * (n))
69 1.1 matt
70 1.1 matt #define OPENPIC_CTPR 0x0080
71 1.1 matt #define OPENPIC_WHOAMI 0x0090
72 1.1 matt #define OPENPIC_IACK 0x00a0
73 1.1 matt #define OPENPIC_EOI 0x00b0
74 1.1 matt
75 1.1 matt #define OPENPIC_FRR 0x1000 /* Feature Reporting */
76 1.1 matt #define FRR_NIRQ(n) (((n) >> 16) & 0x7ff) /* intr sources - 1 */
77 1.1 matt #define FRR_NCPU(n) (((n) >> 8) & 0x01f) /* cpus - 1 */
78 1.1 matt #define FRR_VID(n) (((n) >> 0) & 0x0ff) /* version id */
79 1.1 matt #define OPENPIC_GCR 0x1020 /* Global Configuration */
80 1.1 matt #define GCR_RST 0x80000000 /* Reset */
81 1.1 matt #define GCR_M 0x20000000 /* Mixed Mode */
82 1.1 matt #define OPENPIC_VIR 0x1080 /* Vendor Identification */
83 1.1 matt #define OPENPIC_PIR 0x1090 /* Processor Initialization */
84 1.1 matt
85 1.1 matt #define OPENPIC_IPIVPR(n) (0x10a0 + 0x10 * (n))
86 1.1 matt #define OPENPIC_SVR 0x10e0
87 1.1 matt #define SVR_VECTOR 0x0000ffff /* Vector */
88 1.1 matt #define SVR_VECTOR_GET(n) (((n) >> 0) & 0xffff)
89 1.1 matt #define SVR_VECTOR_MAKE(n) (((n) & 0xffff) << 0)
90 1.1 matt
91 1.1 matt #define OPENPIC_TFRR 0x10f0
92 1.1 matt #define OPENPIC_GTCCR(n) (0x1100 + 0x40 * (n))
93 1.1 matt #define GTCCR_TOG 0x80000000
94 1.1 matt #define GTCCR_COUNT 0x7fffffff
95 1.1 matt #define OPENPIC_GTBCR(n) (0x1110 + 0x40 * (n))
96 1.1 matt #define GTBCR_CI 0x80000000 /* Count Inhibit */
97 1.1 matt #define GTBCR_BASECNT 0x7fffffff /* Base Count */
98 1.1 matt #define OPENPIC_GTVPR(n) (0x1120 + 0x40 * (n))
99 1.1 matt #define OPENPIC_GTDR(n) (0x1130 + 0x40 * (n))
100 1.1 matt #define OPENPIC_TCR 0x1300
101 1.1 matt #define TCR_ROVR(n) (1 << (24 + (n))) /* timer n rollover */
102 1.1 matt #define TCR_RTM 0x00010000 /* real time source */
103 1.1 matt #define TCR_CLKR 0x00000300 /* clock ratio */
104 1.1 matt #define TCR_CLKR_64 0x00000300 /* divide by .. */
105 1.1 matt #define TCR_CLKR_32 0x00000200 /* divide by .. */
106 1.1 matt #define TCR_CLKR_16 0x00000100 /* divide by .. */
107 1.1 matt #define TCR_CLKR_8 0x00000000 /* divide by .. */
108 1.1 matt #define TCR_CASC 0x00000007 /* cascase timers */
109 1.1 matt #define TCR_CASC_0123 0x00000007
110 1.1 matt #define TCR_CASC_123 0x00000006
111 1.1 matt #define TCR_CASC_01_23 0x00000005
112 1.1 matt #define TCR_CASC_23 0x00000004
113 1.1 matt #define TCR_CASC_012 0x00000003
114 1.1 matt #define TCR_CASC_12 0x00000002
115 1.1 matt #define TCR_CASC_01 0x00000001
116 1.1 matt #define TCR_CASC_OFF 0x00000000
117 1.1 matt
118 1.1 matt #define OPENPIC_ERQSR 0x1308 /* ext. intr summary */
119 1.1 matt #define ERQSR_A(n) (1 << (31 - (n))) /* intr <n> active */
120 1.1 matt #define OPENPIC_IRQSR0 0x1310 /* irq out summary 0 */
121 1.1 matt #define IRSR0_MSI_A(n) (1 << (31 - (n))) /* msg sig intr <n> */
122 1.1 matt #define IRSR0_MSG_A(n) (1 << (20 - ((n) ^ 4))) /* shared msg intr */
123 1.1 matt #define IRSR0_EXT_A(n) (1 << (11 - (n))) /* ext int <n> active */
124 1.1 matt #define OPENPIC_IRQSR1 0x1320 /* irq out summary 1 */
125 1.1 matt #define IRQSR1_A(n) (1 << (31 - ((n) - 0))) /* intr <n> active */
126 1.1 matt #define OPENPIC_IRQSR2 0x1324 /* irq out summary 2 */
127 1.1 matt #define IRQSR2_A(n) (1 << (31 - ((n) - 32))) /* intr <n> active */
128 1.1 matt #define OPENPIC_CISR0 0x1330
129 1.1 matt #define OPENPIC_CISR1 0x1340
130 1.1 matt #define CISR1_A(n) (1 << (31 - ((n) - 0))) /* intr <n> active */
131 1.1 matt #define OPENPIC_CISR2 0x1344
132 1.1 matt #define CISR2_A(n) (1 << (31 - ((n) - 32))) /* intr <n> active */
133 1.1 matt
134 1.1 matt /*
135 1.1 matt * Performance Monitor Mask Registers
136 1.1 matt */
137 1.1 matt #define OPENPIC_PMMR0(n) (0x1350 + 0x20 * (n))
138 1.1 matt #define PMMR0_MShl(n) (1 << (31 - (n)))
139 1.1 matt #define PMMR0_IPI(n) (1 << (24 - (n)))
140 1.1 matt #define PMMR0_TIMER(n) (1 << (20 - (n)))
141 1.1 matt #define PMMR0_MSG(n) (1 << (16 - ((n) & 7)))
142 1.1 matt #define PMMR0_EXT(n) (1 << (12 - (n)))
143 1.1 matt #define OPENPIC_PMMR1(n) (0x1360 + 0x20 * (n))
144 1.1 matt #define PMMR1_INT(n) (1 << (31 - ((n) - 0))) /* intr <n> active */
145 1.1 matt #define OPENPIC_PMMR2(n) (0x1364 + 0x20 * (n))
146 1.1 matt #define PMMR2_INT(n) (1 << (31 - ((n) - 32))) /* intr <n> active */
147 1.1 matt
148 1.1 matt /*
149 1.1 matt * Message Registers
150 1.1 matt */
151 1.1 matt #define OPENPIC_MSGR(cpu, n) (0x1400 + 0x1000 * (cpu) + 0x10 * (n))
152 1.1 matt #define OPENPIC_MER(cpu (0x1500 + 0x1000 * (cpu))
153 1.1 matt #defien MER_MSG(n) (1 << (n))
154 1.1 matt #define OPENPIC_MSR(cpu) (0x1510 + 0x1000 * (cpu))
155 1.1 matt #defien MSR_MSG(n) (1 << (n))
156 1.1 matt
157 1.1 matt #define OPENPIC_MSIR(n) (0x1600 + 0x10 * (n))
158 1.1 matt #define OPENPIC_MSISR 0x1720
159 1.1 matt #defien MSIR_SR(n) (1 << (n))
160 1.1 matt #define OPENPIC_MSIIR 0x1740
161 1.1 matt #define MSIIR_BIT(srs, ibs) (((srs) << 29) | ((ibs) << 24))
162 1.1 matt
163 1.1 matt /*
164 1.1 matt * Interrupt Source Configuration Registers
165 1.1 matt */
166 1.1 matt #define OPENPIC_EIVPR(n) (0x10000 + 0x20 * (n))
167 1.1 matt #define OPENPIC_EIDR(n) (0x10010 + 0x20 * (n))
168 1.1 matt #define OPENPIC_IIVPR(n) (0x10200 + 0x20 * (n))
169 1.1 matt #define OPENPIC_IIDR(n) (0x10210 + 0x20 * (n))
170 1.1 matt #define OPENPIC_MIVPR(n) (0x11600 + 0x20 * (n))
171 1.1 matt #define OPENPIC_MIDR(n) (0x11610 + 0x20 * (n))
172 1.1 matt #define OPENPIC_MSIVPR(n) (0x11c00 + 0x20 * (n))
173 1.1 matt #define OPENPIC_MSIDR(n) (0x11c10 + 0x20 * (n))
174 1.1 matt
175 1.1 matt #define MPC8548_EXTERNALSOURCES 12
176 1.1 matt #define MPC8548_INTERNALSOURCES 48
177 1.1 matt #define MPC8548_INTERNALBITMAP { 0x9effffff, 0x000000f3 }
178 1.1 matt #define MPC8548_IPISOURCES 4
179 1.1 matt #define MPC8548_TIMERSOURCES 4
180 1.1 matt #define MPC8548_MISOURCES 4
181 1.1 matt #define MPC8548_MSISOURCES 8
182 1.1 matt #define MPC8548_NCPUS 1
183 1.1 matt #define MPC8548_SOURCES \
184 1.1 matt (MPC8548_EXTERNALSOURCES \
185 1.1 matt + MPC8548_INTERNALSOURCES \
186 1.1 matt + MPC8548_MSISOURCES \
187 1.1 matt + MPC8548_NCPUS*(MPC8548_IPISOURCES \
188 1.1 matt + MPC8548_TIMERSOURCES \
189 1.1 matt + MPC8548_MISOURCES))
190 1.1 matt
191 1.1 matt #define MPC8572_EXTERNALSOURCES 12
192 1.1 matt #define MPC8572_INTERNALSOURCES 64
193 1.1 matt #define MPC8572_INTERNALBITMAP { 0xdeffffff, 0xf8ff93f3 }
194 1.1 matt #define MPC8572_IPISOURCES 4
195 1.1 matt #define MPC8572_TIMERSOURCES 4
196 1.1 matt #define MPC8572_MISOURCES 4
197 1.1 matt #define MPC8572_MSISOURCES 8
198 1.1 matt #define MPC8572_SOURCES \
199 1.1 matt (MPC8572_EXTERNALSOURCES \
200 1.1 matt + MPC8572_INTERNALSOURCES \
201 1.1 matt + MPC8572_MSISOURCES \
202 1.1 matt + MPC8572_NCPUS*(MPC8572_IPISOURCES \
203 1.1 matt + MPC8572_TIMERSOURCES \
204 1.1 matt + MPC8572_MISOURCES))
205 1.1 matt
206 1.1 matt /*
207 1.1 matt * Per-CPU Registers
208 1.1 matt */
209 1.1 matt #define OPENPIC_IPIDRn(cpu, n) (0x20040 + 0x1000 * (cpu) + 0x10 * (n))
210 1.1 matt #define OPENPIC_CTPRn(cpu) (0x20080 + 0x1000 * (cpu))
211 1.1 matt #define OPENPIC_WHOAMIn(cpu) (0x20090 + 0x1000 * (cpu))
212 1.1 matt #define OPENPIC_IACKn(cpu) (0x200a0 + 0x1000 * (cpu))
213 1.1 matt #define OPENPIC_EOIn(cpu) (0x200b0 + 0x1000 * (cpu))
214 1.1 matt
215 1.1 matt #define ISOURCE_L2 0
216 1.1 matt #define ISOURCE_ECM 1
217 1.1 matt #define ISOURCE_DRAM 2
218 1.1 matt #define ISOURCE_LBC 3
219 1.1 matt #define ISOURCE_DMA_CHAN1 4
220 1.1 matt #define ISOURCE_DMA_CHAN2 5
221 1.1 matt #define ISOURCE_DMA_CHAN3 6
222 1.1 matt #define ISOURCE_DMA_CHAN4 7
223 1.1 matt #define ISOURCE_PCIEX_P3 8 /* MPC8572 */
224 1.1 matt #define ISOURCE_PCIEX_P2 9 /* MPC8572 */
225 1.1 matt #define ISOURCE_PCI1 8 /* MPC8548 */
226 1.1 matt #define ISOURCE_PCI2 9 /* MPC8548 */
227 1.1 matt #define ISOURCE_PCIEX 10
228 1.1 matt #define ISOURCE_11 11
229 1.1 matt #define ISOURCE_12 12
230 1.1 matt #define ISOURCE_ETSEC1_TX 13
231 1.1 matt #define ISOURCE_ETSEC1_RX 14
232 1.1 matt #define ISOURCE_ETSEC3_TX 15
233 1.1 matt #define ISOURCE_ETSEC3_RX 16
234 1.1 matt #define ISOURCE_ETSEC3_ERR 17
235 1.1 matt #define ISOURCE_ETSEC1_ERR 18
236 1.1 matt #define ISOURCE_ETSEC2_TX 19
237 1.1 matt #define ISOURCE_ETSEC2_RX 20
238 1.1 matt #define ISOURCE_ETSEC4_TX 21
239 1.1 matt #define ISOURCE_ETSEC4_RX 22
240 1.1 matt #define ISOURCE_ETSEC4_ERR 23
241 1.1 matt #define ISOURCE_ETSEC2_ERR 24
242 1.1 matt #define ISOURCE_FEC 25 /* MPC8572 */
243 1.1 matt #define ISOURCE_DUART 26
244 1.1 matt #define ISOURCE_I2C 27
245 1.1 matt #define ISOURCE_PERFMON 28
246 1.1 matt #define ISOURCE_SECURITY1 29
247 1.1 matt #define ISOURCE_30 30
248 1.1 matt #define ISOURCE_MPC8572_GPIO 31 /* MPC8572 */
249 1.1 matt #define ISOURCE_SRIO_EWPU 32
250 1.1 matt #define ISOURCE_SRIO_ODBELL 33
251 1.1 matt #define ISOURCE_SRIO_IDBELL 34
252 1.1 matt #define ISOURCE_35 35
253 1.1 matt #define ISOURCE_36 36
254 1.1 matt #define ISOURCE_SRIO_OMU1 37
255 1.1 matt #define ISOURCE_SRIO_IMU1 38
256 1.1 matt #define ISOURCE_SRIO_OMU2 39
257 1.1 matt #define ISOURCE_SRIO_IMU2 40
258 1.1 matt #define ISOURCE_PME_GENERAL 41 /* MPC8572 */
259 1.1 matt #define ISOURCE_SECURITY2 42 /* MPC8572 */
260 1.1 matt #define ISOURCE_43 43
261 1.1 matt #define ISOURCE_44 44
262 1.1 matt #define ISOURCE_TLU1 45 /* MPC8572 */
263 1.1 matt #define ISOURCE_46 46
264 1.1 matt #define ISOURCE_47 47
265 1.1 matt #define ISOURCE_PME_CHAN1 48 /* MPC8572 */
266 1.1 matt #define ISOURCE_PME_CHAN2 49 /* MPC8572 */
267 1.1 matt #define ISOURCE_PME_CHAN3 50 /* MPC8572 */
268 1.1 matt #define ISOURCE_PME_CHAN4 51 /* MPC8572 */
269 1.1 matt #define ISOURCE_ETSEC1_PTP 52 /* MPC8572 */
270 1.1 matt #define ISOURCE_ETSEC2_PTP 53 /* MPC8572 */
271 1.1 matt #define ISOURCE_ETSEC3_PTP 54 /* MPC8572 */
272 1.1 matt #define ISOURCE_ETSEC4_PTP 55 /* MPC8572 */
273 1.1 matt #define ISOURCE_56 56
274 1.1 matt #define ISOURCE_57 57
275 1.1 matt #define ISOURCE_58 58
276 1.1 matt #define ISOURCE_TLU2 59 /* MPC8572 */
277 1.1 matt #define ISOURCE_DMA2_CHAN1 60 /* MPC8572 */
278 1.1 matt #define ISOURCE_DMA2_CHAN2 61 /* MPC8572 */
279 1.1 matt #define ISOURCE_DMA2_CHAN3 62 /* MPC8572 */
280 1.1 matt #define ISOURCE_DMA2_CHAN4 63 /* MPC8572 */
281 1.1 matt
282 1.1 matt #endif /* _POWERPC_BOOKE_OPENPICREG_H_ */
283