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