xref: /netbsd-src/sys/arch/mips/rmi/rmixlreg.h (revision 7991f5a7b8fc83a3d55dc2a1767cca3b84103969)
1 /*	$NetBSD: rmixlreg.h,v 1.5 2021/07/24 21:31:33 andvar Exp $	*/
2 
3 /*-
4  * Copyright (c) 2009 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Cliff Neighbors
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 
33 #ifndef _MIPS_RMI_RMIXLREGS_H_
34 #define _MIPS_RMI_RMIXLREGS_H_
35 
36 #include <sys/endian.h>
37 
38 /*
39  * on chip I/O register byte order is
40  * BIG ENDIAN regardless of code model
41  */
42 #define RMIXL_IOREG_VADDR(o)				\
43 	(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(	\
44 		rmixl_configuration.rc_io_pbase	+ (o))
45 #define RMIXL_IOREG_READ(o)     be32toh(*RMIXL_IOREG_VADDR(o))
46 #define RMIXL_IOREG_WRITE(o,v)  *RMIXL_IOREG_VADDR(o) = htobe32(v)
47 
48 
49 /*
50  * RMIXL Coprocessor 2 registers:
51  */
52 #ifdef _LOCORE
53 #define _(n)    __CONCAT($,n)
54 #else
55 #define _(n)    n
56 #endif
57 /*
58  * Note CP2 FMN register scope or "context"
59  *	L   : Local		: per thread register
60  *	G   : Global       	: per FMN Station (per core) register
61  *	L/G : "partly global"	: ???
62  * Global regs should be managed by a single thread
63  * (see XLS PRM "Coprocessor 2 Register Summary")
64  */
65 					/*		context ---------------+	*/
66 					/*		#sels --------------+  |	*/
67 					/*		#regs -----------+  |  |	*/
68 					/* What:	#bits --+	 |  |  |	*/
69 					/*			v	 v  v  v	*/
70 #define RMIXL_COP_2_TXBUF	_(0)	/* Transmit Buffers	64	[1][4] L	*/
71 #define RMIXL_COP_2_RXBUF	_(1)	/* Receive Buffers	64	[1][4] L	*/
72 #define RMIXL_COP_2_MSG_STS	_(2)	/* Message Status	32	[1][2] L/G	*/
73 #define RMIXL_COP_2_MSG_CFG	_(3)	/* Message Config	32	[1][2] G	*/
74 #define RMIXL_COP_2_MSG_BSZ	_(4)	/* Message Bucket Size	32	[1][8] G	*/
75 #define RMIXL_COP_2_CREDITS	_(16)	/* Credit Counters	 8     [16][8] G	*/
76 
77 /*
78  * MsgStatus: RMIXL_COP_2_MSG_STS (CP2 Reg 2, Select 0) bits
79  */
80 #define RMIXL_MSG_STS0_RFBE		__BITS(31,24)	/* RX FIFO Buckets bit mask
81 							 *  0=not empty
82 							 *  1=empty
83 							 */
84 #define RMIXL_MSG_STS0_RFBE_SHIFT	24
85 #define RMIXL_MSG_STS0_RESV		__BIT(23)
86 #define RMIXL_MSG_STS0_RMSID		__BITS(22,16)	/* Source ID */
87 #define RMIXL_MSG_STS0_RMSID_SHIFT	16
88 #define RMIXL_MSG_STS0_RMSC		__BITS(15,8)	/* RX Message Software Code */
89 #define RMIXL_MSG_STS0_RMSC_SHIFT	8
90 #define RMIXL_MSG_STS0_RMS		__BITS(7,6)	/* RX Message Size (minus 1) */
91 #define RMIXL_MSG_STS0_RMS_SHIFT	6
92 #define RMIXL_MSG_STS0_LEF		__BIT(5)	/* Load Empty Fail */
93 #define RMIXL_MSG_STS0_LPF		__BIT(4)	/* Load Pending Fail */
94 #define RMIXL_MSG_STS0_LMP		__BIT(3)	/* Load Message Pending */
95 #define RMIXL_MSG_STS0_SCF		__BIT(2)	/* Send Credit Fail */
96 #define RMIXL_MSG_STS0_SPF		__BIT(1)	/* Send Pending Fail */
97 #define RMIXL_MSG_STS0_SMP		__BIT(0)	/* Send Message Pending */
98 #define RMIXL_MSG_STS0_ERRS	\
99 		(RMIXL_MSG_STS0_LEF|RMIXL_MSG_STS0_LPF|RMIXL_MSG_STS0_LMP \
100 		|RMIXL_MSG_STS0_SCF|RMIXL_MSG_STS0_SPF|RMIXL_MSG_STS0_SMP)
101 
102 /*
103  * MsgStatus1: RMIXL_COP_2_MSG_STS (CP2 Reg 2, Select 1) bits
104  */
105 #define RMIXL_MSG_STS1_RESV		__BIT(31)
106 #define RMIXL_MSG_STS1_C		__BIT(30)	/* Credit Overrun Error */
107 #define RMIXL_MSG_STS1_CCFCME		__BITS(29,23)	/* Credit Counter of Free Credit Message with Error */
108 #define RMIXL_MSG_STS1_CCFCME_SHIFT	23
109 #define RMIXL_MSG_STS1_SIDFCME		__BITS(22,16)	/* Source ID of Free Credit Message with Error */
110 #define RMIXL_MSG_STS1_SIDFCME_SHIFT	16
111 #define RMIXL_MSG_STS1_T		__BIT(15)	/* Invalid Target Error */
112 #define RMIXL_MSG_STS1_F		__BIT(14)	/* Receive Queue "Write When Full" Error */
113 #define RMIXL_MSG_STS1_SIDE		__BITS(13,7)	/* Source ID of incoming msg with Error */
114 #define RMIXL_MSG_STS1_SIDE_SHIFT	7
115 #define RMIXL_MSG_STS1_DIDE		__BITS(6,0)	/* Destination ID of the incoming message Message with Error */
116 #define RMIXL_MSG_STS1_DIDE_SHIFT	0
117 #define RMIXL_MSG_STS1_ERRS	\
118 		(RMIXL_MSG_STS1_C|RMIXL_MSG_STS1_T|RMIXL_MSG_STS1_F)
119 
120 /*
121  * MsgConfig: RMIXL_COP_2_MSG_CFG (CP2 Reg 3, Select 0) bits
122  */
123 #define RMIXL_MSG_CFG0_WM		__BITS(31,24)	/* Watermark level */
124 #define RMIXL_MSG_CFG0_WMSHIFT		24
125 #define RMIXL_MSG_CFG0_RESa		__BITS(23,22)
126 #define RMIXL_MSG_CFG0_IV		__BITS(21,16)	/* Interrupt Vector */
127 #define RMIXL_MSG_CFG0_IV_SHIFT		16
128 #define RMIXL_MSG_CFG0_RESb		__BITS(15,12)
129 #define RMIXL_MSG_CFG0_ITM		__BITS(11,8)	/* Interrupt Thread Mask */
130 #define RMIXL_MSG_CFG0_ITM_SHIFT	8
131 #define RMIXL_MSG_CFG0_RESc		__BITS(7,2)
132 #define RMIXL_MSG_CFG0_WIE		__BIT(1)	/* Watermark Interrupt Enable */
133 #define RMIXL_MSG_CFG0_EIE		__BIT(0)	/* Receive Queue Not Empty Enable */
134 #define RMIXL_MSG_CFG0_RESV	\
135 		(RMIXL_MSG_CFG0_RESa|RMIXL_MSG_CFG0_RESb|RMIXL_MSG_CFG0_RESc)
136 
137 /*
138  * MsgConfig1: RMIXL_COP_2_MSG_CFG (CP2 Reg 3, Select 1) bits
139  * Note: reg width is 64 bits in PRM reg description, but 32 bits in reg summary
140  */
141 #define RMIXL_MSG_CFG1_RESV		__BITS(63,3)
142 #define RMIXL_MSG_CFG1_T		__BIT(2)	/* Trace Mode Enable */
143 #define RMIXL_MSG_CFG1_C		__BIT(1)	/* Credit Over-run Interrupt Enable */
144 #define RMIXL_MSG_CFG1_M		__BIT(0)	/* Messaging Errors Interrupt Enable */
145 
146 
147 /*
148  * MsgBucketSize: RMIXL_COP_2_MSG_BSZ (CP2 Reg 4, Select [0..7]) bits
149  * Note: reg width is 64 bits in PRM reg description, but 32 bits in reg summary
150  * Size:
151  * - 0 means bucket disabled, else
152  * - must be power of 2
153  * - must be >=4
154  */
155 #define RMIXL_MSG_BSZ_RESV		__BITS(63,8)
156 #define RMIXL_MSG_BSZ_SIZE		__BITS(7,0)
157 
158 
159 
160 
161 /*
162  * RMIXL Processor Control Register addresses
163  * - Offset  in bits  7..0
164  * - BlockID in bits 15..8
165  */
166 #define RMIXL_PCR_THREADEN			0x0000
167 #define RMIXL_PCR_SOFTWARE_SLEEP		0x0001
168 #define RMIXL_PCR_SCHEDULING			0x0002
169 #define RMIXL_PCR_SCHEDULING_COUNTERS		0x0003
170 #define RMIXL_PCR_BHRPM				0x0004
171 #define RMIXL_PCR_IFU_DEFEATURE			0x0006
172 #define RMIXL_PCR_ICU_DEFEATURE			0x0100
173 #define RMIXL_PCR_ICU_ERROR_LOGGING		0x0101
174 #define RMIXL_PCR_ICU_DEBUG_ACCESS_ADDR		0x0102
175 #define RMIXL_PCR_ICU_DEBUG_ACCESS_DATALO	0x0103
176 #define RMIXL_PCR_ICU_DEBUG_ACCESS_DATAHI	0x0104
177 #define RMIXL_PCR_ICU_SAMPLING_LFSR		0x0105
178 #define RMIXL_PCR_ICU_SAMPLING_PC		0x0106
179 #define RMIXL_PCR_ICU_SAMPLING_SETUP		0x0107
180 #define RMIXL_PCR_ICU_SAMPLING_TIMER		0x0108
181 #define RMIXL_PCR_ICU_SAMPLING_PC_UPPER		0x0109
182 #define RMIXL_PCR_IEU_DEFEATURE			0x0200
183 #define RMIXL_PCR_TARGET_PC_REGISTER		0x0207
184 #define RMIXL_PCR_L1D_CONFIG0			0x0300
185 #define RMIXL_PCR_L1D_CONFIG1			0x0301
186 #define RMIXL_PCR_L1D_CONFIG2			0x0302
187 #define RMIXL_PCR_L1D_CONFIG3			0x0303
188 #define RMIXL_PCR_L1D_CONFIG4			0x0304
189 #define RMIXL_PCR_L1D_STATUS			0x0305
190 #define RMIXL_PCR_L1D_DEFEATURE			0x0306
191 #define RMIXL_PCR_L1D_DEBUG0			0x0307
192 #define RMIXL_PCR_L1D_DEBUG1			0x0308
193 #define RMIXL_PCR_L1D_CACHE_ERROR_LOG		0x0309
194 #define RMIXL_PCR_L1D_CACHE_ERROR_OVF_LO	0x030A
195 #define RMIXL_PCR_L1D_CACHE_INTERRUPT		0x030B
196 #define RMIXL_PCR_MMU_SETUP			0x0400
197 #define RMIXL_PCR_PRF_SMP_EVENT			0x0500
198 #define RMIXL_PCR_RF_SMP_RPLY_BUF		0x0501
199 
200 /* PCR bit defines TBD */
201 
202 
203 /*
204  * Memory Distributed Interconnect (MDI) System Memory Map
205  */
206 #define RMIXL_PHYSADDR_MAX	0xffffffffffLL		/* 1TB Physical Address space */
207 #define RMIXL_IO_DEV_PBASE	0x1ef00000		/* default phys. from XL[RS]_IO_BAR */
208 #define RMIXL_IO_DEV_VBASE	MIPS_PHYS_TO_KSEG1(RMIXL_IO_DEV_PBASE)
209 							/* default virtual base address */
210 #define RMIXL_IO_DEV_SIZE	0x100000		/* I/O Conf. space is 1MB region */
211 
212 
213 
214 /*
215  * Peripheral and I/O Configuration Region of Memory
216  *
217  * These are relocatable; we run using the reset value defaults,
218  * and we expect to inherit those intact from the boot firmware.
219  *
220  * Many of these overlap between XLR and XLS, exceptions are ifdef'ed.
221  *
222  * Device region offsets are relative to RMIXL_IO_DEV_PBASE.
223  */
224 #define RMIXL_IO_DEV_BRIDGE	0x00000	/* System Bridge Controller (SBC) */
225 #define RMIXL_IO_DEV_DDR_CHNA	0x01000	/* DDR1/DDR2 DRAM_A Channel, Port MA */
226 #define RMIXL_IO_DEV_DDR_CHNB	0x02000	/* DDR1/DDR2 DRAM_B Channel, Port MB */
227 #define RMIXL_IO_DEV_DDR_CHNC	0x03000	/* DDR1/DDR2 DRAM_C Channel, Port MC */
228 #define RMIXL_IO_DEV_DDR_CHND	0x04000	/* DDR1/DDR2 DRAM_D Channel, Port MD */
229 #if defined(MIPS64_XLR)
230 #define RMIXL_IO_DEV_SRAM	0x07000	/* SRAM Controller, Port SA */
231 #endif	/* MIPS64_XLR */
232 #define RMIXL_IO_DEV_PIC	0x08000	/* Programmable Interrupt Controller */
233 #if defined(MIPS64_XLR)
234 #define RMIXL_IO_DEV_PCIX	0x09000	/* PCI-X */
235 #define RMIXL_IO_DEV_PCIX_EL	\
236 	RMIXL_IO_DEV_PCIX		/* PXI-X little endian */
237 #define RMIXL_IO_DEV_PCIX_EB	\
238 	(RMIXL_IO_DEV_PCIX | __BIT(11))	/* PXI-X big endian */
239 #define RMIXL_IO_DEV_HT		0x0a000	/* HyperTransport */
240 #endif	/* MIPS64_XLR */
241 #define RMIXL_IO_DEV_SAE	0x0b000	/* Security Acceleration Engine */
242 #if defined(MIPS64_XLS)
243 #define XAUI_INTERFACE_0	0x0c000	/* XAUI Interface_0 */
244 					/*  when SGMII Interface_[0-3] are not used */
245 #define RMIXL_IO_DEV_GMAC_0	0x0c000	/* SGMII-Interface_0, Port SGMII0 */
246 #define RMIXL_IO_DEV_GMAC_1	0x0d000	/* SGMII-Interface_1, Port SGMII1 */
247 #define RMIXL_IO_DEV_GMAC_2	0x0e000	/* SGMII-Interface_2, Port SGMII2 */
248 #define RMIXL_IO_DEV_GMAC_3	0x0f000	/* SGMII-Interface_3, Port SGMII3 */
249 #endif	/* MIPS64_XLS */
250 #if defined(MIPS64_XLR)
251 #define RMIXL_IO_DEV_GMAC_A	0x0c000	/* RGMII-Interface_0, Port RA */
252 #define RMIXL_IO_DEV_GMAC_B	0x0d000	/* RGMII-Interface_1, Port RB */
253 #define RMIXL_IO_DEV_GMAC_C	0x0e000	/* RGMII-Interface_2, Port RC */
254 #define RMIXL_IO_DEV_GMAC_D	0x0f000	/* RGMII-Interface_3, Port RD */
255 #define RMIXL_IO_DEV_SPI4_A	0x10000	/* SPI-4.2-Interface_A, Port XA */
256 #define RMIXL_IO_DEV_XGMAC_A	0x11000	/* XGMII-Interface_A, Port XA */
257 #define RMIXL_IO_DEV_SPI4_B	0x12000	/* SPI-4.2-Interface_B, Port XB */
258 #define RMIXL_IO_DEV_XGMAC_B	0x13000	/* XGMII-Interface_B, Port XB */
259 #endif	/* MIPS64_XLR */
260 #define RMIXL_IO_DEV_UART_1	0x14000	/* UART_1 (16550 w/ ax4 addrs) */
261 #define RMIXL_IO_DEV_UART_2	0x15000	/* UART_2 (16550 w/ ax4 addrs) */
262 #define RMIXL_IO_DEV_I2C_1	0x16000	/* I2C_1 */
263 #define RMIXL_IO_DEV_I2C_2	0x17000	/* I2C_2 */
264 #define RMIXL_IO_DEV_GPIO	0x18000	/* GPIO */
265 #define RMIXL_IO_DEV_FLASH	0x19000	/* Peripherals IO Bus, to Flash memory &etc. */
266 #define RMIXL_IO_DEV_DMA	0x1a000	/* DMA */
267 #define RMIXL_IO_DEV_L2		0x1b000	/* L2 Cache */
268 #define RMIXL_IO_DEV_TB		0x1c000	/* Trace Buffer */
269 #if defined(MIPS64_XLS)
270 #define RMIXL_IO_DEV_CDE	0x1d000	/* Compression/Decompression Engine */
271 #define RMIXL_IO_DEV_PCIE_BE	0x1e000	/* PCI-Express_BE */
272 #define RMIXL_IO_DEV_PCIE_LE	0x1f000	/* PCI-Express_LE */
273 #define RMIXL_IO_DEV_SRIO_BE	0x1e000	/* SRIO_BE */
274 #define RMIXL_IO_DEV_SRIO_LE	0x1f000	/* SRIO_LE */
275 #define RMIXL_IO_DEV_XAUI_1	0x20000	/* XAUI Interface_1 */
276 					/*  when SGMII Interface_[4-7] are not used */
277 #define RMIXL_IO_DEV_GMAC_4	0x20000	/* SGMII-Interface_4, Port SGMII4 */
278 #define RMIXL_IO_DEV_GMAC_5	0x21000	/* SGMII-Interface_5, Port SGMII5 */
279 #define RMIXL_IO_DEV_GMAC_6	0x22000	/* SGMII-Interface_6, Port SGMII6 */
280 #define RMIXL_IO_DEV_GMAC_7	0x23000	/* SGMII-Interface_7, Port SGMII7 */
281 #define RMIXL_IO_DEV_USB_A	0x24000	/* USB Interface Low Address Space */
282 #define RMIXL_IO_DEV_USB_B	0x25000	/* USB Interface High Address Space */
283 #endif	/* MIPS64_XLS */
284 
285 
286 /*
287  * the Programming Reference Manual
288  * lists "Reg ID" values not offsets;
289  * offset = id * 4
290  */
291 #define _RMIXL_OFFSET(id)	((id) * 4)
292 
293 
294 /*
295  * System Bridge Controller registers
296  * offsets are relative to RMIXL_IO_DEV_BRIDGE
297  */
298 #define RMIXL_SBC_DRAM_NBARS		8
299 #define RMIXL_SBC_DRAM_BAR(n)		_RMIXL_OFFSET(0x000 + (n))
300 					/* DRAM Region Base Address Regs[0-7] */
301 #define RMIXL_SBC_DRAM_CHNAC_DTR(n)	_RMIXL_OFFSET(0x008 + (n))
302 					/* DRAM Region Channels A,C Address Translation Regs[0-7] */
303 #define RMIXL_SBC_DRAM_CHNBD_DTR(n)	_RMIXL_OFFSET(0x010 + (n))
304 					/* DRAM Region Channels B,D Address Translation Regs[0-7] */
305 #define RMIXL_SBC_DRAM_BRIDGE_CFG	_RMIXL_OFFSET(0x18)	/* SBC DRAM config reg */
306 
307 #define RMIXL_SBC_IO_BAR		_RMIXL_OFFSET(0x19)	/* I/O Config Base Addr reg */
308 #define RMIXL_SBC_FLASH_BAR		_RMIXL_OFFSET(0x1a)	/* Flash Memory Base Addr reg */
309 
310 #if defined(MIPS64_XLR)
311 #define RMIXLR_SBC_SRAM_BAR		_RMIXL_OFFSET(0x1b)	/* SRAM Base Addr reg */
312 #define RMIXLR_SBC_HTMEM_BAR		_RMIXL_OFFSET(0x1c)	/* HyperTransport Mem Base Addr reg */
313 #define RMIXLR_SBC_HTINT_BAR		_RMIXL_OFFSET(0x1d)	/* HyperTransport Interrupt Base Addr reg */
314 #define RMIXLR_SBC_HTPIC_BAR		_RMIXL_OFFSET(0x1e)	/* HyperTransport Legacy PIC Base Addr reg */
315 #define RMIXLR_SBC_HTSM_BAR		_RMIXL_OFFSET(0x1f)	/* HyperTransport System Management Base Addr reg */
316 #define RMIXLR_SBC_HTIO_BAR		_RMIXL_OFFSET(0x20)	/* HyperTransport IO Base Addr reg */
317 #define RMIXLR_SBC_HTCFG_BAR		_RMIXL_OFFSET(0x21)	/* HyperTransport Configuration Base Addr reg */
318 #define RMIXLR_SBC_PCIX_CFG_BAR		_RMIXL_OFFSET(0x22)	/* PCI-X Configuration Base Addr reg */
319 #define RMIXLR_SBC_PCIX_MEM_BAR		_RMIXL_OFFSET(0x23)	/* PCI-X Mem Base Addr reg */
320 #define RMIXLR_SBC_PCIX_IO_BAR		_RMIXL_OFFSET(0x24)	/* PCI-X IO Base Addr reg */
321 #define RMIXLR_SBC_SYS2IO_CREDITS	_RMIXL_OFFSET(0x35)	/* System Bridge I/O Transaction Credits register */
322 #endif	/* MIPS64_XLR */
323 #if defined(MIPS64_XLS)
324 #define RMIXLS_SBC_PCIE_CFG_BAR		_RMIXL_OFFSET(0x40)	/* PCI Configuration BAR */
325 #define RMIXLS_SBC_PCIE_ECFG_BAR	_RMIXL_OFFSET(0x41)	/* PCI Extended Configuration BAR */
326 #define RMIXLS_SBC_PCIE_MEM_BAR		_RMIXL_OFFSET(0x42)	/* PCI Memory region BAR */
327 #define RMIXLS_SBC_PCIE_IO_BAR		_RMIXL_OFFSET(0x43)	/* PCI IO region BAR */
328 #endif	/* MIPS64_XLS */
329 
330 /*
331  * Address Error registers
332  * offsets are relative to RMIXL_IO_DEV_BRIDGE
333  */
334 #define RMIXL_ADDR_ERR_DEVICE_MASK	_RMIXL_OFFSET(0x25)	/* Address Error Device Mask */
335 #define RMIXL_ADDR_ERR_DEVICE_MASK_2	_RMIXL_OFFSET(0x44)	/* extension of Device Mask */
336 #define RMIXL_ADDR_ERR_AERR0_LOG1	_RMIXL_OFFSET(0x26)	/* Address Error Set 0 Log 1 */
337 #define RMIXL_ADDR_ERR_AERR0_LOG2	_RMIXL_OFFSET(0x27)	/* Address Error Set 0 Log 2 */
338 #define RMIXL_ADDR_ERR_AERR0_LOG3	_RMIXL_OFFSET(0x28)	/* Address Error Set 0 Log 3 */
339 #define RMIXL_ADDR_ERR_AERR0_DEVSTAT	_RMIXL_OFFSET(0x29)	/* Address Error Set 0 irpt status */
340 #define RMIXL_ADDR_ERR_AERR1_LOG1	_RMIXL_OFFSET(0x2a)	/* Address Error Set 1 Log 1 */
341 #define RMIXL_ADDR_ERR_AERR1_LOG2	_RMIXL_OFFSET(0x2b)	/* Address Error Set 1 Log 2 */
342 #define RMIXL_ADDR_ERR_AERR1_LOG3	_RMIXL_OFFSET(0x2c)	/* Address Error Set 1 Log 3 */
343 #define RMIXL_ADDR_ERR_AERR1_DEVSTAT	_RMIXL_OFFSET(0x2d)	/* Address Error Set 1 irpt status */
344 #define RMIXL_ADDR_ERR_AERR0_EN		_RMIXL_OFFSET(0x2e)	/* Address Error Set 0 irpt enable */
345 #define RMIXL_ADDR_ERR_AERR0_UPG	_RMIXL_OFFSET(0x2f)	/* Address Error Set 0 Upgrade */
346 #define RMIXL_ADDR_ERR_AERR0_CLEAR	_RMIXL_OFFSET(0x30)	/* Address Error Set 0 irpt clear */
347 #define RMIXL_ADDR_ERR_AERR1_CLEAR	_RMIXL_OFFSET(0x31)	/* Address Error Set 1 irpt clear */
348 #define RMIXL_ADDR_ERR_SBE_COUNTS	_RMIXL_OFFSET(0x32)	/* Single Bit Error Counts */
349 #define RMIXL_ADDR_ERR_DBE_COUNTS	_RMIXL_OFFSET(0x33)	/* Double Bit Error Counts */
350 #define RMIXL_ADDR_ERR_BITERR_INT_EN	_RMIXL_OFFSET(0x33)	/* Bit Error intr enable */
351 
352 /*
353  * RMIXL_SBC_FLASH_BAR bit defines
354  */
355 #define RMIXL_FLASH_BAR_BASE		__BITS(31,16)	/* phys address bits 39:24 */
356 #define RMIXL_FLASH_BAR_TO_BA(r)	\
357 		(((r) & RMIXL_FLASH_BAR_BASE) << (24 - 16))
358 #define RMIXL_FLASH_BAR_MASK		__BITS(15,5)	/* phys address mask bits 34:24 */
359 #define RMIXL_FLASH_BAR_TO_MASK(r)	\
360 		(((((r) & RMIXL_FLASH_BAR_MASK)) << (24 - 5)) | __BITS(23, 0))
361 #define RMIXL_FLASH_BAR_RESV		__BITS(4,1)	/* (reserved) */
362 #define RMIXL_FLASH_BAR_ENB		__BIT(0)	/* 1=Enable */
363 #define RMIXL_FLASH_BAR_MASK_MAX	RMIXL_FLASH_BAR_TO_MASK(RMIXL_FLASH_BAR_MASK)
364 
365 /*
366  * RMIXL_SBC_DRAM_BAR bit defines
367  */
368 #define RMIXL_DRAM_BAR_BASE_ADDR	__BITS(31,16)	/* bits 39:24 of Base Address */
369 #define DRAM_BAR_TO_BASE(r)	\
370 		(((r) & RMIXL_DRAM_BAR_BASE_ADDR) << (24 - 16))
371 #define RMIXL_DRAM_BAR_ADDR_MASK	__BITS(15,4)	/* bits 35:24 of Address Mask */
372 #define DRAM_BAR_TO_SIZE(r)	\
373 		((((r) & RMIXL_DRAM_BAR_ADDR_MASK) + __BIT(4)) << (24 - 4))
374 #define RMIXL_DRAM_BAR_INTERLEAVE	__BITS(3,1)	/* Interleave Mode */
375 #define RMIXL_DRAM_BAR_STATUS		__BIT(0)	/* 1='region enabled' */
376 
377 /*
378  * RMIXL_SBC_DRAM_CHNAC_DTR and
379  * RMIXL_SBC_DRAM_CHNBD_DTR bit defines
380  *	insert 'divisions' (0, 1 or 2) bits
381  *	of value 'partition'
382  *	at 'position' bit location.
383  */
384 #define RMIXL_DRAM_DTR_RESa		__BITS(31,14)
385 #define RMIXL_DRAM_DTR_PARTITION	__BITS(13,12)
386 #define RMIXL_DRAM_DTR_RESb		__BITS(11,10)
387 #define RMIXL_DRAM_DTR_DIVISIONS	__BITS(9,8)
388 #define RMIXL_DRAM_DTR_RESc		__BITS(7,6)
389 #define RMIXL_DRAM_DTR_POSITION		__BITS(5,0)
390 #define RMIXL_DRAM_DTR_RESV	\
391 		(RMIXL_DRAM_DTR_RESa|RMIXL_DRAM_DTR_RESb|RMIXL_DRAM_DTR_RESc)
392 
393 /*
394  * RMIXL_SBC_DRAM_BRIDGE_CFG bit defines
395  */
396 #define RMIXL_DRAM_CFG_RESa		__BITS(31,13)
397 #define RMIXL_DRAM_CFG_CHANNEL_MODE	__BIT(12)
398 #define RMIXL_DRAM_CFG_RESb		__BIT(11)
399 #define RMIXL_DRAM_CFG_INTERLEAVE_MODE	__BITS(10,8)
400 #define RMIXL_DRAM_CFG_RESc		__BITS(7,5)
401 #define RMIXL_DRAM_CFG_BUS_MODE		__BIT(4)
402 #define RMIXL_DRAM_CFG_RESd		__BITS(3,2)
403 #define RMIXL_DRAM_CFG_DRAM_MODE	__BITS(1,0)	/* 1=DDR2 */
404 
405 /*
406  * RMIXL_SBC_XLR_PCIX_CFG_BAR bit defines
407  */
408 #define RMIXL_PCIX_CFG_BAR_BASE		__BITS(31,17)	/* phys address bits 39:25 */
409 #define RMIXL_PCIX_CFG_BAR_BA_SHIFT	(25 - 17)
410 #define RMIXL_PCIX_CFG_BAR_TO_BA(r)	\
411 		(((r) & RMIXL_PCIX_CFG_BAR_BASE) << RMIXL_PCIX_CFG_BAR_BA_SHIFT)
412 #define RMIXL_PCIX_CFG_BAR_RESV		__BITS(16,1)	/* (reserved) */
413 #define RMIXL_PCIX_CFG_BAR_ENB		__BIT(0)	/* 1=Enable */
414 #define RMIXL_PCIX_CFG_SIZE		__BIT(25)
415 #define RMIXL_PCIX_CFG_BAR(ba, en)	\
416 		((uint32_t)(((ba) >> (25 - 17)) | ((en) ? RMIXL_PCIX_CFG_BAR_ENB : 0)))
417 
418 /*
419  * RMIXLR_SBC_PCIX_MEM_BAR bit defines
420  */
421 #define RMIXL_PCIX_MEM_BAR_BASE		__BITS(31,16)	/* phys address bits 39:24 */
422 #define RMIXL_PCIX_MEM_BAR_TO_BA(r)	\
423 		(((r) & RMIXL_PCIX_MEM_BAR_BASE) << (24 - 16))
424 #define RMIXL_PCIX_MEM_BAR_MASK		__BITS(15,1)	/* phys address mask bits 38:24 */
425 #define RMIXL_PCIX_MEM_BAR_TO_SIZE(r)	\
426 		((((r) & RMIXL_PCIX_MEM_BAR_MASK) + 2) << (24 - 1))
427 #define RMIXL_PCIX_MEM_BAR_ENB		__BIT(0)	/* 1=Enable */
428 #define RMIXL_PCIX_MEM_BAR(ba, en)	\
429 		((uint32_t)(((ba) >> (24 - 16)) | ((en) ? RMIXL_PCIX_MEM_BAR_ENB : 0)))
430 
431 /*
432  * RMIXLR_SBC_PCIX_IO_BAR bit defines
433  */
434 #define RMIXL_PCIX_IO_BAR_BASE		__BITS(31,18)	/* phys address bits 39:26 */
435 #define RMIXL_PCIX_IO_BAR_TO_BA(r)	\
436 		(((r) & RMIXL_PCIX_IO_BAR_BASE) << (26 - 18))
437 #define RMIXL_PCIX_IO_BAR_RESV		__BITS(17,7)	/* (reserve) */
438 #define RMIXL_PCIX_IO_BAR_MASK		__BITS(6,1)	/* phys address mask bits 31:26 */
439 #define RMIXL_PCIX_IO_BAR_TO_SIZE(r)	\
440 		((((r) & RMIXL_PCIX_IO_BAR_MASK) + 2) << (26 - 1))
441 #define RMIXL_PCIX_IO_BAR_ENB		__BIT(0)	/* 1=Enable */
442 #define RMIXL_PCIX_IO_BAR(ba, en)	\
443 		((uint32_t)(((ba) >> (26 - 18)) | ((en) ? RMIXL_PCIX_IO_BAR_ENB : 0)))
444 
445 /*
446  * RMIXLS_SBC_PCIE_CFG_BAR bit defines
447  */
448 #define RMIXL_PCIE_CFG_BAR_BASE	__BITS(31,17)	/* phys address bits 39:25 */
449 #define RMIXL_PCIE_CFG_BAR_BA_SHIFT	(25 - 17)
450 #define RMIXL_PCIE_CFG_BAR_TO_BA(r)	\
451 		(((r) & RMIXL_PCIE_CFG_BAR_BASE) << RMIXL_PCIE_CFG_BAR_BA_SHIFT)
452 #define RMIXL_PCIE_CFG_BAR_RESV		__BITS(16,1)	/* (reserved) */
453 #define RMIXL_PCIE_CFG_BAR_ENB		__BIT(0)	/* 1=Enable */
454 #define RMIXL_PCIE_CFG_SIZE		__BIT(25)
455 #define RMIXL_PCIE_CFG_BAR(ba, en)	\
456 		((uint32_t)(((ba) >> (25 - 17)) | ((en) ? RMIXL_PCIE_CFG_BAR_ENB : 0)))
457 
458 /*
459  * RMIXLS_SBC_PCIE_ECFG_BAR bit defines
460  * (PCIe extended config space)
461  */
462 #define RMIXL_PCIE_ECFG_BAR_BASE	__BITS(31,21)	/* phys address bits 39:29 */
463 #define RMIXL_PCIE_ECFG_BAR_BA_SHIFT	(29 - 21)
464 #define RMIXL_PCIE_ECFG_BAR_TO_BA(r)	\
465 		(((r) & RMIXL_PCIE_ECFG_BAR_BASE) << RMIXL_PCIE_ECFG_BAR_BA_SHIFT)
466 #define RMIXL_PCIE_ECFG_BAR_RESV	__BITS(20,1)	/* (reserved) */
467 #define RMIXL_PCIE_ECFG_BAR_ENB		__BIT(0)	/* 1=Enable */
468 #define RMIXL_PCIE_ECFG_SIZE		__BIT(29)
469 #define RMIXL_PCIE_ECFG_BAR(ba, en)	\
470 		((uint32_t)(((ba) >> (29 - 21)) | ((en) ? RMIXL_PCIE_ECFG_BAR_ENB : 0)))
471 
472 /*
473  * RMIXLS_SBC_PCIE_MEM_BAR bit defines
474  */
475 #define RMIXL_PCIE_MEM_BAR_BASE		__BITS(31,16)	/* phys address bits 39:24 */
476 #define RMIXL_PCIE_MEM_BAR_TO_BA(r)	\
477 		(((r) & RMIXL_PCIE_MEM_BAR_BASE) << (24 - 16))
478 #define RMIXL_PCIE_MEM_BAR_MASK		__BITS(15,1)	/* phys address mask bits 38:24 */
479 #define RMIXL_PCIE_MEM_BAR_TO_SIZE(r)	\
480 		((((r) & RMIXL_PCIE_MEM_BAR_MASK) + 2) << (24 - 1))
481 #define RMIXL_PCIE_MEM_BAR_ENB		__BIT(0)	/* 1=Enable */
482 #define RMIXL_PCIE_MEM_BAR(ba, en)	\
483 		((uint32_t)(((ba) >> (24 - 16)) | ((en) ? RMIXL_PCIE_MEM_BAR_ENB : 0)))
484 
485 /*
486  * RMIXLS_SBC_PCIE_IO_BAR bit defines
487  */
488 #define RMIXL_PCIE_IO_BAR_BASE		__BITS(31,18)	/* phys address bits 39:26 */
489 #define RMIXL_PCIE_IO_BAR_TO_BA(r)	\
490 		(((r) & RMIXL_PCIE_IO_BAR_BASE) << (26 - 18))
491 #define RMIXL_PCIE_IO_BAR_RESV		__BITS(17,7)	/* (reserve) */
492 #define RMIXL_PCIE_IO_BAR_MASK		__BITS(6,1)	/* phys address mask bits 31:26 */
493 #define RMIXL_PCIE_IO_BAR_TO_SIZE(r)	\
494 		((((r) & RMIXL_PCIE_IO_BAR_MASK) + 2) << (26 - 1))
495 #define RMIXL_PCIE_IO_BAR_ENB		__BIT(0)	/* 1=Enable */
496 #define RMIXL_PCIE_IO_BAR(ba, en)	\
497 		((uint32_t)(((ba) >> (26 - 18)) | ((en) ? RMIXL_PCIE_IO_BAR_ENB : 0)))
498 
499 
500 /*
501  * Programmable Interrupt Controller registers
502  * the Programming Reference Manual table 10.4
503  * lists "Reg ID" values not offsets
504  * Offsets are relative to RMIXL_IO_DEV_BRIDGE
505  */
506 #define	RMIXL_PIC_CONTROL		_RMIXL_OFFSET(0x0)
507 #define	RMIXL_PIC_IPIBASE		_RMIXL_OFFSET(0x4)
508 #define	RMIXL_PIC_INTRACK		_RMIXL_OFFSET(0x6)
509 #define	RMIXL_PIC_WATCHdOGMAXVALUE0	_RMIXL_OFFSET(0x8)
510 #define	RMIXL_PIC_WATCHDOGMAXVALUE1	_RMIXL_OFFSET(0x9)
511 #define	RMIXL_PIC_WATCHDOGMASK0		_RMIXL_OFFSET(0xa)
512 #define	RMIXL_PIC_WATCHDOGMASK1		_RMIXL_OFFSET(0xb)
513 #define	RMIXL_PIC_WATCHDOGHEARTBEAT0	_RMIXL_OFFSET(0xc)
514 #define	RMIXL_PIC_WATCHDOGHEARTBEAT1	_RMIXL_OFFSET(0xd)
515 #define	RMIXL_PIC_IRTENTRYC0(n)		_RMIXL_OFFSET(0x40 + (n))	/* 0<=n<=31 */
516 #define	RMIXL_PIC_IRTENTRYC1(n)		_RMIXL_OFFSET(0x80 + (n))	/* 0<=n<=31 */
517 #define	RMIXL_PIC_SYSTMRMAXVALC0(n)	_RMIXL_OFFSET(0x100 + (n))	/* 0<=n<=7 */
518 #define	RMIXL_PIC_SYSTMRMAXVALC1(n)	_RMIXL_OFFSET(0x110 + (n))	/* 0<=n<=7 */
519 #define	RMIXL_PIC_SYSTMRC0(n)		_RMIXL_OFFSET(0x120 + (n))	/* 0<=n<=7 */
520 #define	RMIXL_PIC_SYSTMRC1(n)		_RMIXL_OFFSET(0x130 + (n))	/* 0<=n<=7 */
521 
522 /*
523  * RMIXL_PIC_CONTROL bits
524  */
525 #define RMIXL_PIC_CONTROL_WATCHDOG_ENB	__BIT(0)
526 #define RMIXL_PIC_CONTROL_GEN_NMI	__BITS(2,1)	/* do NMI after n WDog irpts */
527 #define RMIXL_PIC_CONTROL_GEN_NMIn(n)	(((n) << 1) & RMIXL_PIC_CONTROL_GEN_NMI)
528 #define RMIXL_PIC_CONTROL_RESa		__BITS(7,3)
529 #define RMIXL_PIC_CONTROL_TIMER_ENB	__BITS(15,8)	/* per-Timer enable bits */
530 #define RMIXL_PIC_CONTROL_TIMER_ENBn(n)	((1 << (8 + (n))) & RMIXL_PIC_CONTROL_TIMER_ENB)
531 #define RMIXL_PIC_CONTROL_RESb		__BITS(31,16)
532 #define RMIXL_PIC_CONTROL_RESV		\
533 		(RMIXL_PIC_CONTROL_RESa|RMIXL_PIC_CONTROL_RESb)
534 
535 /*
536  * RMIXL_PIC_IPIBASE bits
537  */
538 #define RMIXL_PIC_IPIBASE_VECTORNUM	__BITS(5,0)
539 #define RMIXL_PIC_IPIBASE_RESa		__BIT(6)	/* undocumented bit */
540 #define RMIXL_PIC_IPIBASE_BCAST		__BIT(7)
541 #define RMIXL_PIC_IPIBASE_NMI		__BIT(8)
542 #define RMIXL_PIC_IPIBASE_ID		__BITS(31,16)
543 #define RMIXL_PIC_IPIBASE_ID_RESb	__BITS(31,23)
544 #define RMIXL_PIC_IPIBASE_ID_CORE	__BITS(22,20)	/* Physical CPU ID */
545 #define RMIXL_PIC_IPIBASE_ID_CORE_SHIFT		20
546 #define RMIXL_PIC_IPIBASE_ID_RESc	__BITS(19,18)
547 #define RMIXL_PIC_IPIBASE_ID_THREAD	__BITS(17,16)	/* Thread ID */
548 #define RMIXL_PIC_IPIBASE_ID_THREAD_SHIFT	16
549 #define RMIXL_PIC_IPIBASE_ID_RESV	\
550 		(RMIXL_PIC_IPIBASE_ID_RESa|RMIXL_PIC_IPIBASE_ID_RESb	\
551 		|RMIXL_PIC_IPIBASE_ID_RESc)
552 
553 /*
554  * RMIXL_PIC_IRTENTRYC0 bits
555  * IRT Entry low word
556  */
557 #define RMIXL_PIC_IRTENTRYC0_TMASK	__BITS(7,0)	/* Thread Mask */
558 #define RMIXL_PIC_IRTENTRYC0_RESa	__BITS(3,2)	/* write as 0 */
559 #define RMIXL_PIC_IRTENTRYC0_RESb	__BITS(31,8)	/* write as 0 */
560 #define RMIXL_PIC_IRTENTRYC0_RESV	\
561 		(RMIXL_PIC_IRTENTRYC0_RESa | RMIXL_PIC_IRTENTRYC0_RESb)
562 
563 /*
564  * RMIXL_PIC_IRTENTRYC1 bits
565  * IRT Entry high word
566  */
567 #define RMIXL_PIC_IRTENTRYC1_INTVEC	__BITS(5,0)	/* maps to bit# in CPU's EIRR */
568 #define RMIXL_PIC_IRTENTRYC1_GL		__BIT(6)	/* 0=Global; 1=Local */
569 #define RMIXL_PIC_IRTENTRYC1_NMI	__BIT(7)	/* 0=Maskable; 1=NMI */
570 #define RMIXL_PIC_IRTENTRYC1_RESV	__BITS(28,8)
571 #define RMIXL_PIC_IRTENTRYC1_P		__BIT(29)	/* 0=Rising/High; 1=Falling/Low */
572 #define RMIXL_PIC_IRTENTRYC1_TRG	__BIT(30)	/* 0=Edge; 1=Level */
573 #define RMIXL_PIC_IRTENTRYC1_VALID	__BIT(31)	/* 0=Invalid; 1=Valid IRT Entry */
574 
575 
576 /*
577  * GPIO Controller registers
578  * bit number is same as GPIO pin number for the GPIO masks below
579  */
580 
581 #define RMIXL_GPIO_NSIGNALS		25			/* 25 GPIO signals supported in HW */
582 
583 /* GPIO Signal Registers */
584 #define RMIXL_GPIO_INT_ENB		_RMIXL_OFFSET(0x0)	/* Interrupt Enable register */
585 #define RMIXL_GPIO_INT_INV		_RMIXL_OFFSET(0x1)	/* Interrupt Inversion register */
586 #define RMIXL_GPIO_IO_DIR		_RMIXL_OFFSET(0x2)	/* I/O Direction register */
587 #define RMIXL_GPIO_OUTPUT		_RMIXL_OFFSET(0x3)	/* Output Write register */
588 #define RMIXL_GPIO_INPUT		_RMIXL_OFFSET(0x4)	/* Intput Read register *//* ro */
589 #define RMIXL_GPIO_INT_CLR		_RMIXL_OFFSET(0x5)	/* Interrupt Clear register */
590 #define RMIXL_GPIO_INT_STS		_RMIXL_OFFSET(0x6)	/* Interrupt Status register *//* ro */
591 #define RMIXL_GPIO_INT_TYP		_RMIXL_OFFSET(0x7)	/* Interrupt Type register */
592 #define RMIXL_GPIO_RESET		_RMIXL_OFFSET(0x8)	/* XLR/XLS Soft Reset register */
593 
594 
595 /*
596  * common GPIO bit masks
597  */
598 #define RMIXL_GPIO_PGM_MASK		(__BITS(13,0) | __BITS(22,20) | __BIT(24))	/* programmable pins */
599 #define RMIXL_GPIO_INTR_MASK		(__BITS(13,0) | __BITS(24,20))			/* intr-capable pins */
600 
601 /*
602  * never-programmable fixed-function GPIO signals
603  * bit number is same as GPIO pin
604  */
605 #define RMIXL_GPIO_FLASH_CPUID		__BITS(16,14)		/* Flash CPU ID, output only */
606 #define RMIXL_GPIO_FLASH_CPUID_SHFT	14
607 #define RMIXL_GPIO_FLASH_RDY		__BIT(17)		/* Flash memory ready, input only */
608 #define RMIXL_GPIO_FLASH_ADV		__BIT(18)		/* Flash memory address valid, output only */
609 #define RMIXL_GPIO_FLASH_RESET_N	__BIT(19)		/* Flash memory reset, output only */
610 #define RMIXL_GPIO_THERMAL_INTRPT	__BIT(23)		/* Thermal interrupt, interrupt only */
611 
612 /*
613  * RMIXL_GPIO_INT_ENB bits
614  */
615 #define RMIXL_GPIO_INT_ENB_MASK		RMIXL_GPIO_INTR_MASK
616 
617 /*
618  * RMIXL_GPIO_INT_INV bits
619  * inversion control is possible only on the programmable pins
620  */
621 #define RMIXL_GPIO_INT_INV_MASK		RMIXL_GPIO_PGM_MASK
622 
623 /*
624  * RMIXL_GPIO_IO_DIR bits
625  * direction control is possible only on the programmable pins
626  */
627 #define RMIXL_GPIO_IO_DIR_MASK		RMIXL_GPIO_PGM_MASK
628 
629 /*
630  * RMIXL_GPIO_OUTPUT bits
631  * output is possible only on the programmable pins and fixed-function outputs
632  */
633 #define RMIXL_GPIO_OUTPUT_MASK		(RMIXL_GPIO_PGM_MASK \
634 					| RMIXL_GPIO_FLASH_ADV \
635 					| RMIXL_GPIO_FLASH_RESET_N)
636 
637 /*
638  * RMIXL_GPIO_INPUT bits
639  * input is possible only on the programmable pins and fixed-function inputs & interrupts
640  */
641 #define RMIXL_GPIO_INPUT_MASK		(RMIXL_GPIO_PGM_MASK \
642 					| RMIXL_GPIO_FLASH_RDY \
643 					| RMIXL_GPIO_THERMAL_INTRPT)
644 
645 /*
646  * RMIXL_GPIO_INT_CLR bits
647  */
648 #define RMIXL_GPIO_INT_CLR_MASK		RMIXL_GPIO_INTR_MASK
649 
650 /*
651  * RMIXL_GPIO_INT_STS bits
652  */
653 #define RMIXL_GPIO_INT_STS_INT_HI_L	__BIT(25)			/* INT_HI_L (input) requested */
654 #define RMIXL_GPIO_INT_STS_INT_LO_L	__BIT(26)			/* INT_LO_L (input) requested */
655 #define RMIXL_GPIO_INT_STS_MASK		(RMIXL_GPIO_INTR_MASK \
656 					| RMIXL_GPIO_INT_STS_INT_LO_L \
657 					| RMIXL_GPIO_INT_STS_INT_HI_L)
658 
659 /*
660  * RMIXL_GPIO_INT_TYP bits
661  *  0=Edge, 1=Level
662  */
663 #define RMIXL_GPIO_INT_TYP_MASK		RMIXL_GPIO_INTR_MASK
664 
665 /*
666  * RMIXL_GPIO_RESET bits
667  */
668 #define RMIXL_GPIO_RESET_RESV		__BITS(31,1)
669 #define RMIXL_GPIO_RESET_RESET		__BIT(0)
670 
671 
672 /* GPIO System Control Registers */
673 #define RMIXL_GPIO_RESET_CFG		_RMIXL_OFFSET(0x15)	/* Reset Configuration register */
674 #define RMIXL_GPIO_THERMAL_CSR		_RMIXL_OFFSET(0x16)	/* Thermal Control/Status register */
675 #define RMIXL_GPIO_THERMAL_SHFT		_RMIXL_OFFSET(0x17)	/* Thermal Shift register */
676 #define RMIXL_GPIO_BIST_ALL_STS		_RMIXL_OFFSET(0x18)	/* BIST All Status register */
677 #define RMIXL_GPIO_BIST_EACH_STS	_RMIXL_OFFSET(0x19)	/* BIST Each Status register */
678 #define RMIXL_GPIO_SGMII_0_3_PHY_CTL	_RMIXL_OFFSET(0x20)	/* SGMII #0..3 PHY Control register */
679 #define RMIXL_GPIO_AUI_0_PHY_CTL	_RMIXL_OFFSET(0x20)	/* AUI port#0  PHY Control register */
680 #define RMIXL_GPIO_SGMII_4_7_PLL_CTL	_RMIXL_OFFSET(0x21)	/* SGMII #4..7 PLL Control register */
681 #define RMIXL_GPIO_AUI_1_PLL_CTL	_RMIXL_OFFSET(0x21)	/* AUI port#1  PLL Control register */
682 #define RMIXL_GPIO_SGMII_4_7_PHY_CTL	_RMIXL_OFFSET(0x22)	/* SGMII #4..7 PHY Control register */
683 #define RMIXL_GPIO_AUI_1_PHY_CTL	_RMIXL_OFFSET(0x22)	/* AUI port#1  PHY Control register */
684 #define RMIXL_GPIO_INT_MAP		_RMIXL_OFFSET(0x25)	/* Interrupt Map to PIC, 0=int14, 1=int30 */
685 #define RMIXL_GPIO_EXT_INT		_RMIXL_OFFSET(0x26)	/* External Interrupt control register */
686 #define RMIXL_GPIO_CPU_RST		_RMIXL_OFFSET(0x28)	/* CPU Reset control register */
687 #define RMIXL_GPIO_LOW_PWR_DIS		_RMIXL_OFFSET(0x29)	/* Low Power Dissipation register */
688 #define RMIXL_GPIO_RANDOM		_RMIXL_OFFSET(0x2b)	/* Low Power Dissipation register */
689 #define RMIXL_GPIO_CPU_CLK_DIS		_RMIXL_OFFSET(0x2d)	/* CPU Clock Disable register */
690 
691 /*
692  * RMIXL_GPIO_RESET_CFG bits
693  */
694 #define RMIXL_GPIO_RESET_CFG_RESa		__BITS(31,28)
695 #define RMIXL_GPIO_RESET_CFG_PCIE_SRIO_SEL	__BITS(27,26)	/* PCIe or SRIO Select:
696 								 * 00 = PCIe selected, SRIO not available
697 								 * 01 = SRIO selected, 1.25 Gbaud (1.0 Gbps)
698 								 * 10 = SRIO selected, 2.25 Gbaud (2.0 Gbps)
699 								 * 11 = SRIO selected, 3.125 Gbaud (2.5 Gbps)
700 								 */
701 #define RMIXL_GPIO_RESET_CFG_XAUI_PORT1_SEL	__BIT(25)	/* XAUI Port 1 Select:
702 								 *  0 = Disabled - Port is SGMII ports 4-7
703 								 *  1 = Enabled -  Port is 4-lane XAUI Port 1
704 								 */
705 #define RMIXL_GPIO_RESET_CFG_XAUI_PORT0_SEL	__BIT(24)	/* XAUI Port 0 Select:
706 								 *  0 = Disabled - Port is SGMII ports 0-3
707 								 *  1 = Enabled -  Port is 4-lane XAUI Port 0
708 								 */
709 #define RMIXL_GPIO_RESET_CFG_RESb		__BIT(23)
710 #define RMIXL_GPIO_RESET_CFG_USB_DEV		__BIT(22)	/* USB Device:
711 								 *  0 = Device Mode
712 								 *  1 = Host Mode
713 								 */
714 #define RMIXL_GPIO_RESET_CFG_PCIE_CFG		__BITS(21,20)	/* PCIe or SRIO configuration */
715 #define RMIXL_GPIO_RESET_CFG_FLASH33_EN		__BIT(19)	/* Flash 33 MHZ Enable:
716 								 *  0 = 66.67 MHz
717 								 *  1 = 33.33 MHz
718 								 */
719 #define RMIXL_GPIO_RESET_CFG_BIST_DIAG_EN	__BIT(18)	/* BIST Diagnostics enable */
720 #define RMIXL_GPIO_RESET_CFG_BIST_RUN_EN	__BIT(18)	/* BIST Run enable */
721 #define RMIXL_GPIO_RESET_CFG_BOOT_NAND		__BIT(16)	/* Enable boot from NAND Flash */
722 #define RMIXL_GPIO_RESET_CFG_BOOT_PCMCIA	__BIT(15)	/* Enable boot from PCMCIA */
723 #define RMIXL_GPIO_RESET_CFG_FLASH_CFG		__BIT(14)	/* Flash 32-bit Data Configuration:
724 								 *  0 = 32-bit address / 16-bit data
725 								 *  1 = 32-bit address / 32-bit data
726 								 */
727 #define RMIXL_GPIO_RESET_CFG_PCMCIA_EN		__BIT(13)	/* PCMCIA Enable Status */
728 #define RMIXL_GPIO_RESET_CFG_PARITY_EN		__BIT(12)	/* Parity Enable Status */
729 #define RMIXL_GPIO_RESET_CFG_BIGEND		__BIT(11)	/* Big Endian Mode Enable Status */
730 #define RMIXL_GPIO_RESET_CFG_PLL1_OUT_DIV	__BITS(10,8)	/* PLL1 (Core PLL) Output Divider */
731 #define RMIXL_GPIO_RESET_CFG_PLL1_FB_DIV	__BITS(7,0)	/* PLL1 Feedback Divider */
732 
733 /*
734  * RMIXL_GPIO_EXT_INT bits
735  */
736 #define RMIXL_GPIO_EXT_INT_RESV			__BITS(31,4)
737 #define RMIXL_GPIO_EXT_INT_HI_MASK		__BIT(3)	/* mask (input) INT_HI_L */
738 #define RMIXL_GPIO_EXT_INT_LO_MASK		__BIT(2)	/* mask (input) INT_HI_L */
739 #define RMIXL_GPIO_EXT_INT_HI_CTL		__BIT(1)	/* generate (output) INT_HI_L */
740 #define RMIXL_GPIO_EXT_INT_LO_CTL		__BIT(0)	/* generate (output) INT_LO_L */
741 
742 /*
743  * RMIXL_GPIO_LOW_PWR_DIS bits
744  * except as noted, all bits are:
745  *  0 = feature enable (default)
746  *  1 = feature disable
747  */
748 /* XXX defines are for XLS6xx, XLS4xx-Lite and XLS4xx Devices */
749 #define RMIXL_GPIO_LOW_PWR_DIS_LP		__BIT(0)	/* Low Power disable */
750 #define RMIXL_GPIO_LOW_PWR_DIS_GMAC_QD_0	__BIT(1)	/* GMAC Quad 0 (GMAC 0..3) disable */
751 #define RMIXL_GPIO_LOW_PWR_DIS_GMAC_QD_1	__BIT(2)	/* GMAC Quad 1 (GMAC 4..7) disable */
752 #define RMIXL_GPIO_LOW_PWR_DIS_USB		__BIT(3)	/* USB disable */
753 #define RMIXL_GPIO_LOW_PWR_DIS_PCIE		__BIT(4)	/* PCIE disable */
754 #define RMIXL_GPIO_LOW_PWR_DIS_CDE		__BIT(5)	/* Compression/Decompression Engine disable */
755 #define RMIXL_GPIO_LOW_PWR_DIS_DMA		__BIT(6)	/* DMA Engine disable */
756 #define RMIXL_GPIO_LOW_PWR_DIS_SAE		__BITS(8,7)	/* Security Acceleration Engine disable:
757 								 *  00 = enable (default)
758 								 *  01 = reserved
759 								 *  10 = reserved
760 								 *  11 = disable
761 								 */
762 #define RMIXL_GPIO_LOW_PWR_DIS_RESV		__BITS(31,9)
763 
764 /*
765  * Peripheral I/O bus (Flash/PCMCIA) controller registers
766  */
767 #define RMIXL_FLASH_NCS			10			/* number of chip selects */
768 #define RMIXL_FLASH_CS_BOOT		0			/* CS0 is boot flash */
769 #define RMIXL_FLASH_CS_PCMCIA_CF	6			/* CS6 is PCMCIA compact flash */
770 #define RMIXL_FLASH_CSBASE_ADDRn(n)	_RMIXL_OFFSET(0x00+(n))	/* CSn Base Address reg */
771 #define RMIXL_FLASH_CSADDR_MASKn(n)	_RMIXL_OFFSET(0x10+(n))	/* CSn Address Mask reg */
772 #define RMIXL_FLASH_CSDEV_PARMn(n)	_RMIXL_OFFSET(0x20+(n))	/* CSn Device Parameter reg */
773 #define RMIXL_FLASH_CSTIME_PARMAn(n)	_RMIXL_OFFSET(0x30+(n))	/* CSn Timing Parameters A reg */
774 #define RMIXL_FLASH_CSTIME_PARMBn(n)	_RMIXL_OFFSET(0x40+(n))	/* CSn Timing Parameters B reg */
775 #define RMIXL_FLASH_INT_MASK		_RMIXL_OFFSET(0x50)	/* Flash Interrupt Mask reg */
776 #define RMIXL_FLASH_INT_STATUS		_RMIXL_OFFSET(0x60)	/* Flash Interrupt Status reg */
777 #define RMIXL_FLASH_ERROR_STATUS	_RMIXL_OFFSET(0x70)	/* Flash Error Status reg */
778 #define RMIXL_FLASH_ERROR_ADDR		_RMIXL_OFFSET(0x80)	/* Flash Error Address reg */
779 
780 /*
781  * RMIXL_FLASH_CSDEV_PARMn bits
782  */
783 #define RMIXL_FLASH_CSDEV_RESV		__BITS(31,16)
784 #define RMIXL_FLASH_CSDEV_BFN		__BIT(15)		/* Boot From Nand
785 								 *  0=Boot from NOR or
786 								 *    PCCard Type 1 Flash
787 								 *  1=Boot from NAND
788 								 */
789 #define RMIXL_FLASH_CSDEV_NANDEN	__BIT(14)		/* NAND Flash Enable
790 								 *  0=NOR
791 								 *  1=NAND
792 								 */
793 #define RMIXL_FLASH_CSDEV_ADVTYPE	__BIT(13)		/* Add Valid Sensing Type
794 								 *  0=level
795 								 *  1=pulse
796 								 */
797 #define RMIXL_FLASH_CSDEV_PARITY_TYPE	__BIT(12)		/* Parity Type
798 								 *  0=even
799 								 *  1=odd
800 								 */
801 #define RMIXL_FLASH_CSDEV_PARITY_EN	__BIT(11)		/* Parity Enable */
802 #define RMIXL_FLASH_CSDEV_GENIF_EN	__BIT(10)		/* Generic PLD/FPGA interface mode
803 								 *  if this bit is set, then
804 								 *  GPIO[13:10] cannot be used
805 								 *  for interrupts
806 								 */
807 #define RMIXL_FLASH_CSDEV_PCMCIA_EN	__BIT(9)		/* PCMCIA Interface mode */
808 #define RMIXL_FLASH_CSDEV_DWIDTH	__BITS(8,7)		/* Data Bus Width:
809 								 *  00: 8 bit
810 								 *  01: 16 bit
811 								 *  10: 32 bit
812 								 *  11: 8 bit
813 								 */
814 #define RMIXL_FLASH_CSDEV_DWIDTH_SHFT	7
815 #define RMIXL_FLASH_CSDEV_MX_ADDR	__BIT(6)		/* Multiplexed Address
816 								 *  0: non-muxed
817 								 *      AD[31:24] = Data,
818 								 *	AD[23:0] = Addr
819 								 *  1: muxed
820 								 *      External latch required
821 								 */
822 #define RMIXL_FLASH_CSDEV_WAIT_POL	__BIT(5)		/* WAIT polarity
823 								 *  0: Active high
824 								 *  1: Active low
825 								 */
826 #define RMIXL_FLASH_CSDEV_WAIT_EN	__BIT(4)		/* Enable External WAIT Ack mode */
827 #define RMIXL_FLASH_CSDEV_BURST		__BITS(3,1)		/* Burst Length:
828 								 *  000: 2x
829 								 *  001: 4x
830 								 *  010: 8x
831 								 *  011: 16x
832 								 *  100: 32x
833 								 */
834 #define RMIXL_FLASH_CSDEV_BURST_SHFT	1
835 #define RMIXL_FLASH_CSDEV_BURST_EN	__BITS(0)		/* Burst Enable */
836 
837 
838 /*
839  * NAND Flash Memory Control registers
840  */
841 #define RMIXL_NAND_CLEn(n)		_RMIXL_OFFSET(0x90+(n))	/* CSn 8-bit CLE command value reg */
842 #define RMIXL_NAND_ALEn(n)		_RMIXL_OFFSET(0xa0+(n))	/* CSn 8-bit ALE address phase reg */
843 
844 /*
845  * PCIE Interface Controller registers
846  */
847 #define RMIXL_PCIE_CTRL1		_RMIXL_OFFSET(0x0)
848 #define RMIXL_PCIE_CTRL2		_RMIXL_OFFSET(0x1)
849 #define RMIXL_PCIE_CTRL3		_RMIXL_OFFSET(0x2)
850 #define RMIXL_PCIE_CTRL4		_RMIXL_OFFSET(0x3)
851 #define RMIXL_PCIE_CTRL			_RMIXL_OFFSET(0x4)
852 #define RMIXL_PCIE_IOBM_TIMER		_RMIXL_OFFSET(0x5)
853 #define RMIXL_PCIE_MSI_CMD		_RMIXL_OFFSET(0x6)
854 #define RMIXL_PCIE_MSI_RESP		_RMIXL_OFFSET(0x7)
855 #define RMIXL_PCIE_DWC_CRTL5		_RMIXL_OFFSET(0x8)	/* not on XLS408Lite, XLS404Lite */
856 #define RMIXL_PCIE_DWC_CRTL6		_RMIXL_OFFSET(0x9)	/* not on XLS408Lite, XLS404Lite */
857 #define RMIXL_PCIE_IOBM_SWAP_MEM_BASE	_RMIXL_OFFSET(0x10)
858 #define RMIXL_PCIE_IOBM_SWAP_MEM_LIMIT	_RMIXL_OFFSET(0x11)
859 #define RMIXL_PCIE_IOBM_SWAP_IO_BASE	_RMIXL_OFFSET(0x12)
860 #define RMIXL_PCIE_IOBM_SWAP_IO_LIMIT	_RMIXL_OFFSET(0x13)
861 #define RMIXL_PCIE_TRGT_CHRNT_MEM_BASE	_RMIXL_OFFSET(0x14)
862 #define RMIXL_PCIE_TRGT_CHRNT_MEM_LIMIT	_RMIXL_OFFSET(0x15)
863 #define RMIXL_PCIE_TRGT_L2ALC_MEM_BASE	_RMIXL_OFFSET(0x16)
864 #define RMIXL_PCIE_TRGT_L2ALC_MEM_LIMIT	_RMIXL_OFFSET(0x17)
865 #define RMIXL_PCIE_TRGT_REX_MEM_BASE	_RMIXL_OFFSET(0x18)
866 #define RMIXL_PCIE_TRGT_REX_MEM_LIMIT	_RMIXL_OFFSET(0x19)
867 #define RMIXL_PCIE_EP_MEM_BASE		_RMIXL_OFFSET(0x1a)
868 #define RMIXL_PCIE_EP_MEM_LIMIT		_RMIXL_OFFSET(0x1b)
869 #define RMIXL_PCIE_EP_ADDR_MAP_ENTRY0	_RMIXL_OFFSET(0x1c)
870 #define RMIXL_PCIE_EP_ADDR_MAP_ENTRY1	_RMIXL_OFFSET(0x1d)
871 #define RMIXL_PCIE_EP_ADDR_MAP_ENTRY2	_RMIXL_OFFSET(0x1e)
872 #define RMIXL_PCIE_EP_ADDR_MAP_ENTRY3	_RMIXL_OFFSET(0x1f)
873 #define RMIXL_PCIE_LINK0_STATE		_RMIXL_OFFSET(0x20)
874 #define RMIXL_PCIE_LINK1_STATE		_RMIXL_OFFSET(0x21)
875 #define RMIXL_PCIE_IOBM_INT_STATUS	_RMIXL_OFFSET(0x22)
876 #define RMIXL_PCIE_IOBM_INT_ENABLE	_RMIXL_OFFSET(0x23)
877 #define RMIXL_PCIE_LINK0_MSI_STATUS	_RMIXL_OFFSET(0x24)
878 #define RMIXL_PCIE_LINK1_MSI_STATUS	_RMIXL_OFFSET(0x25)
879 #define RMIXL_PCIE_LINK0_MSI_ENABLE	_RMIXL_OFFSET(0x26)
880 #define RMIXL_PCIE_LINK1_MSI_ENABLE	_RMIXL_OFFSET(0x27)
881 #define RMIXL_PCIE_LINK0_INT_STATUS0	_RMIXL_OFFSET(0x28)
882 #define RMIXL_PCIE_LINK1_INT_STATUS0	_RMIXL_OFFSET(0x29)
883 #define RMIXL_PCIE_LINK0_INT_STATUS1	_RMIXL_OFFSET(0x2a)
884 #define RMIXL_PCIE_LINK1_INT_STATUS1	_RMIXL_OFFSET(0x2b)
885 #define RMIXL_PCIE_LINK0_INT_ENABLE0	_RMIXL_OFFSET(0x2c)
886 #define RMIXL_PCIE_LINK1_INT_ENABLE0	_RMIXL_OFFSET(0x2d)
887 #define RMIXL_PCIE_LINK0_INT_ENABLE1	_RMIXL_OFFSET(0x2e)
888 #define RMIXL_PCIE_LINK1_INT_ENABLE1	_RMIXL_OFFSET(0x2f)
889 #define RMIXL_PCIE_PHY_CR_CMD		_RMIXL_OFFSET(0x30)
890 #define RMIXL_PCIE_PHY_CR_WR_DATA	_RMIXL_OFFSET(0x31)
891 #define RMIXL_PCIE_PHY_CR_RESP		_RMIXL_OFFSET(0x32)
892 #define RMIXL_PCIE_PHY_CR_RD_DATA	_RMIXL_OFFSET(0x33)
893 #define RMIXL_PCIE_IOBM_ERR_CMD		_RMIXL_OFFSET(0x34)
894 #define RMIXL_PCIE_IOBM_ERR_LOWER_ADDR	_RMIXL_OFFSET(0x35)
895 #define RMIXL_PCIE_IOBM_ERR_UPPER_ADDR	_RMIXL_OFFSET(0x36)
896 #define RMIXL_PCIE_IOBM_ERR_BE		_RMIXL_OFFSET(0x37)
897 #define RMIXL_PCIE_LINK2_STATE		_RMIXL_OFFSET(0x60)	/* not on XLS408Lite, XLS404Lite */
898 #define RMIXL_PCIE_LINK3_STATE		_RMIXL_OFFSET(0x61)	/* not on XLS408Lite, XLS404Lite */
899 #define RMIXL_PCIE_LINK2_MSI_STATUS	_RMIXL_OFFSET(0x64)	/* not on XLS408Lite, XLS404Lite */
900 #define RMIXL_PCIE_LINK3_MSI_STATUS	_RMIXL_OFFSET(0x65)	/* not on XLS408Lite, XLS404Lite */
901 #define RMIXL_PCIE_LINK2_MSI_ENABLE	_RMIXL_OFFSET(0x66)	/* not on XLS408Lite, XLS404Lite */
902 #define RMIXL_PCIE_LINK3_MSI_ENABLE	_RMIXL_OFFSET(0x67)	/* not on XLS408Lite, XLS404Lite */
903 #define RMIXL_PCIE_LINK2_INT_STATUS0	_RMIXL_OFFSET(0x68)	/* not on XLS408Lite, XLS404Lite */
904 #define RMIXL_PCIE_LINK3_INT_STATUS0	_RMIXL_OFFSET(0x69)	/* not on XLS408Lite, XLS404Lite */
905 #define RMIXL_PCIE_LINK2_INT_STATUS1	_RMIXL_OFFSET(0x6a)	/* not on XLS408Lite, XLS404Lite */
906 #define RMIXL_PCIE_LINK3_INT_STATUS1	_RMIXL_OFFSET(0x6b)	/* not on XLS408Lite, XLS404Lite */
907 #define RMIXL_PCIE_LINK2_INT_ENABLE0	_RMIXL_OFFSET(0x6c)	/* not on XLS408Lite, XLS404Lite */
908 #define RMIXL_PCIE_LINK3_INT_ENABLE0	_RMIXL_OFFSET(0x6d)	/* not on XLS408Lite, XLS404Lite */
909 #define RMIXL_PCIE_LINK2_INT_ENABLE1	_RMIXL_OFFSET(0x6e)	/* not on XLS408Lite, XLS404Lite */
910 #define RMIXL_PCIE_LINK3_INT_ENABLE1	_RMIXL_OFFSET(0x6f)	/* not on XLS408Lite, XLS404Lite */
911 #define RMIXL_VC0_POSTED_RX_QUEUE_CTRL	_RMIXL_OFFSET(0x1d2)
912 #define RMIXL_VC0_POSTED_BUFFER_DEPTH	_RMIXL_OFFSET(0x1ea)
913 #define RMIXL_PCIE_MSG_TX_THRESHOLD	_RMIXL_OFFSET(0x308)
914 #define RMIXL_PCIE_MSG_BUCKET_SIZE_0	_RMIXL_OFFSET(0x320)
915 #define RMIXL_PCIE_MSG_BUCKET_SIZE_1	_RMIXL_OFFSET(0x321)
916 #define RMIXL_PCIE_MSG_BUCKET_SIZE_2	_RMIXL_OFFSET(0x322)
917 #define RMIXL_PCIE_MSG_BUCKET_SIZE_3	_RMIXL_OFFSET(0x323)
918 #define RMIXL_PCIE_MSG_BUCKET_SIZE_4	_RMIXL_OFFSET(0x324)	/* not on XLS408Lite, XLS404Lite */
919 #define RMIXL_PCIE_MSG_BUCKET_SIZE_5	_RMIXL_OFFSET(0x325)	/* not on XLS408Lite, XLS404Lite */
920 #define RMIXL_PCIE_MSG_BUCKET_SIZE_6	_RMIXL_OFFSET(0x326)	/* not on XLS408Lite, XLS404Lite */
921 #define RMIXL_PCIE_MSG_BUCKET_SIZE_7	_RMIXL_OFFSET(0x327)	/* not on XLS408Lite, XLS404Lite */
922 #define RMIXL_PCIE_MSG_CREDIT_FIRST	_RMIXL_OFFSET(0x380)
923 #define RMIXL_PCIE_MSG_CREDIT_LAST	_RMIXL_OFFSET(0x3ff)
924 
925 /*
926  * USB General Interface registers
927  * these are opffset from REGSPACE selected by __BIT(12) == 1
928  *	RMIXL_IOREG_VADDR(RMIXL_IO_DEV_USB_B + reg)
929  * see Tables 18-7 and 18-14 in the XLS PRM
930  */
931 #define RMIXL_USB_GEN_CTRL1		0x00
932 #define RMIXL_USB_GEN_CTRL2		0x04
933 #define RMIXL_USB_GEN_CTRL3		0x08
934 #define RMIXL_USB_IOBM_TIMER		0x0C
935 #define RMIXL_USB_VBUS_TIMER		0x10
936 #define RMIXL_USB_BYTESWAP_EN		0x14
937 #define RMIXL_USB_COHERENT_MEM_BASE	0x40
938 #define RMIXL_USB_COHERENT_MEM_LIMIT	0x44
939 #define RMIXL_USB_L2ALLOC_MEM_BASE	0x48
940 #define RMIXL_USB_L2ALLOC_MEM_LIMIT	0x4C
941 #define RMIXL_USB_READEX_MEM_BASE	0x50
942 #define RMIXL_USB_READEX_MEM_LIMIT	0x54
943 #define RMIXL_USB_PHY_STATUS		0xC0
944 #define RMIXL_USB_INTERRUPT_STATUS	0xC4
945 #define RMIXL_USB_INTERRUPT_ENABLE	0xC8
946 
947 /*
948  * RMIXL_USB_GEN_CTRL1 bits
949  */
950 #define RMIXL_UG_CTRL1_RESV		__BITS(31,2)
951 #define RMIXL_UG_CTRL1_HOST_RST		__BIT(1)	/* Resets the Host Controller
952 							 *  0: reset
953 							 *  1: normal operation
954 							 */
955 #define RMIXL_UG_CTRL1_DEV_RST		__BIT(0)	/* Resets the Device Controller
956 							 *  0: reset
957 							 *  1: normal operation
958 							 */
959 
960 /*
961  * RMIXL_USB_GEN_CTRL2 bits
962  */
963 #define RMIXL_UG_CTRL2_RESa		__BITS(31,20)
964 #define RMIXL_UG_CTRL2_TX_TUNE_1	__BITS(19,18)	/* Port_1 Transmitter Tuning for High-Speed Operation.
965 							 *  00: ~-4.5%
966 							 *  01: Design default
967 							 *  10: ~+4.5%
968 							 *  11: ~+9% = Recommended Operating setting
969 							 */
970 #define RMIXL_UG_CTRL2_TX_TUNE_0	__BITS(17,16)	/* Port_0 Transmitter Tuning for High-Speed Operation
971 							 *  11:  Recommended Operating condition
972 							 */
973 #define RMIXL_UG_CTRL2_RESb		__BIT(15)
974 #define RMIXL_UG_CTRL2_WEAK_PDEN	__BIT(14)	/* 500kOhm Pull-Down Resistor on D+ and D- Enable */
975 #define RMIXL_UG_CTRL2_DP_PULLUP_ESD	__BIT(13)	/* D+ Pull-Up Resistor Enable */
976 #define RMIXL_UG_CTRL2_ESD_TEST_MODE	__BIT(12)	/* D+ Pull-Up Resistor Control Select */
977 #define RMIXL_UG_CTRL2_TX_BIT_STUFF_EN_H_1	\
978 					__BIT(11)	/* Port_1 High-Byte Transmit Bit-Stuffing Enable */
979 #define RMIXL_UG_CTRL2_TX_BIT_STUFF_EN_H_0	\
980 					__BIT(10)	/* Port_0 High-Byte Transmit Bit-Stuffing Enable */
981 #define RMIXL_UG_CTRL2_TX_BIT_STUFF_EN_L_1	\
982 					__BIT(9)	/* Port_1 Low-Byte Transmit Bit-Stuffing Enable */
983 #define RMIXL_UG_CTRL2_TX_BIT_STUFF_EN_L_0	\
984 					__BIT(8)	/* Port_0 Low-Byte Transmit Bit-Stuffing Enable */
985 #define RMIXL_UG_CTRL2_RESc		__BITS(7,6)
986 #define RMIXL_UG_CTRL2_LOOPBACK_ENB_1	__BIT(5)	/* Port_1 Loopback Test Enable */
987 #define RMIXL_UG_CTRL2_LOOPBACK_ENB_0	__BIT(4)	/* Port_0 Loopback Test Enable */
988 #define RMIXL_UG_CTRL2_DEVICE_VBUS	__BIT(3)	/* VBUS detected (Device mode only) */
989 #define RMIXL_UG_CTRL2_PHY_PORT_RST_1	__BIT(2)	/* Resets Port_1 of the PHY
990 							 *  1: normal operation
991 							 *  0: reset
992 							 */
993 #define RMIXL_UG_CTRL2_PHY_PORT_RST_0	__BIT(1)	/* Resets Port_0 of the PHY
994 							 *  1: normal operation
995 							 *  0: reset
996 							 */
997 #define RMIXL_UG_CTRL2_PHY_RST		__BIT(0)	/* Resets the PHY
998 							 *  1: normal operation
999 							 *  0: reset
1000 							 */
1001 #define RMIXL_UG_CTRL2_RESV	\
1002 	(RMIXL_UG_CTRL2_RESa | RMIXL_UG_CTRL2_RESb | RMIXL_UG_CTRL2_RESc)
1003 
1004 
1005 /*
1006  * RMIXL_USB_GEN_CTRL3 bits
1007  */
1008 #define RMIXL_UG_CTRL3_RESa		__BITS(31,11)
1009 #define RMIXL_UG_CTRL3_PREFETCH_SIZE	__BITS(10,8)	/* The pre-fetch size for a memory read transfer
1010 							 * between USB Interface and DI station.
1011 							 * Valid value ranges is from 1 to 4.
1012 							 */
1013 #define RMIXL_UG_CTRL3_RESb		__BIT(7)
1014 #define RMIXL_UG_CTRL3_DEV_UPPERADDR	__BITS(6,1)	/* Device controller address space selector */
1015 #define RMIXL_UG_CTRL3_USB_FLUSH	__BIT(0)	/* Flush the USB interface */
1016 
1017 /*
1018  * RMIXL_USB_PHY_STATUS bits
1019  */
1020 #define RMIXL_UB_PHY_STATUS_RESV	__BITS(31,1)
1021 #define RMIXL_UB_PHY_STATUS_VBUS	__BIT(0)	/* USB VBUS status */
1022 
1023 /*
1024  * RMIXL_USB_INTERRUPT_STATUS and RMIXL_USB_INTERRUPT_ENABLE bits
1025  */
1026 #define RMIXL_UB_INTERRUPT_RESV		__BITS(31,6)
1027 #define RMIXL_UB_INTERRUPT_FORCE	__BIT(5)	/* USB force interrupt */
1028 #define RMIXL_UB_INTERRUPT_PHY		__BIT(4)	/* USB PHY interrupt */
1029 #define RMIXL_UB_INTERRUPT_DEV		__BIT(3)	/* USB Device Controller interrupt */
1030 #define RMIXL_UB_INTERRUPT_EHCI		__BIT(2)	/* USB EHCI interrupt */
1031 #define RMIXL_UB_INTERRUPT_OHCI_1	__BIT(1)	/* USB OHCI #1 interrupt */
1032 #define RMIXL_UB_INTERRUPT_OHCI_0	__BIT(0)	/* USB OHCI #0 interrupt */
1033 #define RMIXL_UB_INTERRUPT_MAX		5
1034 
1035 
1036 /*
1037  * USB Device Controller registers
1038  * these are opffset from REGSPACE selected by __BIT(12) == 0
1039  *	RMIXL_IOREG_VADDR(RMIXL_IO_DEV_USB_A + reg)
1040  * see Table 18-7 in the XLS PRM
1041  */
1042 #define RMIXL_USB_UDC_GAHBCFG		0x008	/* UDC Configuration A (UDC_GAHBCFG) */
1043 #define RMIXL_USB_UDC_GUSBCFG		0x00C	/* UDC Configuration B (UDC_GUSBCFG) */
1044 #define RMIXL_USB_UDC_GRSTCTL		0x010	/* UDC Reset */
1045 #define RMIXL_USB_UDC_GINTSTS		0x014	/* UDC Interrupt Register */
1046 #define RMIXL_USB_UDC_GINTMSK		0x018	/* UDC Interrupt Mask Register */
1047 #define RMIXL_USB_UDC_GRXSTSP		0x020	/* UDC Receive Status Read /Pop Register (Read Only) */
1048 #define RMIXL_USB_UDC_GRXFSIZ		0x024	/* UDC Receive FIFO Size Register */
1049 #define RMIXL_USB_UDC_GNPTXFSIZ		0x028	/* UDC Non-periodic Transmit FIFO Size Register */
1050 #define RMIXL_USB_UDC_GUID		0x03C	/* UDC User ID Register (UDC_GUID) */
1051 #define RMIXL_USB_UDC_GSNPSID		0x040	/* UDC ID Register (Read Only) */
1052 #define RMIXL_USB_UDC_GHWCFG1		0x044	/* UDC User HW Config1 Register (Read Only) */
1053 #define RMIXL_USB_UDC_GHWCFG2		0x048	/* UDC User HW Config2 Register (Read Only) */
1054 #define RMIXL_USB_UDC_GHWCFG3		0x04C	/* UDC User HW Config3 Register (Read Only) */
1055 #define RMIXL_USB_UDC_GHWCFG4		0x050	/* UDC User HW Config4 Register (Read Only) */
1056 #define RMIXL_USB_UDC_DPTXFSIZ0		0x104
1057 #define RMIXL_USB_UDC_DPTXFSIZ1		0x108
1058 #define RMIXL_USB_UDC_DPTXFSIZ2		0x10c
1059 #define RMIXL_USB_UDC_DPTXFSIZn(n)	(0x104 + (4 * (n)))
1060 						/* UDC Device IN Endpoint Transmit FIFO-n
1061 						   Size Registers (UDC_DPTXFSIZn) */
1062 #define RMIXL_USB_UDC_DCFG		0x800	/* UDC Configuration C */
1063 #define RMIXL_USB_UDC_DCTL		0x804	/* UDC Control Register */
1064 #define RMIXL_USB_UDC_DSTS		0x808	/* UDC Status Register (Read Only) */
1065 #define RMIXL_USB_UDC_DIEPMSK		0x810	/* UDC Device IN Endpoint Common
1066 						   Interrupt Mask Register (UDC_DIEPMSK) */
1067 #define RMIXL_USB_UDC_DOEPMSK		0x814	/* UDC Device OUT Endpoint Common Interrupt Mask register */
1068 #define RMIXL_USB_UDC_DAINT		0x818	/* UDC Device All Endpoints Interrupt Register */
1069 #define RMIXL_USB_UDC_DAINTMSK		0x81C	/* UDC Device All Endpoints Interrupt Mask Register */
1070 #define RMIXL_USB_UDC_DTKNQR3		0x830	/* Device Threshold Control Register */
1071 #define RMIXL_USB_UDC_DTKNQR4		0x834	/* Device IN Endpoint FIFO Empty Interrupt Mask Register */
1072 #define RMIXL_USB_UDC_DIEPCTL		0x900	/* Device Control IN Endpoint 0 Control Register */
1073 #define RMIXL_USB_UDC_DIEPINT		0x908	/* Device IN Endpoint 0 Interrupt Register */
1074 #define RMIXL_USB_UDC_DIEPTSIZ		0x910	/* Device IN Endpoint 0 Transfer Size Register */
1075 #define RMIXL_USB_UDC_DIEPDMA		0x914	/* Device IN Endpoint 0 DMA Address Register */
1076 #define RMIXL_USB_UDC_DTXFSTS		0x918	/* Device IN Endpoint Transmit FIFO Status Register */
1077 #define RMIXL_USB_DEV_IN_ENDPT(d,n)	(0x920 + ((d) * 0x20) + ((n) * 4))
1078 						/* Device IN Endpoint #d Register #n */
1079 
1080 /*
1081  * USB Host Controller register base addrs
1082  * these are offset from REGSPACE selected by __BIT(12) == 0
1083  *	RMIXL_IOREG_VADDR(RMIXL_IO_DEV_USB_A + reg)
1084  * see Table 18-14 in the XLS PRM
1085  * specific Host Controller is selected by __BITS(11,10)
1086  */
1087 #define RMIXL_USB_HOST_EHCI_BASE	0x000
1088 #define RMIXL_USB_HOST_0HCI0_BASE	0x400
1089 #define RMIXL_USB_HOST_0HCI1_BASE	0x800
1090 #define RMIXL_USB_HOST_RESV		0xc00
1091 #define RMIXL_USB_HOST_MASK		0xc00
1092 
1093 
1094 /*
1095  * FMN non-core station configuration registers
1096  */
1097 #define RMIXL_FMN_BS_FIRST		_RMIXL_OFFSET(0x320)
1098 
1099 /*
1100  * SGMII bucket size regs
1101  */
1102 #define RMIXL_FMN_BS_SGMII_UNUSED0	_RMIXL_OFFSET(0x320)	/* initialize as 0 */
1103 #define RMIXL_FMN_BS_SGMII_FCB		_RMIXL_OFFSET(0x321)	/* Free Credit Bucket size */
1104 #define RMIXL_FMN_BS_SGMII_TX0		_RMIXL_OFFSET(0x322)
1105 #define RMIXL_FMN_BS_SGMII_TX1		_RMIXL_OFFSET(0x323)
1106 #define RMIXL_FMN_BS_SGMII_TX2		_RMIXL_OFFSET(0x324)
1107 #define RMIXL_FMN_BS_SGMII_TX3		_RMIXL_OFFSET(0x325)
1108 #define RMIXL_FMN_BS_SGMII_UNUSED1	_RMIXL_OFFSET(0x326)	/* initialize as 0 */
1109 #define RMIXL_FMN_BS_SGMII_FCB1		_RMIXL_OFFSET(0x327)	/* Free Credit Bucket1 size */
1110 
1111 /*
1112  * SAE bucket size regs
1113  */
1114 #define RMIXL_FMN_BS_SAE_PIPE0		_RMIXL_OFFSET(0x320)
1115 #define RMIXL_FMN_BS_SAE_RSA_PIPE	_RMIXL_OFFSET(0x321)
1116 
1117 /*
1118  * DMA bucket size regs
1119  */
1120 #define RMIXL_FMN_BS_DMA_CHAN0		_RMIXL_OFFSET(0x320)
1121 #define RMIXL_FMN_BS_DMA_CHAN1		_RMIXL_OFFSET(0x321)
1122 #define RMIXL_FMN_BS_DMA_CHAN2		_RMIXL_OFFSET(0x322)
1123 #define RMIXL_FMN_BS_DMA_CHAN3		_RMIXL_OFFSET(0x323)
1124 
1125 /*
1126  * CDE bucket size regs
1127  */
1128 #define RMIXL_FMN_BS_CDE_FREE_DESC	_RMIXL_OFFSET(0x320)
1129 #define RMIXL_FMN_BS_CDE_COMPDECOMP	_RMIXL_OFFSET(0x321)
1130 
1131 /*
1132  * PCIe bucket size regs
1133  */
1134 #define RMIXL_FMN_BS_PCIE_TX0		_RMIXL_OFFSET(0x320)
1135 #define RMIXL_FMN_BS_PCIE_RX0		_RMIXL_OFFSET(0x321)
1136 #define RMIXL_FMN_BS_PCIE_TX1		_RMIXL_OFFSET(0x322)
1137 #define RMIXL_FMN_BS_PCIE_RX1		_RMIXL_OFFSET(0x323)
1138 #define RMIXL_FMN_BS_PCIE_TX2		_RMIXL_OFFSET(0x324)
1139 #define RMIXL_FMN_BS_PCIE_RX2		_RMIXL_OFFSET(0x325)
1140 #define RMIXL_FMN_BS_PCIE_TX3		_RMIXL_OFFSET(0x326)
1141 #define RMIXL_FMN_BS_PCIE_RX3		_RMIXL_OFFSET(0x327)
1142 
1143 /*
1144  * non-core Credit Counter offsets
1145  */
1146 #define RMIXL_FMN_CC_FIRST		_RMIXL_OFFSET(0x380)
1147 #define RMIXL_FMN_CC_LAST		_RMIXL_OFFSET(0x3ff)
1148 
1149 /*
1150  * non-core Credit Counter bit defines
1151  */
1152 #define RMIXL_FMN_CC_RESV		__BITS(31,8)
1153 #define RMIXL_FMN_CC_COUNT		__BITS(7,0)
1154 
1155 #endif	/* _MIPS_RMI_RMIRMIXLEGS_H_ */
1156 
1157