Home | History | Annotate | Line # | Download | only in booke
e500reg.h revision 1.6
      1 /*	$NetBSD: e500reg.h,v 1.6 2011/05/02 01:47:26 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 #include <sys/cdefs.h>
     38 
     39 #ifdef _LOCORE
     40 #define	__PPCBIT(n)	(1 << (31 - (n)))
     41 #define	__PPCBITS(m, n)	(((1 << ((n) - (m) + 1)) - 1) << (31 - (m)))
     42 #else
     43 #define	__PPCBIT(n)	__BIT(31-(n))
     44 #define	__PPCBITS(m,n)	__BITS(31-(n),31-(m))
     45 #endif
     46 
     47 #define	GUR_SIZE		0x100000
     48 
     49 #define	DDRC1_BASE		0x02000
     50 #define	DDRC2_BASE		0x06000
     51 #define	DDRC_SIZE		0x01000
     52 
     53 #ifdef DDRC_PRIVATE
     54 #define	CS_BNDS(n)		(0x000 + 0x008 * (n))
     55 #define	BNDS_SA			__PPCBITS(4,15)
     56 #define	BNDS_SA_GET(n)		(((n) & BNDS_SA) << 8)
     57 #define	BNDS_EA			__PPCBITS(20,31)
     58 #define	BNDS_EA_GET(n)		(((n) & BNDS_EA) << 24)
     59 #define	BNDS_SIZE_GET(n)	\
     60 	((((((n) & BNDS_EA) + __LOWEST_SET_BIT(BNDS_EA)) << 16) - (((n) & BNDS_SA))) << 8)
     61 #define	CS_CONFIG(n)		(0x080 + 0x004 * (n))
     62 #define CS_CONFIG_EN		__PPCBIT(0)
     63 #endif /* DDRC_PRIVATE */
     64 
     65 #define	GPIO_BASE		0x0fc00
     66 #define	GPIO_SIZE		0x00020
     67 
     68 #ifdef GPIO_PRIVATE
     69 
     70 #define GPDIR			0x00 /* GPIO direction register */
     71 #define GPODR			0x04 /* GPIO open drain register */
     72 #define GPDAT			0x08 /* GPIO data register */
     73 #define GPIER			0x0C /* GPIO interrupt event register */
     74 #define GPIMR			0x10 /* GPIO interrupt mask register */
     75 #define GPICR			0x14 /* GPIO external interrupt control register */
     76 
     77 #endif /* GPIO_PRIVATE */
     78 
     79 #define	PCIE1_BASE		0x0a000
     80 #define	PCIE2_MPC8572_BASE	0x09000	/* P2020 too */
     81 #define	PCIE3_MPC8572_BASE	0x08000	/* P2020 too */
     82 #define	PCIX1_MPC8548_BASE	0x08000
     83 #define	PCIX2_MPC8548_BASE	0x09000
     84 #define	PCIE2_MPC8544_BASE	0x09000	/* MPC8536 too */
     85 #define	PCIE3_MPC8544_BASE	0x0b000	/* MPC8536 too */
     86 #define	PCIX1_MPC8544_BASE	0x08000	/* MPC8536 too */
     87 #define	PCI_SIZE		0x01000
     88 
     89 #ifdef PCI_PRIVATE
     90 
     91 /* PCI Express Configuration Access Registers */
     92 #define PEX_CONFIG_ADDR		0x000 /* PCI Express configuration address register */
     93 #define	PCI_CONFIG_ADDR		PEX_CONFIG_ADDR
     94 #define	PEX_CONFIG_ADDR_EN	__PPCBIT(0)
     95 #define	PEX_CONFIG_ADDR_TAG(b,d,f,r) (((b) << 16) | ((d) << 11) | ((f) << 8) | (r))
     96 #define PEX_CONFIG_DATA		0x004 /* PCI Express configuration data register */
     97 #define	PCI_CONFIG_DATA		PEX_CONFIG_DATA
     98 #define	PCI_INT_ACK		0x008 /* PCI Interrupt Acknowledge */
     99 #define PEX_OTB_CPL_TOR		0x00C /* PCI Express outbound completion timeout register */
    100 #define PEX_CONF_RTY_TOR	0x010 /* PCI Express configuration retry timeout register */
    101 #define PEX_CONFIG		0x014 /* PCI Express configuration register  */
    102 
    103 /* PCI Express Power Management Event & Message Registers */
    104 #define PEX_PME_MES_DR		0x020 /* PCI Express PME & message detect register */
    105 #define PEX_PME_MES_DISR	0x024 /* PCI Express PME & message disable register */
    106 #define PEX_PME_MES_IER		0x028 /* PCI Express PME & message interrupt enable register */
    107 #define PEX_PMCR		0x02C /* PCI Express power management command register */
    108 
    109 /* PCI Express IP Block Revision Registers */
    110 #define PEX_IP_BLK_REV1		0xBF8 /* IP block revision register 1 */
    111 #define PEX_IP_BLK_REV2		0xBFC /* IP block revision register 2 */
    112 
    113 /* PCI Express / PCI-X ATMU Registers */
    114 #define	PEXOWAR_EN		__PPCBIT(0) /* enable window */
    115 #define	PEXOWAR_ROE		__PPCBIT(3) /* relaxed ordering enable */
    116 #define	PEXOWAR_NS		__PPCBIT(4) /* no snoop enable */
    117 #define	PEXOWAR_TC		__PPCBITS(8,10) /* traffic class PCIEX only */
    118 #define	PEXOWAR_TC0		__SHIFTIN(0, PEXOWAR_TC)
    119 #define	PEXOWAR_TC1		__SHIFTIN(1, PEXOWAR_TC)
    120 #define	PEXOWAR_TC2		__SHIFTIN(2, PEXOWAR_TC)
    121 #define	PEXOWAR_TC3		__SHIFTIN(3, PEXOWAR_TC)
    122 #define	PEXOWAR_TC4		__SHIFTIN(4, PEXOWAR_TC)
    123 #define	PEXOWAR_TC5		__SHIFTIN(5, PEXOWAR_TC)
    124 #define	PEXOWAR_TC6		__SHIFTIN(6, PEXOWAR_TC)
    125 #define	PEXOWAR_TC7		__SHIFTIN(7, PEXOWAR_TC)
    126 #define	PEXOWAR_RTT		__PPCBITS(12,15) /* read transaction type */
    127 #define	PEXOWAR_RTT_CONF	__SHIFTIN(2, PEXOWAR_RTT) /* PCIEX only */
    128 #define	PEXOWAR_RTT_MEM		__SHIFTIN(4, PEXOWAR_RTT)
    129 #define	PEXOWAR_RTT_IO		__SHIFTIN(8, PEXOWAR_RTT)
    130 #define	PEXOWAR_WTT		__PPCBITS(16,19) /* write transaction type */
    131 #define	PEXOWAR_WTT_CONF	__SHIFTIN(2, PEXOWAR_WTT) /* PCIEX only */
    132 #define	PEXOWAR_WTT_MEM		__SHIFTIN(4, PEXOWAR_WTT)
    133 #define	PEXOWAR_WTT_IO		__SHIFTIN(8, PEXOWAR_WTT)
    134 #define	PEXOWAR_OWS		__PPCBITS(26,31) /* encoded as 2^(N+1) bytes */
    135 
    136 /* PCI Express / PCI-X ATMU Registers */
    137 #define	PEXIWAR_EN		__PPCBIT(0) /* enable window */
    138 #define	PEXIWAR_PF		__PPCBIT(3) /* prefetchable */
    139 #define	PEXIWAR_TRGT		__PPCBITS(8,11) /* traffic class PCIEX only */
    140 #define	PEXIWAR_TRGT_PCI1	__SHIFTIN(0, PEXIWAR_TRGT)
    141 #define	PEXIWAR_TRGT_PCI2	__SHIFTIN(1, PEXIWAR_TRGT)
    142 #define	PEXIWAR_TRGT_PCIEX	__SHIFTIN(2, PEXIWAR_TRGT)
    143 #define	PEXIWAR_TRGT_SRIO	__SHIFTIN(12, PEXIWAR_TRGT)
    144 #define	PEXIWAR_TRGT_LOCALMEM	__SHIFTIN(15, PEXIWAR_TRGT)
    145 #define	PEXIWAR_RTT		__PPCBITS(12,15) /* read transaction type */
    146 #define	PEXIWAR_RTT_MEM		__SHIFTIN(4, PEXIWAR_RTT)
    147 #define	PEXIWAR_RTT_MEM_NOSNOOP	__SHIFTIN(4, PEXIWAR_RTT)
    148 #define	PEXIWAR_RTT_MEM_SNOOP	__SHIFTIN(5, PEXIWAR_RTT)
    149 #define	PEXIWAR_RTT_MEM_ULCKL2	__SHIFTIN(7, PEXIWAR_RTT)
    150 #define	PEXIWAR_WTT		__PPCBITS(16,19) /* write transaction type */
    151 #define	PEXIWAR_WTT_MEM_NOSNOOP	__SHIFTIN(4, PEXIWAR_WTT)
    152 #define	PEXIWAR_WTT_MEM_SNOOP	__SHIFTIN(5, PEXIWAR_WTT)
    153 #define	PEXIWAR_WTT_MEM_ALLOL2	__SHIFTIN(6, PEXIWAR_WTT)
    154 #define	PEXIWAR_WTT_MEM_ALCKL2	__SHIFTIN(7, PEXIWAR_WTT)
    155 #define	PEXIWAR_IWS		__PPCBITS(26,31) /* encoded as 2^(N+1) bytes */
    156 #define	PEXIWAR_IWS_GET(n)	__SHIFTOUT((n), PEXIWAR_IWS)
    157 
    158 /* Outbound Window 0 (Default) */
    159 #define PEXOTAR0		0xC00 /* PCI Express outbound translation address register 0 (default) */
    160 #define PEXOTEAR0		0xC04 /* PCI Express outbound translation extended address register 0 (default) */
    161 #define PEXOWAR0		0xC10 /* PCI Express outbound window attributes register 0 (default) */
    162 
    163 /* Outbound Window 1 */
    164 #define PEXOTAR1		0xC20 /* PCI Express outbound translation address register 1 */
    165 #define PEXOTEAR1		0xC24 /* PCI Express outbound translation extended address register 1 */
    166 #define PEXOWBAR1		0xC28 /* PCI Express outbound window base address register 1 */
    167 #define PEXOWAR1		0xC30 /* PCI Express outbound window attributes register 1 */
    168 
    169 /* Outbound Window 2 */
    170 #define PEXOTAR2		0xC40 /* PCI Express outbound translation address register 2 */
    171 #define PEXOTEAR2		0xC44 /* PCI Express outbound translation extended address register 2 */
    172 #define PEXOWBAR2		0xC48 /* PCI Express outbound window base address register 2 */
    173 #define PEXOWAR2		0xC50 /* PCI Express outbound window attributes register 2 */
    174 
    175 /* Outbound Window 3 */
    176 #define PEXOTAR3		0xC60 /* PCI Express outbound translation address register 3 */
    177 #define PEXOTEAR3		0xC64 /* PCI Express outbound translation extended address register 3 */
    178 #define PEXOWBAR3		0xC68 /* PCI Express outbound window base address register 3 */
    179 #define PEXOWAR3		0xC70 /* PCI Express outbound window attributes register 3 */
    180 
    181 /* Outbound Window 4 */
    182 #define PEXOTAR4		0xC80 /* PCI Express outbound translation address register 4 */
    183 #define PEXOTEAR4		0xC84 /* PCI Express outbound translation extended address register 4 */
    184 #define PEXOWBAR4		0xC88 /* PCI Express outbound window base address register 4 */
    185 #define PEXOWAR4		0xC90 /* PCI Express outbound window attributes register 4 */
    186 
    187 /* Inbound Window 3 */
    188 #define PEXITAR3		0xDA0 /* PCI Express inbound translation address register 3 */
    189 #define PEXIWBAR3		0xDA8 /* PCI Express inbound window base address register 3 */
    190 #define PEXIWBEAR3		0xDAC /* PCI Express inbound window base extended address register 3 */
    191 #define PEXIWAR3		0xDB0 /* PCI Express inbound window attributes register 3 */
    192 
    193 /* Inbound Window 2 */
    194 #define PEXITAR2		0xDC0 /* PCI Express inbound translation address register 2 */
    195 #define PEXIWBAR2		0xDC8 /* PCI Express inbound window base address register 2 */
    196 #define PEXIWBEAR2		0xDCC /* PCI Express inbound window base extended address register 2 */
    197 #define PEXIWAR2		0xDD0 /* PCI Express inbound window attributes register 2 */
    198 
    199 /* Inbound Window 1 */
    200 #define PEXITAR1		0xDE0 /* PCI Express inbound translation address register 1 */
    201 #define PEXIWBAR1		0xDE8 /* PCI Express inbound window base address register 1 */
    202 #define PEXIWAR1		0xDF0 /* PCI Express inbound window attributes register 1 */
    203 
    204 /* PCI Express Error Management Registers */
    205 #define PEX_ERR_DR		0xE00 /* PCI Express error detect register */
    206 #define	PEXERRDR_ICCA		__PPCBIT(14)
    207 #define PEX_ERR_EN		0xE08 /* PCI Express error interrupt enable register */
    208 #define PEX_ERR_DISR		0xE10 /* PCI Express error disable register */
    209 #define PEX_ERR_CAP_STAT	0xE20 /* PCI Express error capture status register */
    210 #define PEX_ERR_CAP_R0		0xE28 /* PCI Express error capture register 0 */
    211 #define PEX_ERR_CAP_R1		0xE2C /* PCI Express error capture register 1 */
    212 #define PEX_ERR_CAP_R2		0xE30 /* PCI Express error capture register 2 */
    213 #define PEX_ERR_CAP_R3		0xE34 /* PCI Express error capture register 3 */
    214 
    215 /* PCI Express Private Configuration Space */
    216 
    217 #define PEX_LTSSM		0x404
    218 #define	LTSSM_L0		16
    219 
    220 #define	PCI_PBFR		0x44	/* Bus Function Register */
    221 #define	PBFR_PAH		__BIT(0)
    222 
    223 #endif /* PCI_PRIVATE */
    224 
    225 #define	OPENPIC_BASE		0x40000
    226 #define	OPENPIC_SIZE		0x40000
    227 
    228 #define	L2CACHE_BASE		0x20000
    229 #define	L2CACHE_SIZE		0x01000
    230 
    231 #ifdef L2CACHE_PRIVATE
    232 #define	L2CTL			0x000
    233 #define	L2CTL_L2E		__PPCBIT(0)
    234 #define	L2CTL_L2I		__PPCBIT(1)
    235 #define	L2CTL_L2SIZ		__PPCBITS(2,3)
    236 #define	L2CTL_L2SIZ_GET(x)	(1 << (17 + __SHIFTOUT((x), L2CTL_L2SIZ)))
    237 #define	L2CTL_L2DO		__PPCBIT(9)
    238 #define	L2CTL_L2IO		__PPCBIT(10)
    239 #define	L2CTL_L2INTDIS		__PPCBIT(12)
    240 #define	L2CTL_L2SRAM		__PPCBITS(13,15)
    241 #define	L2CTL_L2LO		__PPCBIT(18)
    242 #define	L2CTL_L2SLC		__PPCBIT(19)
    243 #define	L2CTL_L2LFR		__PPCBIT(21)
    244 #define	L2CTL_L2LFRID		__PPCBITS(22,23)
    245 #define	L2CTL_L2STASHDIS	__PPCBIT(28)
    246 #define	L2CTL_L2STASH		__PPCBITS(30,31)
    247 
    248 #endif /* L2CACHE_PRIVATE */
    249 
    250 #define	I2C1_BASE		0x3000
    251 #define	I2C2_BASE		0x3100
    252 #define	I2C_SIZE		0x0100
    253 
    254 #ifdef I2C_PRIVATE
    255 #define	I2CADR		0x000	/* i2c address register */
    256 #define	I2CFDR		0x004	/* i2c frequency divider register */
    257 #define	I2CCR		0x008	/* i2c control register */
    258 #define	I2CSR		0x00c	/* i2c status register */
    259 #define	I2CDR		0x010	/* i2c data register */
    260 #define	I2CDFSSR	0x014	/* i2c address register */
    261 #endif /* I2C_PRIVATE */
    262 
    263 #define	DUART1_BASE	0x4500
    264 #define	DUART2_BASE	0x4600
    265 #define	DUART_SIZE	0x0100
    266 
    267 #define	SPI_BASE	0x7000	/* MPC8536 */
    268 #define	SPI_SIZE	0x1000
    269 
    270 #define	SATA1_BASE	0x18000	/* MPC8536 */
    271 #define	SATA2_BASE	0x19000	/* MPC8536 */
    272 #define	SATA_SIZE	0x01000
    273 
    274 #define	USB1_BASE	0x22100	/* MPC8536 */
    275 #define	USB2_BASE	0x23100	/* MPC8536 */
    276 #define	USB3_BASE	0x2b100	/* MPC8536 */
    277 #define	USB_SIZE	0x00f00
    278 
    279 #define	USB_SNOOP1	0x400
    280 #define	USB_SNOOP2	0x404
    281 
    282 #define	SNOOP_2GB	0x1e
    283 
    284 #define	ETSEC1_BASE	0x24000
    285 #define	ETSEC2_BASE	0x25000
    286 #define	ETSEC3_BASE	0x26000
    287 #define	ETSEC4_BASE	0x27000
    288 #define	ETSEC_SIZE	0x01000
    289 
    290 #define	ESDHC_BASE	0x2e000
    291 #define	ESDHC_SIZE	0x01000
    292 
    293 #define	GLOBAL_BASE	0xe0000
    294 #define	GLOBAL_SIZE	0x01000
    295 
    296 #ifdef GLOBAL_PRIVATE
    297 
    298 /* Power-On Reset Configuration Values */
    299 #define PORPLLSR	0x000 /* POR PLL ratio status register */
    300 #define	E500_RATIO2	__PPCBITS(2,7)
    301 #define	E500_RATIO2_GET(n) __SHIFTOUT(n, E500_RATIO2)
    302 #define	E500_RATIO	__PPCBITS(10,15)
    303 #define	E500_RATIO_GET(n) __SHIFTOUT(n, E500_RATIO)
    304 #define	PCI1_CLK_SEL	__PPCBIT(16)
    305 #define	PCI2_CLK_SEL	__PPCBIT(17)
    306 #define	PLAT_RATIO	__PPCBITS(26,30)
    307 #define	PLAT_RATIO_GET(n) __SHIFTOUT(n, PLAT_RATIO)
    308 #define PORBMSR		0x004 /* POR boot mode status register */
    309 #define	PORBMSR_BCFG	__PPCBITS(0,1)
    310 #define	PORBMSR_HA	__PPCBITS(13,15)
    311 #define	PORBMSR_HA_GET(n) __SHIFTOUT(m, PORBMSR_HA)
    312 #define	PORBMSR_HA_PEXSRIO_AGENT	0 /* PCI Express & SRIO agent mode */
    313 #define	PORBMSR_HA_SRIO_AGENT		1 /* SRIO agent mode */
    314 #define	PORBMSR_HA_PEX_AGENT		2 /* PCI Express agent mode */
    315 #define	PORBMSR_HA_PEXPCI_AGENT2	3 /* PCI[-X] & PCI Express agent mode */
    316 #define	PORBMSR_HA_PCISRIO_AGENT2	4 /* PCI[-X] & SRIO mode */
    317 #define	PORBMSR_HA_SRIO_AGENT2		5 /* SRIO agent mode */
    318 #define	PORBMSR_HA_PCI_AGENT2		6 /* PCI[-X] agent mode */
    319 #define	PORBMSR_HA_HOST			7 /* Host mode */
    320 #define PORIMPSCR	0x008 /* POR I/O impedance status and control register */
    321 #define PORDEVSR	0x00C /* POR I/O device status register */
    322 #define	PORDEVSR_ECW1		__PPCBIT(0)
    323 #define	PORDEVSR_ECW2		__PPCBIT(1)
    324 #define	PORDEVSR_SGMII1_DIS1	__PPCBIT(2)
    325 #define	PORDEVSR_SGMII1_DIS2	__PPCBIT(3)
    326 #define	PORDEVSR_SGMII1_DIS3	__PPCBIT(4)
    327 #define	PORDEVSR_SGMII1_DIS4	__PPCBIT(5)
    328 #define	PORDEVSR_ECP1		__PPCBITS(6,7)
    329 #define	PORDEVSR_PCI1		__PPCBIT(8)
    330 #define	PCI1_PCIX		0
    331 #define	PCI1_PCI1		1
    332 #define	PORDEVSR_IOSEL		__PPCBITS(9,12)
    333 #define	IOSEL_MPC8536_OFF		0x01
    334 #define	IOSEL_MPC8536_PCIE1_X4		0x02
    335 #define	IOSEL_MPC8536_PCIE1_X8		0x03
    336 #define	IOSEL_MPC8536_PCIE12_X4		0x05
    337 #define	IOSEL_MPC8536_PCIE1_X4_PCI23_X2	0x07
    338 #define	IOSEL_MPC8544_OFF		0x00
    339 #define	IOSEL_MPC8544_SGMII_ON		0x01
    340 #define	IOSEL_MPC8544_PCIE1_ON		0x02
    341 #define	IOSEL_MPC8544_PCIE1_SGMII_ON	0x03
    342 #define	IOSEL_MPC8544_PCIE12_ON		0x04
    343 #define	IOSEL_MPC8544_PCIE12_SGMII_ON	0x05
    344 #define	IOSEL_MPC8544_PCIE123_ON	0x06
    345 #define	IOSEL_MPC8544_PCIE123_SGMII_ON	0x07
    346 #define	IOSEL_MPC8548_SRIO2500_PCIE1_X4	3
    347 #define	IOSEL_MPC8548_SRIO1250_PCIE1_X4	4
    348 #define	IOSEL_MPC8548_SRIO3125		5
    349 #define	IOSEL_MPC8548_SRIO1250		6
    350 #define	IOSEL_MPC8548_PCIE1_X8		7
    351 #define IOSEL_MPC8572_PCIE1_X4		2
    352 #define IOSEL_MPC8572_PCIE12_X4		3
    353 #define IOSEL_MPC8572_SRIO2500		6
    354 #define IOSEL_MPC8572_PCIE1_X4_23_X2	7
    355 #define	IOSEL_MPC8572_SRIO2500_PCIE1_X4	11
    356 #define	IOSEL_MPC8572_SRIO1250_PCIE1_X4	12
    357 #define	IOSEL_MPC8572_SRIO3125		13
    358 #define	IOSEL_MPC8572_SRIO1250		14
    359 #define	IOSEL_MPC8572_PCIE1_X8		15
    360 #define	IOSEL_P20x0_PCIE1_X1		0
    361 #define	IOSEL_P20x0_PCIE12_X1_3_X2	2
    362 #define	IOSEL_P20x0_PCIE13_X2		4
    363 #define	IOSEL_P20x0_PCIE1_X4		6
    364 #define	IOSEL_P20x0_PCIE1_X1_SRIO2500_1X	13
    365 #define	IOSEL_P20x0_PCIE12_X1_SGMII23	14
    366 #define	IOSEL_P20x0_PCIE1_X2_SGMII23	15
    367 #define	PORDEVSR_PCI2_ARB	__PPCBIT(13)
    368 #define	PORDEVSR_PCI1_ARB	__PPCBIT(14)
    369 #define	PORDEVSR_PCI32		__PPCBIT(15)
    370 #define	PCI32_FALSE		0
    371 #define	PCI32_TRUE		1
    372 #define	PORDEVSR_PCI1_SPD	__PPCBIT(16)
    373 #define	PORDEVSR_PCI2_SPD	__PPCBIT(17)
    374 #define	PORDEVSR_SYS_SPD	__PPCBIT(17)	/* MPC8536 */
    375 #define	PORDEVSR_CORE_SPD	__PPCBIT(18)	/* MPC8536 */
    376 #define	PORDEVSR_ECP2		__PPCBITS(18,19)
    377 #define	PORDEVSR_ECP3		__PPCBITS(20,21)
    378 #define	PORDEVSR_ECP4		__PPCBITS(22,23)
    379 #define	PORDEVSR_FEC_DIS	__PPCBIT(24)
    380 #define	PORDEVSR_RTPE		__PPCBIT(25)
    381 #define	PORDEVSR_RIO_CTLS	__PPCBIT(28)
    382 #define	PORDEVSR_DEV_ID		__PPCBITs(29,31)
    383 #define PORDBGMSR	0x010 /* POR debug mode status register */
    384 #define PORDEVSR2	0x014 /* POR I/O device status register 2 */
    385 #define GPPORCR		0x020 /* General-purpose POR configuration register */
    386 
    387 /* Signal Multiplexing and GPIO Controls */
    388 #define GPIOCR		0x030 /* GPIO control register */
    389 #define	GPIOCR_TX2	__PPCBIT(6)	/* Enable TSEC2_TX[7:0] as GP output */
    390 #define	GPIOCR_RX2	__PPCBIT(7)	/* Enable TSEC2_RX[7:0] as GP input */
    391 #define	GPIOCR_PCIOUT	__PPCBIT(14)	/* Enable PCI2_AD[15:8] as GP output */
    392 #define	GPIOCR_PCIIN	__PPCBIT(15)	/* Enable PCI2_AD[7:0] as GP input */
    393 #define	GPIOCR_GPOUT	__PPCBIT(22)	/* Enable GPOUT[24:31] as GP output */
    394 #define GPOUTDR		0x040 /* General-purpose output data register */
    395 #define GPOUTDR_TX2	0x040 /* General-purpose output data register */
    396 #define GPOUTDR_PCI	0x041 /* General-purpose output data register */
    397 #define GPOUTDR_GPOUT	0x043 /* General-purpose output data register */
    398 #define GPINDR		0x050 /* General-purpose input data register */
    399 #define	GPINDR_RX2	0x059
    400 #define	GPINDR_PCI	0x051
    401 
    402 #define PMUXCR		0x060 /* Alternate function signal multiplex control */
    403 #define	PMUXCR_SD_DATA	__PPCBIT(0)
    404 #define	PMUXCR_SDHC_CD	__PPCBIT(1)
    405 #define	PMUXCR_SDHC_WP	__PPCBIT(2)
    406 #define	PMUXCR_PCI_REQGNT3 __PPCBIT(3)
    407 #define	PMUXCR_TSEC1_TS __PPCBIT(3)
    408 #define	PMUXCR_PCI_REQGNT4 __PPCBIT(4)
    409 #define	PMUXCR_TSEC2_TS __PPCBIT(4)
    410 #define	PMUXCR_USB1	__PPCBIT(5)
    411 #define	PMUXCR_TSEC3_TS __PPCBIT(5)
    412 #define	PMUXCR_USB2	__PPCBIT(6)
    413 #define	PMUXCR_USB	 __PPCBIT(6)
    414 #define	PMUXCR_DMA0	__PPCBIT(14)
    415 #define	PMUXCR_DMA2	__PPCBIT(15)
    416 #define	PMUXCR_DMA1	__PPCBIT(30)
    417 #define	PMUXCR_DMA3	__PPCBIT(31)
    418 
    419 /* Device Disables */
    420 #define DEVDISR		0x070 /* Device disable control */
    421 #define	DEVDISR_PCI1	__PPCBIT(0)
    422 #define	DEVDISR_PCI2	__PPCBIT(1)
    423 #define	DEVDISR_PCIE	__PPCBIT(2)
    424 #define	DEVDISR_LBC	__PPCBIT(4)
    425 #define	DEVDISR_PCIE2	__PPCBIT(5)
    426 #define	DEVDISR_PCIE3	__PPCBIT(6)
    427 #define	DEVDISR_SEC	__PPCBIT(7)
    428 #define	DEVDISR_PME	__PPCBIT(8)
    429 #define	DEVDISR_USB1	__PPCBIT(8)	/* MPC8536 */
    430 #define	DEVDISR_TLU1	__PPCBIT(9)
    431 #define	DEVDISR_USB2	__PPCBIT(9)	/* MPC8536 */
    432 #define	DEVDISR_TLU2	__PPCBIT(10)
    433 #define	DEVDISR_ESDHC_10 __PPCBIT(10)
    434 #define	DEVDISR_USB3	__PPCBIT(10)	/* MPC8536 */
    435 #define	DEVDISR_L2	__PPCBIT(11)	/* MPC8536 */
    436 #define	DEVDISR_SRIO	__PPCBIT(12)
    437 #define	DEVDISR_ESDHC_12 __PPCBIT(12)	/* MPC8536 */
    438 #define	DEVDISR_RMSG	__PPCBIT(13)
    439 #define	DEVDISR_SATA1	__PPCBIT(13)	/* MPC8536 */
    440 #define	DEVDISR_DDR2_14	__PPCBIT(14)
    441 #define	DEVDISR_DDR_15	__PPCBIT(15)
    442 #define	DEVDISR_SPI_15	__PPCBIT(15)	/* MPC8536 */
    443 #define	DEVDISR_E500	__PPCBIT(16)
    444 #define	DEVDISR_DDR_16	__PPCBIT(16)	/* MPC8536 */
    445 #define	DEVDISR_TB	__PPCBIT(17)
    446 #define	DEVDISR_E500_1	__PPCBIT(18)
    447 #define	DEVDISR_TB_1	__PPCBIT(19)
    448 #define	DEVDISR_SATA2	__PPCBIT(20)	/* MPC8536 */
    449 #define	DEVDISR_DMA	__PPCBIT(21)
    450 #define	DEVDISR_DMA2	__PPCBIT(22)
    451 #define	DEVDISR_SRDS2	__PPCBIT(22)	/* MPC8536 */
    452 #define	DEVDISR_TSEC1	__PPCBIT(24)
    453 #define	DEVDISR_TSEC2	__PPCBIT(25)
    454 #define	DEVDISR_TSEC3	__PPCBIT(26)
    455 #define	DEVDISR_TSEC4	__PPCBIT(27)
    456 #define	DEVDISR_FEC	__PPCBIT(28)
    457 #define	DEVDISR_SPI_28	__PPCBIT(28)	/* P2020 */
    458 #define	DEVDISR_I2C	__PPCBIT(29)
    459 #define	DEVDISR_DUART	__PPCBIT(30)
    460 #define	DEVDISR_SRDS1	__PPCBIT(31)	/* MPC8536 */
    461 
    462 /* Power Management Registers */
    463 #define POWMGTCSR	0x080 /* Power management status and control register */
    464 
    465 /* Interrupt and Reset Status and Control */
    466 #define MCPSUMR		0x090 /* Machine check summary register */
    467 #define RSTRSCR		0x094 /* Reset request status and control register */
    468 
    469 /* Version Registers */
    470 #define PVR		0x0A0 /* Processor version register */
    471 #define SVR		0x0A4 /* System version register */
    472 
    473 /* Status Registers */
    474 #define RSTCR		0x0B0 /* Reset control register */
    475 #define	HRESET_REQ	__PPCBIT(30) /* hardware reset request */
    476 #define LBCVSELCR	0x0C0 /* LBC voltage select control register */
    477 #define DDRCSR		0xB20 /* DDR calibration status register */
    478 #define DDRCDR		0xB24 /* DDR control driver register */
    479 #define DDRCLKDR	0xB28 /* DDR clock disable register */
    480 
    481 /* Debug Control */
    482 #define CLKOCR		0xE00 /* Clock out control register */
    483 #define SRDSCR0		0xF04 /* LSerDes control register 0 */
    484 #define SRDSCR1		0xF08 /* LSerDes control register 1 */
    485 #define TSEC12IOOVCR	0xF28 /* eTSEC 1 & 2 overdrive control register */
    486 #define TSEC34IOOVCR	0xF2C /* eTSEC 3 & 4 overdrive control register */
    487 #endif /* GLOBAL_PRIVATE */
    488 
    489 #define	LBC_BASE	0x5000
    490 #define	LBC_SIZE	0x0fff
    491 
    492 #ifdef LBC_PRIVATE
    493 
    494 #define	BR_BA		__PPCBITS(0,16)
    495 #define	BR_XBA		__PPCBITS(17,18)
    496 #define	BR_PS		__PPCBITS(19,20)
    497 #define	BR_PS_8BIT	__SHIFTIN(1,BR_PS)
    498 #define	BR_PS_16BIT	__SHIFTIN(2,BR_PS)
    499 #define	BR_PS_32BIT	__SHIFTIN(3,BR_PS)
    500 #define	BR_DECC		__PPCBITS(21,22)
    501 #define	BR_DECC_NONE	__SHIFTIN(0,BR_DECC)
    502 #define	BR_DECC_PARITY	__SHIFTIN(1,BR_DECC)
    503 #define	BR_DECC_RMWPAR	__SHIFTIN(2,BR_DECC)
    504 #define	BR_WP		__PPCBIT(23)
    505 #define	BR_MSEL		__PPCBITS(24,26)
    506 #define	BR_MSEL_GPCM	__SHIFTIN(0,BR_MSEL)
    507 #define	BR_MSEL_FCM	__SHIFTIN(1,BR_MSEL)
    508 #define	BR_MSEL_SDRAM	__SHIFTIN(3,BR_MSEL)
    509 #define	BR_MSEL_UPMA	__SHIFTIN(4,BR_MSEL)
    510 #define	BR_MSEL_UPMB	__SHIFTIN(5,BR_MSEL)
    511 #define	BR_MSEL_UPMC	__SHIFTIN(6,BR_MSEL)
    512 #define	BR_ATOM		__PPCBITS(28,29)
    513 #define	BR_ATOM_NONE	__SHIFTIN(0,BR_ATOM)
    514 #define	BR_ATOM_RAWA	__SHIFTIN(1,BR_ATOM)
    515 #define	BR_ATOM_WARA	__SHIFTIN(2,BR_ATOM)
    516 #define	BR_V		__PPCBIT(31)
    517 
    518 #define	OR_AM		__PPCBITS(0,16)
    519 #define	OR_XAM		__PPCBITS(17,18)
    520 #define	OR_BCTLD	__PPCBIT(19)
    521 #define	OR_CSNT		__PPCBIT(20)
    522 #define	OR_ACS		__PPCBITS(21,22)
    523 #define	OR_XACS		__PPCBIT(23)
    524 #define	OR_SCY		__PPCBITS(24,27)
    525 #define	OR_SETA		__PPCBIT(28)
    526 #define	OR_TRLX		__PPCBIT(29)
    527 #define	OR_EHTR		__PPCBIT(30)
    528 #define	OR_EAD		__PPCBIT(31)
    529 
    530 #define	BRn(n)		(BR0 + 8*(n))
    531 #define	ORn(n)		(OR0 + 8*(n))
    532 #define BR0		0x000 /* Base register 0 */
    533 #define OR0		0x004 /* Options register 0 */
    534 #define BR1		0x008 /* Base register 1 */
    535 #define OR1		0x00C /* Options register 1 */
    536 #define BR2		0x010 /* Base register 2 */
    537 #define OR2		0x014 /* Options register 2 */
    538 #define BR3		0x018 /* Base register 3 */
    539 #define OR3		0x01C /* Options register 3 */
    540 #define BR4		0x020 /* Base register 4 */
    541 #define OR4		0x024 /* Options register 4 */
    542 #define BR5		0x028 /* Base register 5 */
    543 #define OR5		0x02C /* Options register 5 */
    544 #define BR6		0x030 /* Base register 6 */
    545 #define OR6		0x034 /* Options register 6 */
    546 #define BR7		0x038 /* Base register 7 */
    547 #define OR7		0x03C /* Options register 7 */
    548 #define MAR		0x068 /* UPM address register */
    549 #define MAMR		0x070 /* UPMA mode register */
    550 #define MBMR		0x074 /* UPMB mode register */
    551 #define MCMR		0x078 /* UPMC mode register */
    552 #define MRTPR		0x084 /* Memory refresh timer prescaler register */
    553 #define MDR		0x088 /* UPM/FCM data register */
    554 #define	MDR_AS3		__PPCBITS(0,7)
    555 #define	MDR_AS2		__PPCBITS(8,15)
    556 #define	MDR_AS1		__PPCBITS(16,23)
    557 #define	MDR_AS0		__PPCBITS(24,31)
    558 #define LSDMR		0x094 /* SDRAM mode register */
    559 #define LURT		0x0A0 /* UPM refresh timer */
    560 #define LSRT		0x0A4 /* SDRAM refresh timer */
    561 #define LTESR		0x0B0 /* Transfer error status register */
    562 #define	LTESR_BM	__PPCBIT(0)
    563 #define	LTESR_FCT	__PPCBIT(1)
    564 #define	LTESR_PAR	__PPCBIT(2)
    565 #define	LTESR_WP	__PPCBIT(5)
    566 #define	LTESR_ATMW	__PPCBIT(8)
    567 #define	LTESR_ATMR	__PPCBIT(9)
    568 #define	LTESR_CS	__PPCBIT(12)
    569 #define	LTESR_UCC	__PPCBIT(30)
    570 #define	LTESR_CC	__PPCBIT(31)
    571 #define LTEDR		0x0B4 /* Transfer error disable register */
    572 #define	LTEDR_BMD	__PPCBIT(0)
    573 #define	LTEDR_FCTD	__PPCBIT(1)
    574 #define	LTEDR_PARD	__PPCBIT(2)
    575 #define	LTEDR_WPD	__PPCBIT(5)
    576 #define	LTEDR_WARA	__PPCBIT(8)
    577 #define	LTEDR_RAWA	__PPCBIT(9)
    578 #define	LTEDR_CSD	__PPCBIT(12)
    579 #define	LTEDR_UCCD	__PPCBIT(30)
    580 #define	LTEDR_CCD	__PPCBIT(31)
    581 #define LTEIR		0x0B8 /* Transfer error interrupt register */
    582 #define	LTEIR_BMI	__PPCBIT(0)
    583 #define	LTEIR_FCTI	__PPCBIT(1)
    584 #define	LTEIR_PARI	__PPCBIT(2)
    585 #define	LTEIR_WPI	__PPCBIT(5)
    586 #define	LTEIR_WARA	__PPCBIT(8)
    587 #define	LTEIR_RAWA	__PPCBIT(9)
    588 #define	LTEIR_CSI	__PPCBIT(12)
    589 #define	LTEIR_UCCI	__PPCBIT(30)
    590 #define	LTEIR_CCI	__PPCBIT(31)
    591 #define LTEATR		0x0BC /* Transfer error attributes register */
    592 #define	LTEATR_RWB	__PPCBIT(3)
    593 #define	LTEATR_SRCID	__PPCBITS(11,15)
    594 #define	LTEATR_PB	__PPCBITS(16,19)
    595 #define	LTEATR_BNK	__PPCBITS(20,27)
    596 #define	LTEATR_V	__PPCBIT(31)
    597 #define LTEAR		0x0C0 /* Transfer error address register */
    598 #define	LTECCR		0x0C4 /* Transfer error ECC register */
    599 #define	LTECCR_SBCE	__PPCBITS(12,15)
    600 #define	LTECCR_MBUE	__PPCBITS(28,31)
    601 #define LBCR		0x0D0 /* Configuration register */
    602 #define LCRR		0x0D4 /* Clock ratio register */
    603 
    604 #define	FMR		0x0E0 /* Flash Mode Register */
    605 #define	FMR_CWTO	__PPCBITS(16,19)
    606 #define	FMR_BOOT	__PPCBIT(20)
    607 #define	FMR_ECCM	__PPCBIT(23)
    608 #define	FMR_AL		__PPCBITS(26,27)
    609 #define	FMR_OP		__PPCBITS(30,31)
    610 #define	FIR		0x0E4 /* Flash Instruction Register */
    611 #define	FIR_OP0		__PPCBITS(0,3)
    612 #define	FIR_OP1		__PPCBITS(4,7)
    613 #define	FIR_OP2		__PPCBITS(8,11)
    614 #define	FIR_OP3		__PPCBITS(12,15)
    615 #define	FIR_OP4		__PPCBITS(16,19)
    616 #define	FIR_OP5		__PPCBITS(20,23)
    617 #define	FIR_OP6		__PPCBITS(24,27)
    618 #define	FIR_OP7		__PPCBITS(28,31)
    619 #define	FIR_OP_NOP	0
    620 #define	FIR_OP_CA	1	/* Issue current column address */
    621 #define	FIR_OP_PA	2	/* Issue current block+page address */
    622 #define	FIR_OP_UA	3	/* Issue user-defined address byte */
    623 #define	FIR_OP_CM0	4	/* Issue command from FCR[CMD0] */
    624 #define	FIR_OP_CM1	5	/* Issue command from FCR[CMD1] */
    625 #define	FIR_OP_CM2	6	/* Issue command from FCR[CMD2] */
    626 #define	FIR_OP_CM3	7	/* Issue command from FCR[CMD3] */
    627 #define	FIR_OP_WB	8	/* Write FBCR bytes of data */
    628 #define	FIR_OP_WS	9	/* Write one byte of data from MDR */
    629 #define	FIR_OP_RB	10	/* Read FBCR bytes of data */
    630 #define	FIR_OP_RS	11	/* Read one byte of data into MDR */
    631 #define	FIR_OP_CW0	12	/* Wait for LFRB then FCR[CMD0] */
    632 #define	FIR_OP_CW1	13	/* Wait for LFRB then FCR[CMD1] */
    633 #define	FIR_OP_RBW	14	/* Wait for LFRB then read FBCR bytes */
    634 #define	FIR_OP_RSW	15	/* Wait for LFRB then byte into MDR */
    635 #define	FCR		0xE8 /* Flash Command Register */
    636 #define	FCR_CMD0	__PPCBITS(0,7)
    637 #define	FCR_CMD1	__PPCBITS(8,15)
    638 #define	FCR_CMD2	__PPCBITS(16,23)
    639 #define	FCR_CMD3	__PPCBITS(24,31)
    640 #define	FBAR		0xEC /* Flash Block Address Register */
    641 #define	FBAR_BLK	__PPCBITS(8,31)
    642 #define	FPAR		0xF0 /* Flash Page Address Register */
    643 #define	FPAR_S_PI	__PPCBITS(17,21)	/* Page Index */
    644 #define	FPAR_S_MS	__PPCBIT(22)		/* Main(0)/Spare(1) */
    645 #define	FPAR_S_CI	__PPCBITS(23,31)	/* Column Index */
    646 #define	FPAR_L_PI	__PPCBITS(14,19)	/* Page Index */
    647 #define	FPAR_L_MS	__PPCBIT(20)		/* Main(0)/Spare(1) */
    648 #define	FPAR_L_CI	__PPCBITS(21,31)	/* Column Index */
    649 #define	FBCR		0xF4 /* Flash Byte Count Register */
    650 #define	FBCR_BC		__PPCBITS(20,31)
    651 #define	FECC0		0x100
    652 #define	FECC_V		__PPCBIT(0)
    653 #define	FECC_ECC	__PPCBIT(8,31)
    654 #define	FECC1		0x104
    655 #define	FECC2		0x108
    656 #define	FECC3		0x10C
    657 
    658 #define MXMR_RFEN	__PPCBIT(1)	/* Refresh enable */
    659 #define MXMR_OP		__PPCBITS(2,3)	/* Command opcode */
    660 #define	MXMR_OP_NORMAL	__SHIFTIN(0, MXMR_OP)	/* Normal Operation */
    661 #define	MXMR_OP_WRITE	__SHIFTIN(1, MXMR_OP)	/* Write to UPM memory */
    662 #define	MXMR_OP_READ	__SHIFTIN(2, MXMR_OP)	/* Read from UPM memory */
    663 #define	MXMR_OP_RUN	__SHIFTIN(3, MXMR_OP)	/* Run Pattern */
    664 #define MXMR_UWPL	__PPCBIT(3)	/* LUPWAIT is active low */
    665 #define MXMR_AM		__PPCBITS(5,7)	/* Address multiplex size */
    666 #define MXMR_DS		__PPCBITS(8,9)	/* Disable timer period */
    667 #define	MXMR_DS_1CYCLE	__SHIFTIN(0,MXMR_DS)
    668 #define	MXMR_DS_2CYCLE	__SHIFTIN(1,MXMR_DS)
    669 #define	MXMR_DS_3CYCLE	__SHIFTIN(2,MXMR_DS)
    670 #define	MXMR_DS_4CYCLE	__SHIFTIN(3,MXMR_DS)
    671 #define MXMR_G0CL	__PPCBITS(10,12)	/* General line 0 control */
    672 #define	MXMR_G0CL_A12	__SHIFTIN(0,MXMR_G0CL)
    673 #define	MXMR_G0CL_A11	__SHIFTIN(1,MXMR_G0CL)
    674 #define	MXMR_G0CL_A10	__SHIFTIN(2,MXMR_G0CL)
    675 #define	MXMR_G0CL_A9	__SHIFTIN(3,MXMR_G0CL)
    676 #define	MXMR_G0CL_A8	__SHIFTIN(4,MXMR_G0CL)
    677 #define	MXMR_G0CL_A7	__SHIFTIN(5,MXMR_G0CL)
    678 #define	MXMR_G0CL_A6	__SHIFTIN(6,MXMR_G0CL)
    679 #define	MXMR_G0CL_A5	__SHIFTIN(7,MXMR_G0CL)
    680 #define MXMR_GPL4	__PPCBIT(13)	/* LGPL4 output line disable */
    681 #define MXMR_RLF	__PPCBITS(14,17)	/* Read loop field */
    682 #define MXMR_WLF	__PPCBITS(18,21)	/* Write loop field */
    683 #define MXMR_TLF	__PPCBITS(22,25)	/* Refresh loop field */
    684 #define MXMR_MAS	__PPCBITS(26,31)	/* Machine Address */
    685 
    686 #define	MRTPR_PTP	__PPCBITS(0,7)		/* Refresh timers prescaler */
    687 
    688 #endif /* LBC_PRIVATE */
    689