xref: /freebsd/sys/dev/neta/if_mvnetareg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1a8d7fc4aSZbigniew Bodek /*
2a8d7fc4aSZbigniew Bodek  * Copyright (c) 2017 Stormshield.
3a8d7fc4aSZbigniew Bodek  * Copyright (c) 2017 Semihalf.
4a8d7fc4aSZbigniew Bodek  * Copyright (c) 2015 Internet Initiative Japan Inc.
5a8d7fc4aSZbigniew Bodek  * All rights reserved.
6a8d7fc4aSZbigniew Bodek  *
7a8d7fc4aSZbigniew Bodek  * Redistribution and use in source and binary forms, with or without
8a8d7fc4aSZbigniew Bodek  * modification, are permitted provided that the following conditions
9a8d7fc4aSZbigniew Bodek  * are met:
10a8d7fc4aSZbigniew Bodek  * 1. Redistributions of source code must retain the above copyright
11a8d7fc4aSZbigniew Bodek  *    notice, this list of conditions and the following disclaimer.
12a8d7fc4aSZbigniew Bodek  * 2. Redistributions in binary form must reproduce the above copyright
13a8d7fc4aSZbigniew Bodek  *    notice, this list of conditions and the following disclaimer in the
14a8d7fc4aSZbigniew Bodek  *    documentation and/or other materials provided with the distribution.
15a8d7fc4aSZbigniew Bodek  *
16a8d7fc4aSZbigniew Bodek  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17a8d7fc4aSZbigniew Bodek  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18a8d7fc4aSZbigniew Bodek  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19a8d7fc4aSZbigniew Bodek  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20a8d7fc4aSZbigniew Bodek  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21a8d7fc4aSZbigniew Bodek  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22a8d7fc4aSZbigniew Bodek  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23a8d7fc4aSZbigniew Bodek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24a8d7fc4aSZbigniew Bodek  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25a8d7fc4aSZbigniew Bodek  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26a8d7fc4aSZbigniew Bodek  * POSSIBILITY OF SUCH DAMAGE.
27a8d7fc4aSZbigniew Bodek  *
28a8d7fc4aSZbigniew Bodek  */
29a8d7fc4aSZbigniew Bodek 
30a8d7fc4aSZbigniew Bodek #ifndef _IF_MVNETAREG_H_
31a8d7fc4aSZbigniew Bodek #define	_IF_MVNETAREG_H_
32a8d7fc4aSZbigniew Bodek 
33*bef67a0fSMateusz Guzik #include "opt_mvneta.h"
34*bef67a0fSMateusz Guzik 
35a8d7fc4aSZbigniew Bodek #if BYTE_ORDER == BIG_ENDIAN
36a8d7fc4aSZbigniew Bodek #error "BIG ENDIAN not supported"
37a8d7fc4aSZbigniew Bodek #endif
38a8d7fc4aSZbigniew Bodek 
39a8d7fc4aSZbigniew Bodek #define	MVNETA_SIZE		0x4000
40a8d7fc4aSZbigniew Bodek 
41a8d7fc4aSZbigniew Bodek #define	MVNETA_NWINDOW		6
42a8d7fc4aSZbigniew Bodek #define	MVNETA_NREMAP		4
43a8d7fc4aSZbigniew Bodek 
44a8d7fc4aSZbigniew Bodek #define	MVNETA_MAX_QUEUE_SIZE	8
45a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_QNUM_MAX	1
46a8d7fc4aSZbigniew Bodek /* XXX: Currently multi-queue can be used on the Tx side only */
47a8d7fc4aSZbigniew Bodek #ifdef MVNETA_MULTIQUEUE
48a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_QNUM_MAX	2
49a8d7fc4aSZbigniew Bodek #else
50a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_QNUM_MAX	1
51a8d7fc4aSZbigniew Bodek #endif
52a8d7fc4aSZbigniew Bodek 
53a8d7fc4aSZbigniew Bodek #if MVNETA_TX_QNUM_MAX & (MVNETA_TX_QNUM_MAX - 1) != 0
54a8d7fc4aSZbigniew Bodek #error "MVNETA_TX_QNUM_MAX Should be a power of 2"
55a8d7fc4aSZbigniew Bodek #endif
56a8d7fc4aSZbigniew Bodek #if MVNETA_RX_QNUM_MAX & (MVNETA_RX_QNUM_MAX - 1) != 0
57a8d7fc4aSZbigniew Bodek #error "MVNETA_RX_QNUM_MAX Should be a power of 2"
58a8d7fc4aSZbigniew Bodek #endif
59a8d7fc4aSZbigniew Bodek 
60a8d7fc4aSZbigniew Bodek #define	MVNETA_QUEUE(n)		(1 << (n))
61a8d7fc4aSZbigniew Bodek #define	MVNETA_QUEUE_ALL	0xff
62a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_QUEUE_ALL	((1<<MVNETA_TX_QNUM_MAX)-1)
63a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_QUEUE_ALL	((1<<MVNETA_RX_QNUM_MAX)-1)
64a8d7fc4aSZbigniew Bodek 
65a8d7fc4aSZbigniew Bodek /*
66a8d7fc4aSZbigniew Bodek  * Ethernet Unit Registers
67a8d7fc4aSZbigniew Bodek  *  GbE0 BASE 0x00007.0000 SIZE 0x4000
68a8d7fc4aSZbigniew Bodek  *  GbE1 BASE 0x00007.4000 SIZE 0x4000
69a8d7fc4aSZbigniew Bodek  *
70a8d7fc4aSZbigniew Bodek  * TBD: reasonable bus space submapping....
71a8d7fc4aSZbigniew Bodek  */
72a8d7fc4aSZbigniew Bodek /* Address Decoder Registers */
73a8d7fc4aSZbigniew Bodek #define	MVNETA_BASEADDR(n)	(0x2200 + ((n) << 3))	/* Base Address */
74a8d7fc4aSZbigniew Bodek #define	MVNETA_S(n)		(0x2204 + ((n) << 3))	/* Size */
75a8d7fc4aSZbigniew Bodek #define	MVNETA_HA(n)		(0x2280 + ((n) << 2))	/* High Address Remap */
76a8d7fc4aSZbigniew Bodek #define	MVNETA_BARE		0x2290	/* Base Address Enable */
77a8d7fc4aSZbigniew Bodek #define	MVNETA_EPAP		0x2294	/* Ethernet Port Access Protect */
78a8d7fc4aSZbigniew Bodek 
79a8d7fc4aSZbigniew Bodek /* Global Miscellaneous Registers */
80a8d7fc4aSZbigniew Bodek #define	MVNETA_PHYADDR		0x2000
81a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI		0x2004
82a8d7fc4aSZbigniew Bodek #define	MVNETA_EUDA		0x2008	/* Ethernet Unit Default Address */
83a8d7fc4aSZbigniew Bodek #define	MVNETA_EUDID		0x200c	/* Ethernet Unit Default ID */
84a8d7fc4aSZbigniew Bodek #define	MVNETA_MBUS_CONF	0x2010	/* MBUS configuration */
85a8d7fc4aSZbigniew Bodek #define	MVNETA_MBUS_RETRY_EN	0x20	/* MBUS transactions retry enable */
86a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC		0x2080	/* Ethernet Unit Interrupt Cause */
87a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIM		0x2084	/* Ethernet Unit Interrupt Mask */
88a8d7fc4aSZbigniew Bodek #define	MVNETA_EUEA		0x2094	/* Ethernet Unit Error Address */
89a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIAE		0x2098	/* Ethernet Unit Internal Addr Error */
90a8d7fc4aSZbigniew Bodek #define	MVNETA_EUC		0x20b0	/* Ethernet Unit Control */
91a8d7fc4aSZbigniew Bodek 
92a8d7fc4aSZbigniew Bodek /* Miscellaneous Registers */
93a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC		0x241c	/* SDMA Configuration */
94a8d7fc4aSZbigniew Bodek 
95a8d7fc4aSZbigniew Bodek /* Networking Controller Miscellaneous Registers */
96a8d7fc4aSZbigniew Bodek #define	MVNETA_PACC		0x2500	/* Port Acceleration Mode */
97a8d7fc4aSZbigniew Bodek #define	MVNETA_PV		0x25bc	/* Port Version */
98a8d7fc4aSZbigniew Bodek 
99a8d7fc4aSZbigniew Bodek /* Rx DMA Hardware Parser Registers */
100a8d7fc4aSZbigniew Bodek #define	MVNETA_EVLANE		0x2410	/* VLAN EtherType */
101a8d7fc4aSZbigniew Bodek #define	MVNETA_MACAL		0x2414	/* MAC Address Low */
102a8d7fc4aSZbigniew Bodek #define	MVNETA_MACAH		0x2418	/* MAC Address High */
103a8d7fc4aSZbigniew Bodek #define	MVNETA_NDSCP		7
104a8d7fc4aSZbigniew Bodek #define	MVNETA_DSCP(n)		(0x2420 + ((n) << 2))
105a8d7fc4aSZbigniew Bodek #define	MVNETA_VPT2P		0x2440	/* VLAN Priority Tag to Priority */
106a8d7fc4aSZbigniew Bodek #define	MVNETA_ETP		0x24bc	/* Ethernet Type Priority */
107a8d7fc4aSZbigniew Bodek #define	MVNETA_NDFSMT		64
108a8d7fc4aSZbigniew Bodek #define	MVNETA_DFSMT(n)		(0x3400 + ((n) << 2))
109a8d7fc4aSZbigniew Bodek 			/* Destination Address Filter Special Multicast Table */
110a8d7fc4aSZbigniew Bodek #define	MVNETA_NDFOMT		64
111a8d7fc4aSZbigniew Bodek #define	MVNETA_DFOMT(n)		(0x3500 + ((n) << 2))
112a8d7fc4aSZbigniew Bodek 			/* Destination Address Filter Other Multicast Table */
113a8d7fc4aSZbigniew Bodek #define	MVNETA_NDFUT		4
114a8d7fc4aSZbigniew Bodek #define	MVNETA_DFUT(n)		(0x3600 + ((n) << 2))
115a8d7fc4aSZbigniew Bodek 			/* Destination Address Filter Unicast Table */
116a8d7fc4aSZbigniew Bodek 
117a8d7fc4aSZbigniew Bodek /* Rx DMA Miscellaneous Registers */
118a8d7fc4aSZbigniew Bodek #define	MVNETA_PMFS		0x247c	/* Port Rx Minimal Frame Size */
119a8d7fc4aSZbigniew Bodek #define	MVNETA_PDFC		0x2484	/* Port Rx Discard Frame Counter */
120a8d7fc4aSZbigniew Bodek #define	MVNETA_POFC		0x2488	/* Port Overrun Frame Counter */
121a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC		0x2680	/* Receive Queue Command */
122a8d7fc4aSZbigniew Bodek 
123a8d7fc4aSZbigniew Bodek /* Rx DMA Networking Controller Miscellaneous Registers */
124a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXC(q)		(0x1400 + ((q) << 2)) /*Port RX queues Config*/
125a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXSNP(q)	(0x1420 + ((q) << 2)) /* Port RX queues Snoop */
126a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQA(q)	(0x1480 + ((q) << 2)) /*P RXqueues desc Q Addr*/
127a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQS(q)	(0x14a0 + ((q) << 2)) /*P RXqueues desc Q Size*/
128a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQTH(q)	(0x14c0 + ((q) << 2)) /*P RXqueues desc Q Thrs*/
129a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXS(q)		(0x14e0 + ((q) << 2)) /*Port RX queues Status */
130a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXSU(q)		(0x1500 + ((q) << 2)) /*P RXqueues Stat Update*/
131a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDI(q)		(0x1520 + ((q) << 2)) /*P RXqueues Stat Update*/
132a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXINIT		0x1cc0	/* Port RX Initialization */
133a8d7fc4aSZbigniew Bodek 
134a8d7fc4aSZbigniew Bodek /* Rx DMA Wake on LAN Registers	0x3690 - 0x36b8 */
135a8d7fc4aSZbigniew Bodek 
136a8d7fc4aSZbigniew Bodek /* Tx DMA Miscellaneous Registers */
137a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC		0x2448	/* Transmit Queue Command */
138a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_1		0x24e4
139a8d7fc4aSZbigniew Bodek #define	MVNETA_PXTFTT		0x2478	/* Port Tx FIFO Threshold */
140a8d7fc4aSZbigniew Bodek #define	MVNETA_TXBADFCS		0x3cc0	/*Tx Bad FCS Transmitted Pckts Counter*/
141a8d7fc4aSZbigniew Bodek #define	MVNETA_TXDROPPED		0x3cc4	/* Tx Dropped Packets Counter */
142a8d7fc4aSZbigniew Bodek 
143a8d7fc4aSZbigniew Bodek /* Tx DMA Networking Controller Miscellaneous Registers */
144a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDQA(q)	(0x3c00 + ((q) << 2)) /*P TXqueues desc Q Addr*/
145a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDQS(q)	(0x3c20 + ((q) << 2)) /*P TXqueues desc Q Size*/
146a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXS(q)		(0x3c40 + ((q) << 2)) /* Port TX queues Status*/
147a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXSU(q)		(0x3c60 + ((q) << 2)) /*P TXqueues Stat Update*/
148a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDI(q)		(0x3c80 + ((q) << 2)) /* P TXqueues Desc Index*/
149a8d7fc4aSZbigniew Bodek #define	MVNETA_TXTBC(q)		(0x3ca0 + ((q) << 2)) /* TX Trans-ed Buf Count*/
150a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXINIT		0x3cf0	/* Port TX Initialization */
151a8d7fc4aSZbigniew Bodek 
152a8d7fc4aSZbigniew Bodek /* Tx DMA Packet Modification Registers */
153a8d7fc4aSZbigniew Bodek #define	MVNETA_NMH		15
154a8d7fc4aSZbigniew Bodek #define	MVNETA_TXMH(n)		(0x3d44 + ((n) << 2))
155a8d7fc4aSZbigniew Bodek #define	MVNETA_TXMTU		0x3d88
156a8d7fc4aSZbigniew Bodek 
157a8d7fc4aSZbigniew Bodek /* Tx DMA Queue Arbiter Registers (Version 1) */
158a8d7fc4aSZbigniew Bodek #define	MVNETA_TQFPC_V1		0x24dc	/* Transmit Queue Fixed Priority Cfg */
159a8d7fc4aSZbigniew Bodek #define	MVNETA_TQTBC_V1		0x24e0	/* Transmit Queue Token-Bucket Cfg */
160a8d7fc4aSZbigniew Bodek #define	MVNETA_MTU_V1		0x24e8	/* MTU */
161a8d7fc4aSZbigniew Bodek #define	MVNETA_PMTBS_V1		0x24ec	/* Port Max Token-Bucket Size */
162a8d7fc4aSZbigniew Bodek #define	MVNETA_TQTBCOUNT_V1(q)	(0x2700 + ((q) << 4))
163a8d7fc4aSZbigniew Bodek 				/* Transmit Queue Token-Bucket Counter */
164a8d7fc4aSZbigniew Bodek #define	MVNETA_TQTBCONFIG_V1(q)	(0x2704 + ((q) << 4))
165a8d7fc4aSZbigniew Bodek 				/* Transmit Queue Token-Bucket Configuration */
166a8d7fc4aSZbigniew Bodek #define	MVNETA_PTTBC_V1		0x2740	/* Port Transmit Backet Counter */
167a8d7fc4aSZbigniew Bodek 
168a8d7fc4aSZbigniew Bodek /* Tx DMA Queue Arbiter Registers (Version 3) */
169a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC1_V3		0x3e00	/* Transmit Queue Command1 */
170a8d7fc4aSZbigniew Bodek #define	MVNETA_TQFPC_V3		0x3e04	/* Transmit Queue Fixed Priority Cfg */
171a8d7fc4aSZbigniew Bodek #define	MVNETA_BRC_V3		0x3e08	/* Basic Refill No of Clocks */
172a8d7fc4aSZbigniew Bodek #define	MVNETA_MTU_V3		0x3e0c	/* MTU */
173a8d7fc4aSZbigniew Bodek #define	MVNETA_PREFILL_V3	0x3e10	/* Port Backet Refill */
174a8d7fc4aSZbigniew Bodek #define	MVNETA_PMTBS_V3		0x3e14	/* Port Max Token-Bucket Size */
175a8d7fc4aSZbigniew Bodek #define	MVNETA_QREFILL_V3(q)	(0x3e20 + ((q) << 2))
176a8d7fc4aSZbigniew Bodek 				/* Transmit Queue Refill */
177a8d7fc4aSZbigniew Bodek #define	MVNETA_QMTBS_V3(q)	(0x3e40 + ((q) << 2))
178a8d7fc4aSZbigniew Bodek 				/* Transmit Queue Max Token-Bucket Size */
179a8d7fc4aSZbigniew Bodek #define	MVNETA_QTTBC_V3(q)	(0x3e60 + ((q) << 2))
180a8d7fc4aSZbigniew Bodek 				/* Transmit Queue Token-Bucket Counter */
181a8d7fc4aSZbigniew Bodek #define	MVNETA_TQAC_V3(q)	(0x3e80 + ((q) << 2))
182a8d7fc4aSZbigniew Bodek 				/* Transmit Queue Arbiter Cfg */
183a8d7fc4aSZbigniew Bodek #define	MVNETA_TQIPG_V3(q)	(0x3ea0 + ((q) << 2))
184a8d7fc4aSZbigniew Bodek 				/* Transmit Queue IPG(valid q=2..3) */
185a8d7fc4aSZbigniew Bodek #define	MVNETA_HITKNINLOPKT_V3	0x3eb0	/* High Token in Low Packet */
186a8d7fc4aSZbigniew Bodek #define	MVNETA_HITKNINASYNCPKT_V3	0x3eb4	/* High Token in Async Packet */
187a8d7fc4aSZbigniew Bodek #define	MVNETA_LOTKNINASYNCPKT_V3	0x3eb8	/* Low Token in Async Packet */
188a8d7fc4aSZbigniew Bodek #define	MVNETA_TS_V3		0x3ebc	/* Token Speed */
189a8d7fc4aSZbigniew Bodek 
190a8d7fc4aSZbigniew Bodek /* RX_TX DMA Registers */
191a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC		0x2400	/* Port Configuration */
192a8d7fc4aSZbigniew Bodek #define	MVNETA_PXCX		0x2404	/* Port Configuration Extend */
193a8d7fc4aSZbigniew Bodek #define	MVNETA_MH		0x2454	/* Marvell Header */
194a8d7fc4aSZbigniew Bodek 
195a8d7fc4aSZbigniew Bodek /* Serial(SMI/MII) Registers */
196a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0		0x243c	/* Port Serial Control0 */
197a8d7fc4aSZbigniew Bodek #define	MVNETA_PS0		0x2444	/* Ethernet Port Status */
198a8d7fc4aSZbigniew Bodek #define	MVNETA_PSERDESCFG	0x24a0	/* Serdes Configuration */
199a8d7fc4aSZbigniew Bodek #define	MVNETA_PSERDESSTS	0x24a4	/* Serdes Status */
200a8d7fc4aSZbigniew Bodek #define	MVNETA_PSOMSCD		0x24f4	/* One mS Clock Divider */
201a8d7fc4aSZbigniew Bodek #define	MVNETA_PSPFCCD		0x24f8	/* Periodic Flow Control Clock Divider*/
202a8d7fc4aSZbigniew Bodek 
203a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet MAC Serial Parameters Configuration Registers */
204a8d7fc4aSZbigniew Bodek #define	MVNETA_PSPC		0x2c14	/* Port Serial Parameters Config */
205a8d7fc4aSZbigniew Bodek #define	MVNETA_PSP1C		0x2c94	/* Port Serial Parameters 1 Config */
206a8d7fc4aSZbigniew Bodek 
207a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet Auto-Negotiation Configuration Registers */
208a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC		0x2c0c	/* Port Auto-Negotiation Configuration*/
209a8d7fc4aSZbigniew Bodek 
210a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet MAC Control Registers */
211a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC0		0x2c00	/* Port MAC Control 0 */
212a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC1		0x2c04	/* Port MAC Control 1 */
213a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2		0x2c08	/* Port MAC Control 2 */
214a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC3		0x2c48	/* Port MAC Control 3 */
215a8d7fc4aSZbigniew Bodek #define	MVNETA_CCFCPST(p)	(0x2c58 + ((p) << 2)) /*CCFC Port Speed Timerp*/
216a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC4		0x2c90	/* Port MAC Control 4 */
217a8d7fc4aSZbigniew Bodek 
218a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet MAC Interrupt Registers */
219a8d7fc4aSZbigniew Bodek #define	MVNETA_PIC		0x2c20
220a8d7fc4aSZbigniew Bodek #define	MVNETA_PIM		0x2c24
221a8d7fc4aSZbigniew Bodek 
222a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet Low Power Idle  Registers */
223a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC0		0x2cc0	/* LowPowerIdle control 0 */
224a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC1		0x2cc4	/* LPI control 1 */
225a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC2		0x2cc8	/* LPI control 2 */
226a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIS		0x2ccc	/* LPI status */
227a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC		0x2cd0	/* LPI counter */
228a8d7fc4aSZbigniew Bodek 
229a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet MAC PRBS Check Status Registers */
230a8d7fc4aSZbigniew Bodek #define	MVNETA_PPRBSS		0x2c38	/* Port PRBS Status */
231a8d7fc4aSZbigniew Bodek #define	MVNETA_PPRBSEC		0x2c3c	/* Port PRBS Error Counter */
232a8d7fc4aSZbigniew Bodek 
233a8d7fc4aSZbigniew Bodek /* Gigabit Ethernet MAC Status Registers */
234a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR		0x2c10	/* Port Status Register0 */
235a8d7fc4aSZbigniew Bodek 
236a8d7fc4aSZbigniew Bodek /* Networking Controller Interrupt Registers */
237a8d7fc4aSZbigniew Bodek #define	MVNETA_PCP2Q(cpu)	(0x2540 + ((cpu) << 2))
238a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXITTH(q)	(0x2580 + ((q) << 2))
239a8d7fc4aSZbigniew Bodek 				/* Port Rx Interrupt Threshold */
240a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTIC		0x25a0	/*Port RX_TX Threshold Interrupt Cause*/
241a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTIM		0x25a4	/*Port RX_TX Threshold Interrupt Mask */
242a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXIC		0x25a8	/* Port RX_TX Interrupt Cause */
243a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXIM		0x25ac	/* Port RX_TX Interrupt Mask */
244a8d7fc4aSZbigniew Bodek #define	MVNETA_PMIC		0x25b0	/* Port Misc Interrupt Cause */
245a8d7fc4aSZbigniew Bodek #define	MVNETA_PMIM		0x25b4	/* Port Misc Interrupt Mask */
246a8d7fc4aSZbigniew Bodek #define	MVNETA_PIE		0x25b8	/* Port Interrupt Enable */
247a8d7fc4aSZbigniew Bodek #define	MVNETA_PSNPCFG		0x25e4	/* Port Snoop Config */
248a8d7fc4aSZbigniew Bodek #define	MVNETA_PSNPCFG_DESCSNP_MASK	(0x3 << 4)
249a8d7fc4aSZbigniew Bodek #define	MVNETA_PSNPCFG_BUFSNP_MASK	(0x3 << 8)
250a8d7fc4aSZbigniew Bodek 
251a8d7fc4aSZbigniew Bodek /* Miscellaneous Interrupt Registers */
252a8d7fc4aSZbigniew Bodek #define	MVNETA_PEUIAE		0x2494	/* Port Internal Address Error */
253a8d7fc4aSZbigniew Bodek 
254a8d7fc4aSZbigniew Bodek /* SGMII PHY Registers */
255a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC		0x2e04	/* Power and PLL Control */
256a8d7fc4aSZbigniew Bodek #define	MVNETA_TESTC0		0x2e54	/* PHY Test Control 0 */
257a8d7fc4aSZbigniew Bodek #define	MVNETA_TESTPRBSEC0	0x2e7c	/* PHY Test PRBS Error Counter 0 */
258a8d7fc4aSZbigniew Bodek #define	MVNETA_TESTPRBSEC1	0x2e80	/* PHY Test PRBS Error Counter 1 */
259a8d7fc4aSZbigniew Bodek #define	MVNETA_TESTOOB0		0x2e84	/* PHY Test OOB 0 */
260a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE		0x2e8c	/* Digital Loopback Enable */
261a8d7fc4aSZbigniew Bodek #define	MVNETA_RCS		0x2f18	/* Reference Clock Select */
262a8d7fc4aSZbigniew Bodek #define	MVNETA_COMPHYC		0x2f18	/* COMPHY Control */
263a8d7fc4aSZbigniew Bodek 
264a8d7fc4aSZbigniew Bodek /*
265a8d7fc4aSZbigniew Bodek  * Ethernet MAC MIB Registers
266a8d7fc4aSZbigniew Bodek  *  GbE0 BASE 0x00007.3000
267a8d7fc4aSZbigniew Bodek  *  GbE1 BASE 0x00007.7000
268a8d7fc4aSZbigniew Bodek  */
269a8d7fc4aSZbigniew Bodek /* MAC MIB Counters			0x3000 - 0x307c */
270a8d7fc4aSZbigniew Bodek #define	MVNETA_PORTMIB_BASE		0x3000
271a8d7fc4aSZbigniew Bodek #define	MVNETA_PORTMIB_SIZE		0x0080
272a8d7fc4aSZbigniew Bodek #define	MVNETA_PORTMIB_NOCOUNTER	30
273a8d7fc4aSZbigniew Bodek 
274a8d7fc4aSZbigniew Bodek /* Rx */
275a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_GOOD_OCT		0x00 /* 64bit */
276a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_BAD_OCT		0x08
277a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_GOOD_FRAME	0x10
278a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_BAD_FRAME		0x14
279a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_BCAST_FRAME	0x18
280a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_MCAST_FRAME	0x1c
281a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_FRAME64_OCT	0x20
282a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_FRAME127_OCT	0x24
283a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_FRAME255_OCT	0x28
284a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_FRAME511_OCT	0x2c
285a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_FRAME1023_OCT	0x30
286a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_RX_FRAMEMAX_OCT	0x34
287a8d7fc4aSZbigniew Bodek 
288a8d7fc4aSZbigniew Bodek /* Tx */
289a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_MAC_TRNS_ERR	0x0c
290a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_GOOD_OCT		0x38 /* 64bit */
291a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_GOOD_FRAME	0x40
292a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_EXCES_COL		0x44
293a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_MCAST_FRAME	0x48
294a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_BCAST_FRAME	0x4c
295a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_TX_MAC_CTL_ERR	0x50
296a8d7fc4aSZbigniew Bodek 
297a8d7fc4aSZbigniew Bodek /* Flow Control */
298a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_FC_SENT		0x54
299a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_FC_GOOD		0x58
300a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_FC_BAD		0x5c
301a8d7fc4aSZbigniew Bodek 
302a8d7fc4aSZbigniew Bodek /* Packet Processing */
303a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_PKT_UNDERSIZE	0x60
304a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_PKT_FRAGMENT		0x64
305a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_PKT_OVERSIZE		0x68
306a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_PKT_JABBER		0x6c
307a8d7fc4aSZbigniew Bodek 
308a8d7fc4aSZbigniew Bodek /* MAC Layer Errors */
309a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_MAC_RX_ERR		0x70
310a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_MAC_CRC_ERR		0x74
311a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_MAC_COL		0x78
312a8d7fc4aSZbigniew Bodek #define	MVNETA_MIB_MAC_LATE_COL		0x7c
313a8d7fc4aSZbigniew Bodek 
314a8d7fc4aSZbigniew Bodek /* END OF REGISTER NUMBERS */
315a8d7fc4aSZbigniew Bodek 
316a8d7fc4aSZbigniew Bodek /*
317a8d7fc4aSZbigniew Bodek  *
318a8d7fc4aSZbigniew Bodek  * Register Formats
319a8d7fc4aSZbigniew Bodek  *
320a8d7fc4aSZbigniew Bodek  */
321a8d7fc4aSZbigniew Bodek /*
322a8d7fc4aSZbigniew Bodek  * Address Decoder Registers
323a8d7fc4aSZbigniew Bodek  */
324a8d7fc4aSZbigniew Bodek /* Base Address (MVNETA_BASEADDR) */
325a8d7fc4aSZbigniew Bodek #define	MVNETA_BASEADDR_TARGET(target)	((target) & 0xf)
326a8d7fc4aSZbigniew Bodek #define	MVNETA_BASEADDR_ATTR(attr)	(((attr) & 0xff) << 8)
327a8d7fc4aSZbigniew Bodek #define	MVNETA_BASEADDR_BASE(base)	((base) & 0xffff0000)
328a8d7fc4aSZbigniew Bodek 
329a8d7fc4aSZbigniew Bodek /* Size (MVNETA_S) */
330a8d7fc4aSZbigniew Bodek #define	MVNETA_S_SIZE(size)		(((size) - 1) & 0xffff0000)
331a8d7fc4aSZbigniew Bodek 
332a8d7fc4aSZbigniew Bodek /* Base Address Enable (MVNETA_BARE) */
333a8d7fc4aSZbigniew Bodek #define	MVNETA_BARE_EN_MASK		((1 << MVNETA_NWINDOW) - 1)
334a8d7fc4aSZbigniew Bodek #define	MVNETA_BARE_EN(win)		((1 << (win)) & MVNETA_BARE_EN_MASK)
335a8d7fc4aSZbigniew Bodek 
336a8d7fc4aSZbigniew Bodek /* Ethernet Port Access Protect (MVNETA_EPAP) */
337a8d7fc4aSZbigniew Bodek #define	MVNETA_EPAP_AC_NAC		0x0	/* No access allowed */
338a8d7fc4aSZbigniew Bodek #define	MVNETA_EPAP_AC_RO		0x1	/* Read Only */
339a8d7fc4aSZbigniew Bodek #define	MVNETA_EPAP_AC_FA		0x3	/* Full access (r/w) */
340a8d7fc4aSZbigniew Bodek #define	MVNETA_EPAP_EPAR(win, ac)	((ac) << ((win) * 2))
341a8d7fc4aSZbigniew Bodek 
342a8d7fc4aSZbigniew Bodek /*
343a8d7fc4aSZbigniew Bodek  * Global Miscellaneous Registers
344a8d7fc4aSZbigniew Bodek  */
345a8d7fc4aSZbigniew Bodek /* PHY Address (MVNETA_PHYADDR) */
346a8d7fc4aSZbigniew Bodek #define	MVNETA_PHYADDR_PHYAD(phy)	((phy) & 0x1f)
347a8d7fc4aSZbigniew Bodek #define	MVNETA_PHYADDR_GET_PHYAD(reg)	((reg) & 0x1f)
348a8d7fc4aSZbigniew Bodek 
349a8d7fc4aSZbigniew Bodek /* SMI register fields (MVNETA_SMI) */
350a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_DATA_MASK		0x0000ffff
351a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_PHYAD(phy)		(((phy) & 0x1f) << 16)
352a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_REGAD(reg)		(((reg) & 0x1f) << 21)
353a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_OPCODE_WRITE		(0 << 26)
354a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_OPCODE_READ		(1 << 26)
355a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_READVALID		(1 << 27)
356a8d7fc4aSZbigniew Bodek #define	MVNETA_SMI_BUSY			(1 << 28)
357a8d7fc4aSZbigniew Bodek 
358a8d7fc4aSZbigniew Bodek /* Ethernet Unit Default ID (MVNETA_EUDID) */
359a8d7fc4aSZbigniew Bodek #define	MVNETA_EUDID_DIDR_MASK		0x0000000f
360a8d7fc4aSZbigniew Bodek #define	MVNETA_EUDID_DIDR(id)		((id) & 0x0f)
361a8d7fc4aSZbigniew Bodek #define	MVNETA_EUDID_DATTR_MASK		0x00000ff0
362a8d7fc4aSZbigniew Bodek #define	MVNETA_EUDID_DATTR(attr)	(((attr) & 0xff) << 4)
363a8d7fc4aSZbigniew Bodek 
364a8d7fc4aSZbigniew Bodek /* Ethernet Unit Interrupt Cause (MVNETA_EUIC) */
365a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_ETHERINTSUM		(1 << 0)
366a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_PARITY		(1 << 1)
367a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_ADDRVIOL		(1 << 2)
368a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_ADDRVNOMATCH	(1 << 3)
369a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_SMIDONE		(1 << 4)
370a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_COUNTWA		(1 << 5)
371a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_INTADDRERR		(1 << 7)
372a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_PORT0DPERR		(1 << 9)
373a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIC_TOPDPERR		(1 << 12)
374a8d7fc4aSZbigniew Bodek 
375a8d7fc4aSZbigniew Bodek /* Ethernet Unit Internal Addr Error (MVNETA_EUIAE) */
376a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIAE_INTADDR_MASK	0x000001ff
377a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIAE_INTADDR(addr)	((addr) & 0x1ff)
378a8d7fc4aSZbigniew Bodek #define	MVNETA_EUIAE_GET_INTADDR(addr)	((addr) & 0x1ff)
379a8d7fc4aSZbigniew Bodek 
380a8d7fc4aSZbigniew Bodek /* Ethernet Unit Control (MVNETA_EUC) */
381a8d7fc4aSZbigniew Bodek #define	MVNETA_EUC_POLLING		(1 << 1)
382a8d7fc4aSZbigniew Bodek #define	MVNETA_EUC_PORTRESET		(1 << 24)
383a8d7fc4aSZbigniew Bodek #define	MVNETA_EUC_RAMSINITIALIZATIONCOMPLETED (1 << 25)
384a8d7fc4aSZbigniew Bodek 
385a8d7fc4aSZbigniew Bodek /*
386a8d7fc4aSZbigniew Bodek  * Miscellaneous Registers
387a8d7fc4aSZbigniew Bodek  */
388a8d7fc4aSZbigniew Bodek /* SDMA Configuration (MVNETA_SDC) */
389a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ(x)		((x) << 1)
390a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ_MASK		MVNETA_SDC_RXBSZ(7)
391a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ_1_64BITWORDS	MVNETA_SDC_RXBSZ(0)
392a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ_2_64BITWORDS	MVNETA_SDC_RXBSZ(1)
393a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ_4_64BITWORDS	MVNETA_SDC_RXBSZ(2)
394a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ_8_64BITWORDS	MVNETA_SDC_RXBSZ(3)
395a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_RXBSZ_16_64BITWORDS	MVNETA_SDC_RXBSZ(4)
396a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_BLMR			(1 << 4)
397a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_BLMT			(1 << 5)
398a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_SWAPMODE		(1 << 6)
399a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ(x)		((x) << 22)
400a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ_MASK		MVNETA_SDC_TXBSZ(7)
401a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ_1_64BITWORDS	MVNETA_SDC_TXBSZ(0)
402a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ_2_64BITWORDS	MVNETA_SDC_TXBSZ(1)
403a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ_4_64BITWORDS	MVNETA_SDC_TXBSZ(2)
404a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ_8_64BITWORDS	MVNETA_SDC_TXBSZ(3)
405a8d7fc4aSZbigniew Bodek #define	MVNETA_SDC_TXBSZ_16_64BITWORDS	MVNETA_SDC_TXBSZ(4)
406a8d7fc4aSZbigniew Bodek 
407a8d7fc4aSZbigniew Bodek /*
408a8d7fc4aSZbigniew Bodek  * Networking Controller Miscellaneous Registers
409a8d7fc4aSZbigniew Bodek  */
410a8d7fc4aSZbigniew Bodek /* Port Acceleration Mode (MVNETA_PACC) */
411a8d7fc4aSZbigniew Bodek #define	MVNETA_PACC_ACCELERATIONMODE_MASK	0x7
412a8d7fc4aSZbigniew Bodek #define	MVNETA_PACC_ACCELERATIONMODE_EDM	0x1	/* Enhanced Desc Mode */
413a8d7fc4aSZbigniew Bodek 
414a8d7fc4aSZbigniew Bodek /* Port Version (MVNETA_PV) */
415a8d7fc4aSZbigniew Bodek #define	MVNETA_PV_VERSION_MASK			0xff
416a8d7fc4aSZbigniew Bodek #define	MVNETA_PV_VERSION(v)			((v) & 0xff)
417a8d7fc4aSZbigniew Bodek #define	MVNETA_PV_GET_VERSION(reg)		((reg) & 0xff)
418a8d7fc4aSZbigniew Bodek 
419a8d7fc4aSZbigniew Bodek /*
420a8d7fc4aSZbigniew Bodek  * Rx DMA Hardware Parser Registers
421a8d7fc4aSZbigniew Bodek  */
422a8d7fc4aSZbigniew Bodek /* Ether Type Priority (MVNETA_ETP) */
423a8d7fc4aSZbigniew Bodek #define	MVNETA_ETP_ETHERTYPEPRIEN	(1 << 0)	/* EtherType Prio Ena */
424a8d7fc4aSZbigniew Bodek #define	MVNETA_ETP_ETHERTYPEPRIFRSTEN	(1 << 1)
425a8d7fc4aSZbigniew Bodek #define	MVNETA_ETP_ETHERTYPEPRIQ	(0x7 << 2)	/*EtherType Prio Queue*/
426a8d7fc4aSZbigniew Bodek #define	MVNETA_ETP_ETHERTYPEPRIVAL	(0xffff << 5)	/*EtherType Prio Value*/
427a8d7fc4aSZbigniew Bodek #define	MVNETA_ETP_FORCEUNICSTHIT	(1 << 21)	/* Force Unicast hit */
428a8d7fc4aSZbigniew Bodek 
429a8d7fc4aSZbigniew Bodek /* Destination Address Filter Registers (MVNETA_DF{SM,OM,U}T) */
430a8d7fc4aSZbigniew Bodek #define	MVNETA_DF(n, x)			((x) << (8 * (n)))
431a8d7fc4aSZbigniew Bodek #define	MVNETA_DF_PASS			(1 << 0)
432a8d7fc4aSZbigniew Bodek #define	MVNETA_DF_QUEUE(q)		((q) << 1)
433a8d7fc4aSZbigniew Bodek #define	MVNETA_DF_QUEUE_ALL		((MVNETA_RX_QNUM_MAX-1) << 1)
434a8d7fc4aSZbigniew Bodek #define	MVNETA_DF_QUEUE_MASK		((MVNETA_RX_QNUM_MAX-1) << 1)
435a8d7fc4aSZbigniew Bodek 
436a8d7fc4aSZbigniew Bodek /*
437a8d7fc4aSZbigniew Bodek  * Rx DMA Miscellaneous Registers
438a8d7fc4aSZbigniew Bodek  */
439a8d7fc4aSZbigniew Bodek /* Port Rx Minimal Frame Size (MVNETA_PMFS) */
440a8d7fc4aSZbigniew Bodek #define	MVNETA_PMFS_RXMFS(rxmfs)	(((rxmfs) - 40) & 0x7c)
441a8d7fc4aSZbigniew Bodek 
442a8d7fc4aSZbigniew Bodek /* Receive Queue Command (MVNETA_RQC) */
443a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC_EN_MASK		(0xff << 0)	/* Enable Q */
444a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC_ENQ(q)		(1 << (0 + (q)))
445a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC_EN(n)		((n) << 0)
446a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC_DIS_MASK		(0xff << 8)	/* Disable Q */
447a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC_DISQ(q)		(1 << (8 + (q)))
448a8d7fc4aSZbigniew Bodek #define	MVNETA_RQC_DIS(n)		((n) << 8)
449a8d7fc4aSZbigniew Bodek 
450a8d7fc4aSZbigniew Bodek /*
451a8d7fc4aSZbigniew Bodek  * Rx DMA Networking Controller Miscellaneous Registers
452a8d7fc4aSZbigniew Bodek  */
453a8d7fc4aSZbigniew Bodek /* Port RX queues Configuration (MVNETA_PRXC) */
454a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXC_PACKETOFFSET(o)	(((o) & 0xf) << 8)
455a8d7fc4aSZbigniew Bodek 
456a8d7fc4aSZbigniew Bodek /* Port RX queues Snoop (MVNETA_PRXSNP) */
457a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXSNP_SNOOPNOOFBYTES(b)	(((b) & 0x3fff) << 0)
458a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXSNP_L2DEPOSITNOOFBYTES(b) (((b) & 0x3fff) << 16)
459a8d7fc4aSZbigniew Bodek 
460a8d7fc4aSZbigniew Bodek /* Port RX queues Descriptors Queue Size (MVNETA_PRXDQS) */
461a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQS_DESCRIPTORSQUEUESIZE(s)	(((s) & 0x3fff) << 0)
462a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQS_BUFFERSIZE(s)		(((s) & 0x1fff) << 19)
463a8d7fc4aSZbigniew Bodek 
464a8d7fc4aSZbigniew Bodek /* Port RX queues Descriptors Queue Threshold (MVNETA_PRXDQTH) */
465a8d7fc4aSZbigniew Bodek 					/* Occupied Descriptors Threshold */
466a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQTH_ODT(x)		(((x) & 0x3fff) << 0)
467a8d7fc4aSZbigniew Bodek 					/* Non Occupied Descriptors Threshold */
468a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXDQTH_NODT(x)		(((x) & 0x3fff) << 16)
469a8d7fc4aSZbigniew Bodek 
470a8d7fc4aSZbigniew Bodek /* Port RX queues Status (MVNETA_PRXS) */
471a8d7fc4aSZbigniew Bodek 					/* Occupied Descriptors Counter */
472a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXS_ODC(x)		(((x) & 0x3fff) << 0)
473a8d7fc4aSZbigniew Bodek 					/* Non Occupied Descriptors Counter */
474a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXS_NODC(x)		(((x) & 0x3fff) << 16)
475a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXS_GET_ODC(reg)	(((reg) >> 0) & 0x3fff)
476a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXS_GET_NODC(reg)	(((reg) >> 16) & 0x3fff)
477a8d7fc4aSZbigniew Bodek 
478a8d7fc4aSZbigniew Bodek /* Port RX queues Status Update (MVNETA_PRXSU) */
479a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXSU_NOOFPROCESSEDDESCRIPTORS(x) (((x) & 0xff) << 0)
480a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXSU_NOOFNEWDESCRIPTORS(x) (((x) & 0xff) << 16)
481a8d7fc4aSZbigniew Bodek 
482a8d7fc4aSZbigniew Bodek /* Port RX Initialization (MVNETA_PRXINIT) */
483a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXINIT_RXDMAINIT	(1 << 0)
484a8d7fc4aSZbigniew Bodek 
485a8d7fc4aSZbigniew Bodek /*
486a8d7fc4aSZbigniew Bodek  * Tx DMA Miscellaneous Registers
487a8d7fc4aSZbigniew Bodek  */
488a8d7fc4aSZbigniew Bodek /* Transmit Queue Command (MVNETA_TQC) */
489a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_EN_MASK		(0xff << 0)
490a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_ENQ(q)		(1 << ((q) + 0))/* Enable Q */
491a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_EN(n)		((n) << 0)
492a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_DIS_MASK		(0xff << 8)
493a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_DISQ(q)		(1 << ((q) + 8))/* Disable Q */
494a8d7fc4aSZbigniew Bodek #define	MVNETA_TQC_DIS(n)		((n) << 8)
495a8d7fc4aSZbigniew Bodek 
496a8d7fc4aSZbigniew Bodek /*
497a8d7fc4aSZbigniew Bodek  * Tx DMA Networking Controller Miscellaneous Registers
498a8d7fc4aSZbigniew Bodek  */
499a8d7fc4aSZbigniew Bodek /* Port TX queues Descriptors Queue Size (MVNETA_PTXDQS) */
500a8d7fc4aSZbigniew Bodek 					/* Descriptors Queue Size */
501a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDQS_DQS_MASK		(0x3fff << 0)
502a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDQS_DQS(x)		(((x) & 0x3fff) << 0)
503a8d7fc4aSZbigniew Bodek 					/* Transmitted Buffer Threshold */
504a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDQS_TBT_MASK		(0x3fff << 16)
505a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXDQS_TBT(x)		(((x) & 0x3fff) << 16)
506a8d7fc4aSZbigniew Bodek 
507a8d7fc4aSZbigniew Bodek /* Port TX queues Status (MVNETA_PTXS) */
508a8d7fc4aSZbigniew Bodek 					/* Transmitted Buffer Counter */
509a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXS_TBC(x)		(((x) & 0x3fff) << 16)
510a8d7fc4aSZbigniew Bodek 
511a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXS_GET_TBC(reg)	(((reg) >> 16) & 0x3fff)
512a8d7fc4aSZbigniew Bodek 					/* Pending Descriptors Counter */
513a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXS_PDC(x)		((x) & 0x3fff)
514a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXS_GET_PDC(x)		((x) & 0x3fff)
515a8d7fc4aSZbigniew Bodek 
516a8d7fc4aSZbigniew Bodek /* Port TX queues Status Update (MVNETA_PTXSU) */
517a8d7fc4aSZbigniew Bodek 					/* Number Of Written Descriptors */
518a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXSU_NOWD(x)		(((x) & 0xff) << 0)
519a8d7fc4aSZbigniew Bodek 					/* Number Of Released Buffers */
520a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXSU_NORB(x)		(((x) & 0xff) << 16)
521a8d7fc4aSZbigniew Bodek 
522a8d7fc4aSZbigniew Bodek /* TX Transmitted Buffers Counter (MVNETA_TXTBC) */
523a8d7fc4aSZbigniew Bodek 					/* Transmitted Buffers Counter */
524a8d7fc4aSZbigniew Bodek #define	MVNETA_TXTBC_TBC(x)		(((x) & 0x3fff) << 16)
525a8d7fc4aSZbigniew Bodek 
526a8d7fc4aSZbigniew Bodek /* Port TX Initialization (MVNETA_PTXINIT) */
527a8d7fc4aSZbigniew Bodek #define	MVNETA_PTXINIT_TXDMAINIT	(1 << 0)
528a8d7fc4aSZbigniew Bodek 
529a8d7fc4aSZbigniew Bodek /*
530a8d7fc4aSZbigniew Bodek  * Tx DMA Queue Arbiter Registers (Version 1 )
531a8d7fc4aSZbigniew Bodek  */
532a8d7fc4aSZbigniew Bodek /* Transmit Queue Fixed Priority Configuration */
533a8d7fc4aSZbigniew Bodek #define	MVNETA_TQFPC_EN(q)		(1 << (q))
534a8d7fc4aSZbigniew Bodek 
535a8d7fc4aSZbigniew Bodek /*
536a8d7fc4aSZbigniew Bodek  * RX_TX DMA Registers
537a8d7fc4aSZbigniew Bodek  */
538a8d7fc4aSZbigniew Bodek /* Port Configuration (MVNETA_PXC) */
539a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_UPM			(1 << 0) /* Uni Promisc mode */
540a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RXQ(q)		((q) << 1)
541a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RXQ_MASK		MVNETA_PXC_RXQ(7)
542a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RXQARP(q)		((q) << 4)
543a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RXQARP_MASK		MVNETA_PXC_RXQARP(7)
544a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RB			(1 << 7) /* Rej mode of MAC */
545a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RBIP			(1 << 8)
546a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RBARP			(1 << 9)
547a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_AMNOTXES		(1 << 12)
548a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RBARPF		(1 << 13)
549a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_TCPCAPEN		(1 << 14)
550a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_UDPCAPEN		(1 << 15)
551a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_TCPQ(q)		((q) << 16)
552a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_TCPQ_MASK		MVNETA_PXC_TCPQ(7)
553a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_UDPQ(q)		((q) << 19)
554a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_UDPQ_MASK		MVNETA_PXC_UDPQ(7)
555a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_BPDUQ(q)		((q) << 22)
556a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_BPDUQ_MASK		MVNETA_PXC_BPDUQ(7)
557a8d7fc4aSZbigniew Bodek #define	MVNETA_PXC_RXCS			(1 << 25)
558a8d7fc4aSZbigniew Bodek 
559a8d7fc4aSZbigniew Bodek /* Port Configuration Extend (MVNETA_PXCX) */
560a8d7fc4aSZbigniew Bodek #define	MVNETA_PXCX_SPAN			(1 << 1)
561a8d7fc4aSZbigniew Bodek #define	MVNETA_PXCX_TXCRCDIS		(1 << 3)
562a8d7fc4aSZbigniew Bodek 
563a8d7fc4aSZbigniew Bodek /* Marvell Header (MVNETA_MH) */
564a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_MHEN			(1 << 0)
565a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_DAPREFIX		(0x3 << 1)
566a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_SPID			(0xf << 4)
567a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_MHMASK		(0x3 << 8)
568a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_MHMASK_8QUEUES	(0x0 << 8)
569a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_MHMASK_4QUEUES	(0x1 << 8)
570a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_MHMASK_2QUEUES	(0x3 << 8)
571a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_DSAEN_MASK		(0x3 << 10)
572a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_DSAEN_DISABLE		(0x0 << 10)
573a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_DSAEN_NONEXTENDED	(0x1 << 10)
574a8d7fc4aSZbigniew Bodek #define	MVNETA_MH_DSAEN_EXTENDED	(0x2 << 10)
575a8d7fc4aSZbigniew Bodek 
576a8d7fc4aSZbigniew Bodek /*
577a8d7fc4aSZbigniew Bodek  * Serial(SMI/MII) Registers
578a8d7fc4aSZbigniew Bodek  */
579a8d7fc4aSZbigniew Bodek #define	MVNETA_PSOMSCD_ENABLE		(1UL<<31)
580a8d7fc4aSZbigniew Bodek #define	MVNETA_PSERDESCFG_QSGMII	(0x0667)
581a8d7fc4aSZbigniew Bodek #define	MVNETA_PSERDESCFG_SGMII		(0x0cc7)
582a8d7fc4aSZbigniew Bodek /* Port Seiral Control0 (MVNETA_PSC0) */
583a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_FC_MASK	(0x3 << 5)
584a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_FC(fc)	(((fc) & 0x3) << 5)
585a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_FC_PAUSE	MVNETA_PSC0_FORCE_FC(0x1)
586a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_FC_NO_PAUSE	MVNETA_PSC0_FORCE_FC(0x0)
587a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_BP_MASK	(0x3 << 7)
588a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_BP(fc)	(((fc) & 0x3) << 5)
589a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_BP_JAM	MVNETA_PSC0_FORCE_BP(0x1)
590a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_FORCE_BP_NO_JAM	MVNETA_PSC0_FORCE_BP(0x0)
591a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_DTE_ADV		(1 << 14)
592a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_IGN_RXERR		(1 << 28)
593a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_IGN_COLLISION	(1 << 29)
594a8d7fc4aSZbigniew Bodek #define	MVNETA_PSC0_IGN_CARRIER		(1 << 30)
595a8d7fc4aSZbigniew Bodek 
596a8d7fc4aSZbigniew Bodek /* Ethernet Port Status0 (MVNETA_PS0) */
597a8d7fc4aSZbigniew Bodek #define	MVNETA_PS0_TXINPROG		(1 << 0)
598a8d7fc4aSZbigniew Bodek #define	MVNETA_PS0_TXFIFOEMP		(1 << 8)
599a8d7fc4aSZbigniew Bodek #define	MVNETA_PS0_RXFIFOEMPTY		(1 << 16)
600a8d7fc4aSZbigniew Bodek 
601a8d7fc4aSZbigniew Bodek /*
602a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet MAC Serial Parameters Configuration Registers
603a8d7fc4aSZbigniew Bodek  */
604a8d7fc4aSZbigniew Bodek #define	MVNETA_PSPC_MUST_SET		(1 << 3 | 1 << 4 | 1 << 5 | 0x23 << 6)
605a8d7fc4aSZbigniew Bodek #define	MVNETA_PSP1C_MUST_SET		(1 << 0 | 1 << 1 | 1 << 2)
606a8d7fc4aSZbigniew Bodek 
607a8d7fc4aSZbigniew Bodek /*
608a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet Auto-Negotiation Configuration Registers
609a8d7fc4aSZbigniew Bodek  */
610a8d7fc4aSZbigniew Bodek /* Port Auto-Negotiation Configuration (MVNETA_PANC) */
611a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_FORCELINKFAIL	(1 << 0)
612a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_FORCELINKPASS	(1 << 1)
613a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_INBANDANEN		(1 << 2)
614a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_INBANDANBYPASSEN	(1 << 3)
615a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_INBANDRESTARTAN	(1 << 4)
616a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_SETMIISPEED		(1 << 5)
617a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_SETGMIISPEED	(1 << 6)
618a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_ANSPEEDEN		(1 << 7)
619a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_SETFCEN		(1 << 8)
620a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_PAUSEADV		(1 << 9)
621a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_ANFCEN		(1 << 11)
622a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_SETFULLDX		(1 << 12)
623a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_ANDUPLEXEN		(1 << 13)
624a8d7fc4aSZbigniew Bodek #define	MVNETA_PANC_MUSTSET		(1 << 15)
625a8d7fc4aSZbigniew Bodek 
626a8d7fc4aSZbigniew Bodek /*
627a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet MAC Control Registers
628a8d7fc4aSZbigniew Bodek  */
629a8d7fc4aSZbigniew Bodek /* Port MAC Control 0 (MVNETA_PMACC0) */
630a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC0_PORTEN		(1 << 0)
631a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC0_PORTTYPE		(1 << 1)
632a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC0_FRAMESIZELIMIT(x)		((((x) >> 1) << 2) & 0x7ffc)
633a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC0_FRAMESIZELIMIT_MASK	(0x7ffc)
634a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC0_MUSTSET		(1 << 15)
635a8d7fc4aSZbigniew Bodek 
636a8d7fc4aSZbigniew Bodek /* Port MAC Control 1 (MVNETA_PMACC1) */
637a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC1_PCSLB		(1 << 6)
638a8d7fc4aSZbigniew Bodek 
639a8d7fc4aSZbigniew Bodek /* Port MAC Control 2 (MVNETA_PMACC2) */
640a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_INBANDANMODE	(1 << 0)
641a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_PCSEN		(1 << 3)
642a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_PCSEN		(1 << 3)
643a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_RGMIIEN		(1 << 4)
644a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_PADDINGDIS		(1 << 5)
645a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_PORTMACRESET	(1 << 6)
646a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_PRBSCHECKEN	(1 << 10)
647a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_PRBSGENEN		(1 << 11)
648a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_SDTT_MASK		(3 << 12)  /* Select Data To Transmit */
649a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_SDTT_RM		(0 << 12)	/* Regular Mode */
650a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_SDTT_PRBS		(1 << 12)	/* PRBS Mode */
651a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_SDTT_ZC		(2 << 12)	/* Zero Constant */
652a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_SDTT_OC		(3 << 12)	/* One Constant */
653a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC2_MUSTSET		(3 << 14)
654a8d7fc4aSZbigniew Bodek 
655a8d7fc4aSZbigniew Bodek /* Port MAC Control 3 (MVNETA_PMACC3) */
656a8d7fc4aSZbigniew Bodek #define	MVNETA_PMACC3_IPG_MASK		0x7f80
657a8d7fc4aSZbigniew Bodek 
658a8d7fc4aSZbigniew Bodek /*
659a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet MAC Interrupt Registers
660a8d7fc4aSZbigniew Bodek  */
661a8d7fc4aSZbigniew Bodek /* Port Interrupt Cause/Mask (MVNETA_PIC/MVNETA_PIM) */
662a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_INTSUM			(1 << 0)
663a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_LSC			(1 << 1)   /* LinkStatus Change */
664a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_ACOP			(1 << 2)   /* AnCompleted OnPort */
665a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_AOOR			(1 << 5)   /* AddressOut Of Range */
666a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_SSC			(1 << 6)   /* SyncStatus Change */
667a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_PRBSEOP		(1 << 7)   /* QSGMII PRBS error */
668a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_MIBCWA			(1 << 15)  /* MIB counter wrap around */
669a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_QSGMIIPRBSE		(1 << 10)  /* QSGMII PRBS error */
670a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_PCSRXPRLPI		(1 << 11)  /* PCS Rx path received LPI*/
671a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_PCSTXPRLPI		(1 << 12)  /* PCS Tx path received LPI*/
672a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_MACRXPRLPI		(1 << 13)  /* MAC Rx path received LPI*/
673a8d7fc4aSZbigniew Bodek #define	MVNETA_PI_MIBCCD			(1 << 14)  /* MIB counters copy done */
674a8d7fc4aSZbigniew Bodek 
675a8d7fc4aSZbigniew Bodek /*
676a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet MAC Low Power Idle Registers
677a8d7fc4aSZbigniew Bodek  */
678a8d7fc4aSZbigniew Bodek /* LPI Control 0 (MVNETA_LPIC0) */
679a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC0_LILIMIT(x)		(((x) & 0xff) << 0)
680a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC0_TSLIMIT(x)		(((x) & 0xff) << 8)
681a8d7fc4aSZbigniew Bodek 
682a8d7fc4aSZbigniew Bodek /* LPI Control 1 (MVNETA_LPIC1) */
683a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC1_LPIRE		(1 << 0)	/* LPI request enable */
684a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC1_LPIRF		(1 << 1)	/* LPI request force */
685a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC1_LPIMM		(1 << 2)	/* LPI manual mode */
686a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC1_TWLIMIT(x)		(((x) & 0xfff) << 4)
687a8d7fc4aSZbigniew Bodek 
688a8d7fc4aSZbigniew Bodek /* LPI Control 2 (MVNETA_LPIC2) */
689a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIC2_MUSTSET		0x17d
690a8d7fc4aSZbigniew Bodek 
691a8d7fc4aSZbigniew Bodek /* LPI Status (MVNETA_LPIS) */
692a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIS_PCSRXPLPIS		(1 << 0) /* PCS Rx path LPI status */
693a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIS_PCSTXPLPIS		(1 << 1) /* PCS Tx path LPI status */
694a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIS_MACRXPLPIS		(1 << 2)/* MAC Rx path LP idle status */
695a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIS_MACTXPLPWS		(1 << 3)/* MAC Tx path LP wait status */
696a8d7fc4aSZbigniew Bodek #define	MVNETA_LPIS_MACTXPLPIS		(1 << 4)/* MAC Tx path LP idle status */
697a8d7fc4aSZbigniew Bodek 
698a8d7fc4aSZbigniew Bodek /*
699a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet MAC PRBS Check Status Registers
700a8d7fc4aSZbigniew Bodek  */
701a8d7fc4aSZbigniew Bodek /* Port PRBS Status (MVNETA_PPRBSS) */
702a8d7fc4aSZbigniew Bodek #define	MVNETA_PPRBSS_PRBSCHECKLOCKED	(1 << 0)
703a8d7fc4aSZbigniew Bodek #define	MVNETA_PPRBSS_PRBSCHECKRDY	(1 << 1)
704a8d7fc4aSZbigniew Bodek 
705a8d7fc4aSZbigniew Bodek /*
706a8d7fc4aSZbigniew Bodek  * Gigabit Ethernet MAC Status Registers
707a8d7fc4aSZbigniew Bodek  */
708a8d7fc4aSZbigniew Bodek /* Port Status Register (MVNETA_PSR) */
709a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_LINKUP		(1 << 0)
710a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_GMIISPEED		(1 << 1)
711a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_MIISPEED		(1 << 2)
712a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_FULLDX		(1 << 3)
713a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_RXFCEN		(1 << 4)
714a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_TXFCEN		(1 << 5)
715a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_PRP			(1 << 6) /* Port Rx Pause */
716a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_PTP			(1 << 7) /* Port Tx Pause */
717a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_PDP			(1 << 8) /*Port is Doing Back-Pressure*/
718a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_SYNCFAIL10MS		(1 << 10)
719a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_ANDONE		(1 << 11)
720a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_IBANBA		(1 << 12) /* InBand AutoNeg BypassAct */
721a8d7fc4aSZbigniew Bodek #define	MVNETA_PSR_SYNCOK		(1 << 14)
722a8d7fc4aSZbigniew Bodek 
723a8d7fc4aSZbigniew Bodek /*
724a8d7fc4aSZbigniew Bodek  * Networking Controller Interrupt Registers
725a8d7fc4aSZbigniew Bodek  */
726a8d7fc4aSZbigniew Bodek /* Port CPU to Queue */
727a8d7fc4aSZbigniew Bodek #define	MVNETA_MAXCPU			2
728a8d7fc4aSZbigniew Bodek #define	MVNETA_PCP2Q_TXQEN(q)		(1 << ((q) + 8))
729a8d7fc4aSZbigniew Bodek #define	MVNETA_PCP2Q_TXQEN_MASK		(0xff << 8)
730a8d7fc4aSZbigniew Bodek #define	MVNETA_PCP2Q_RXQEN(q)		(1 << ((q) + 0))
731a8d7fc4aSZbigniew Bodek #define	MVNETA_PCP2Q_RXQEN_MASK		(0xff << 0)
732a8d7fc4aSZbigniew Bodek 
733a8d7fc4aSZbigniew Bodek /* Port RX_TX Interrupt Threshold */
734a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXITTH_RITT(t)		((t) & 0xffffff)
735a8d7fc4aSZbigniew Bodek 
736a8d7fc4aSZbigniew Bodek /* Port RX_TX Threshold Interrupt Cause/Mask (MVNETA_PRXTXTIC/MVNETA_PRXTXTIM) */
737a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_TBTCQ(q)		(1 << ((q) + 0))
738a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_TBTCQ_MASK	(0xff << 0)
739a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_GET_TBTCQ(reg)	(((reg) >> 0) & 0xff)
740a8d7fc4aSZbigniew Bodek 					/* Tx Buffer Threshold Cross Queue*/
741a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_RBICTAPQ(q)	(1 << ((q) + 8))
742a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_RBICTAPQ_MASK	(0xff << 8)
743a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_GET_RBICTAPQ(reg)	(((reg) >> 8) & 0xff)
744a8d7fc4aSZbigniew Bodek 				/* Rx Buffer Int. Coaleasing Th. Pri. Alrt Q */
745a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_RDTAQ(q)		(1 << ((q) + 16))
746a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_RDTAQ_MASK	(0xff << 16)
747a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_GET_RDTAQ(reg)	(((reg) >> 16) & 0xff)
748a8d7fc4aSZbigniew Bodek 					/* Rx Descriptor Threshold Alert Queue*/
749a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_PRXTXICSUMMARY	(1 << 29)	/* PRXTXI summary */
750a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_PTXERRORSUMMARY	(1 << 30)	/* PTEXERROR summary */
751a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXTI_PMISCICSUMMARY	(1UL << 31)	/* PMISCIC summary */
752a8d7fc4aSZbigniew Bodek 
753a8d7fc4aSZbigniew Bodek /* Port RX_TX Interrupt Cause/Mask (MVNETA_PRXTXIC/MVNETA_PRXTXIM) */
754a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_TBRQ(q)		(1 << ((q) + 0))
755a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_TBRQ_MASK		(0xff << 0)
756a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_GET_TBRQ(reg)	(((reg) >> 0) & 0xff)
757a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_RPQ(q)		(1 << ((q) + 8))
758a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_RPQ_MASK		(0xff << 8)
759a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_GET_RPQ(reg)	(((reg) >> 8) & 0xff)
760a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_RREQ(q)		(1 << ((q) + 16))
761a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_RREQ_MASK		(0xff << 16)
762a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_GET_RREQ(reg)	(((reg) >> 16) & 0xff)
763a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_PRXTXTHICSUMMARY	(1 << 29)
764a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_PTXERRORSUMMARY	(1 << 30)
765a8d7fc4aSZbigniew Bodek #define	MVNETA_PRXTXI_PMISCICSUMMARY	(1UL << 31)
766a8d7fc4aSZbigniew Bodek 
767a8d7fc4aSZbigniew Bodek /* Port Misc Interrupt Cause/Mask (MVNETA_PMIC/MVNETA_PMIM) */
768a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_PHYSTATUSCHNG	(1 << 0)
769a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_LINKCHANGE		(1 << 1)
770a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_IAE			(1 << 7) /* Internal Address Error */
771a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_RXOVERRUN		(1 << 8)
772a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_RXCRCERROR		(1 << 9)
773a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_RXLARGEPACKET	(1 << 10)
774a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_TXUNDRN		(1 << 11)
775a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_PRBSERROR		(1 << 12)
776a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_PSCSYNCCHANGE	(1 << 13)
777a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_SRSE			(1 << 14) /* SerdesRealignSyncError */
778a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_TREQ(q)		(1 << ((q) + 24)) /* TxResourceErrorQ */
779a8d7fc4aSZbigniew Bodek #define	MVNETA_PMI_TREQ_MASK		(0xff << 24) /* TxResourceErrorQ */
780a8d7fc4aSZbigniew Bodek 
781a8d7fc4aSZbigniew Bodek /* Port Interrupt Enable (MVNETA_PIE) */
782a8d7fc4aSZbigniew Bodek #define	MVNETA_PIE_RXPKTINTRPTENB(q)	(1 << ((q) + 0))
783a8d7fc4aSZbigniew Bodek #define	MVNETA_PIE_TXPKTINTRPTENB(q)	(1 << ((q) + 8))
784a8d7fc4aSZbigniew Bodek #define	MVNETA_PIE_RXPKTINTRPTENB_MASK	(0xff << 0)
785a8d7fc4aSZbigniew Bodek #define	MVNETA_PIE_TXPKTINTRPTENB_MASK	(0xff << 8)
786a8d7fc4aSZbigniew Bodek 
787a8d7fc4aSZbigniew Bodek /*
788a8d7fc4aSZbigniew Bodek  * Miscellaneous Interrupt Registers
789a8d7fc4aSZbigniew Bodek  */
790a8d7fc4aSZbigniew Bodek #define	MVNETA_PEUIAE_ADDR_MASK		(0x3fff)
791a8d7fc4aSZbigniew Bodek #define	MVNETA_PEUIAE_ADDR(addr)	((addr) & 0x3fff)
792a8d7fc4aSZbigniew Bodek #define	MVNETA_PEUIAE_GET_ADDR(reg)	((reg) & 0x3fff)
793a8d7fc4aSZbigniew Bodek 
794a8d7fc4aSZbigniew Bodek /*
795a8d7fc4aSZbigniew Bodek  * SGMII PHY Registers
796a8d7fc4aSZbigniew Bodek  */
797a8d7fc4aSZbigniew Bodek /* Power and PLL Control (MVNETA_PPLLC) */
798a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_REF_FREF_SEL_MASK	(0xf << 0)
799a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PHY_MODE_MASK	(7 << 5)
800a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PHY_MODE_SATA	(0 << 5)
801a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PHY_MODE_SAS	(1 << 5)
802a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PLL_LOCK		(1 << 8)
803a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PU_DFE		(1 << 10)
804a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PU_TX_INTP		(1 << 11)
805a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PU_TX		(1 << 12)
806a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PU_RX		(1 << 13)
807a8d7fc4aSZbigniew Bodek #define	MVNETA_PPLLC_PU_PLL		(1 << 14)
808a8d7fc4aSZbigniew Bodek 
809a8d7fc4aSZbigniew Bodek /* Digital Loopback Enable (MVNETA_DLE) */
810a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_SEL_BITS_MASK		(3 << 10)
811a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_SEL_BITS_10BITS	(0 << 10)
812a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_SEL_BITS_20BITS	(1 << 10)
813a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_SEL_BITS_40BITS	(2 << 10)
814a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_RXPHER_TO_TX_EN	(1 << 12)
815a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_ANA_TX2RX_LPBK_EN	(1 << 13)
816a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_DIG_TX2RX_LPBK_EN	(1 << 14)
817a8d7fc4aSZbigniew Bodek #define	MVNETA_DLE_LOCAL_DIG_RX2TX_LPBK_EN	(1 << 15)
818a8d7fc4aSZbigniew Bodek 
819a8d7fc4aSZbigniew Bodek /* Reference Clock Select (MVNETA_RCS) */
820a8d7fc4aSZbigniew Bodek #define	MVNETA_RCS_REFCLK_SEL		(1 << 10)
821a8d7fc4aSZbigniew Bodek 
822a8d7fc4aSZbigniew Bodek /*
823a8d7fc4aSZbigniew Bodek  * DMA descriptors
824a8d7fc4aSZbigniew Bodek  */
825a8d7fc4aSZbigniew Bodek struct mvneta_tx_desc {
826a8d7fc4aSZbigniew Bodek 	/* LITTLE_ENDIAN */
827a8d7fc4aSZbigniew Bodek 	uint32_t command;		/* off 0x00: commands */
828a8d7fc4aSZbigniew Bodek 	uint16_t l4ichk;		/* initial checksum */
829a8d7fc4aSZbigniew Bodek 	uint16_t bytecnt;		/* 0ff 0x04: buffer byte count */
830a8d7fc4aSZbigniew Bodek 	uint32_t bufptr_pa;		/* off 0x08: buffer ptr(PA) */
831a8d7fc4aSZbigniew Bodek 	uint32_t flags;			/* off 0x0c: flags */
832a8d7fc4aSZbigniew Bodek 	uint32_t reserved0;		/* off 0x10 */
833a8d7fc4aSZbigniew Bodek 	uint32_t reserved1;		/* off 0x14 */
834a8d7fc4aSZbigniew Bodek 	uint32_t reserved2;		/* off 0x18 */
835a8d7fc4aSZbigniew Bodek 	uint32_t reserved3;		/* off 0x1c */
836a8d7fc4aSZbigniew Bodek };
837a8d7fc4aSZbigniew Bodek 
838a8d7fc4aSZbigniew Bodek struct mvneta_rx_desc {
839a8d7fc4aSZbigniew Bodek 	/* LITTLE_ENDIAN */
840a8d7fc4aSZbigniew Bodek 	uint32_t status;		/* status and flags */
841a8d7fc4aSZbigniew Bodek 	uint16_t reserved0;
842a8d7fc4aSZbigniew Bodek 	uint16_t bytecnt;		/* buffer byte count */
843a8d7fc4aSZbigniew Bodek 	uint32_t bufptr_pa;		/* packet buffer pointer */
844a8d7fc4aSZbigniew Bodek 	uint32_t reserved1;
845a8d7fc4aSZbigniew Bodek 	uint32_t bufptr_va;
846a8d7fc4aSZbigniew Bodek 	uint16_t reserved2;
847a8d7fc4aSZbigniew Bodek 	uint16_t l4chk;			/* L4 checksum */
848a8d7fc4aSZbigniew Bodek 	uint32_t reserved3;
849a8d7fc4aSZbigniew Bodek 	uint32_t reserved4;
850a8d7fc4aSZbigniew Bodek };
851a8d7fc4aSZbigniew Bodek 
852a8d7fc4aSZbigniew Bodek /*
853a8d7fc4aSZbigniew Bodek  * Received packet command header:
854a8d7fc4aSZbigniew Bodek  *  network controller => software
855a8d7fc4aSZbigniew Bodek  * the controller parse the packet and set some flags.
856a8d7fc4aSZbigniew Bodek  */
857a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_IPV4_FRAGMENT	(1UL << 31) /* Fragment Indicator */
858a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L4_CHECKSUM_OK	(1 << 30) /* L4 Checksum */
859a8d7fc4aSZbigniew Bodek /* bit 29 reserved */
860a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_U			(1 << 28) /* Unknown Destination */
861a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_F			(1 << 27) /* First buffer */
862a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L			(1 << 26) /* Last buffer */
863a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_IP_HEADER_OK		(1 << 25) /* IP Header is OK */
864a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L3_IP			(1 << 24) /* IP Type 0:IP6 1:IP4 */
865a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L2_EV2		(1 << 23) /* Ethernet v2 frame */
866a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L4_MASK		(3 << 21) /* L4 Type */
867a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L4_TCP		(0x00 << 21)
868a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L4_UDP		(0x01 << 21)
869a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_L4_OTH		(0x10 << 21)
870a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_BPDU			(1 << 20) /* BPDU frame */
871a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_VLAN			(1 << 19) /* VLAN tag found */
872a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_EC_MASK		(3 << 17) /* Error code */
873a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_EC_CE			(0x00 << 17) /* CRC error */
874a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_EC_OR			(0x01 << 17) /* FIFO overrun */
875a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_EC_MF			(0x10 << 17) /* Max. frame len */
876a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_EC_RE			(0x11 << 17) /* Resource error */
877a8d7fc4aSZbigniew Bodek #define	MVNETA_RX_ES			(1 << 16) /* Error summary */
878a8d7fc4aSZbigniew Bodek /* bit 15:0 reserved */
879a8d7fc4aSZbigniew Bodek 
880a8d7fc4aSZbigniew Bodek /*
881a8d7fc4aSZbigniew Bodek  * Transmit packet command header:
882a8d7fc4aSZbigniew Bodek  *  software => network controller
883a8d7fc4aSZbigniew Bodek  */
884a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L4_CHECKSUM_MASK		(0x3 << 30) /* Do L4 Checksum */
885a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L4_CHECKSUM_FRAG		(0x0 << 30)
886a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L4_CHECKSUM_NOFRAG	(0x1 << 30)
887a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L4_CHECKSUM_NONE		(0x2 << 30)
888a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_PACKET_OFFSET_MASK	(0x7f << 23) /* Payload offset */
889a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_W_PACKET_OFFSET(v)	(((v) & 0x7f) << 23)
890a8d7fc4aSZbigniew Bodek /* bit 22 reserved */
891a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_F			(1 << 21) /* First buffer */
892a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L			(1 << 20) /* Last buffer */
893a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_PADDING		(1 << 19) /* Pad short frame */
894a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_IP4_CHECKSUM	(1 << 18) /* Do IPv4 Checksum */
895a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L3_IP4		(0 << 17)
896a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L3_IP6		(1 << 17)
897a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L4_TCP		(0 << 16)
898a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L4_UDP		(1 << 16)
899a8d7fc4aSZbigniew Bodek /* bit 15:13 reserved */
900a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_IP_HEADER_LEN_MASK	(0x1f << 8) /* IP header len >> 2 */
901a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_IP_HEADER_LEN(v)		(((v) & 0x1f) << 8)
902a8d7fc4aSZbigniew Bodek /* bit 7 reserved */
903a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L3_OFFSET_MASK	(0x7f << 0) /* offset of L3 hdr. */
904a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_CMD_L3_OFFSET(v)	(((v) & 0x7f) << 0)
905a8d7fc4aSZbigniew Bodek 
906a8d7fc4aSZbigniew Bodek /*
907a8d7fc4aSZbigniew Bodek  * Transmit packet extra attributes
908a8d7fc4aSZbigniew Bodek  * and error status returned from network controller.
909a8d7fc4aSZbigniew Bodek  */
910a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_DSA_TAG		(3 << 30)	/* DSA Tag */
911a8d7fc4aSZbigniew Bodek /* bit 29:8 reserved */
912a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_MH_SEL		(0xf << 4)	/* Marvell Header */
913a8d7fc4aSZbigniew Bodek /* bit 3 reserved */
914a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_EC_MASK		(3 << 1)	/* Error code */
915a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_EC_LC		(0x00 << 1)	/* Late Collision */
916a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_EC_UR		(0x01 << 1)	/* Underrun */
917a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_EC_RL		(0x10 << 1)	/* Excess. Collision */
918a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_EC_RESERVED		(0x11 << 1)
919a8d7fc4aSZbigniew Bodek #define	MVNETA_TX_F_ES			(1 << 0)	/* Error summary */
920a8d7fc4aSZbigniew Bodek 
921a8d7fc4aSZbigniew Bodek #define	MVNETA_ERROR_SUMMARY		(1 << 0)
922a8d7fc4aSZbigniew Bodek #define	MVNETA_BUFFER_OWNED_MASK	(1UL << 31)
923a8d7fc4aSZbigniew Bodek #define	MVNETA_BUFFER_OWNED_BY_HOST	(0UL << 31)
924a8d7fc4aSZbigniew Bodek #define	MVNETA_BUFFER_OWNED_BY_DMA	(1UL << 31)
925a8d7fc4aSZbigniew Bodek 
926a8d7fc4aSZbigniew Bodek #endif	/* _IF_MVNETAREG_H_ */
927