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