xref: /freebsd/sys/dev/vge/if_vgereg.h (revision 04440331b5700e124c42b570ae1dfd00ea9c26f7)
1098ca2bdSWarner Losh /*-
2df57947fSPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
3df57947fSPedro F. Giffuni  *
4a07bd003SBill Paul  * Copyright (c) 2004
5a07bd003SBill Paul  *	Bill Paul <wpaul@windriver.com>.  All rights reserved.
6a07bd003SBill Paul  *
7a07bd003SBill Paul  * Redistribution and use in source and binary forms, with or without
8a07bd003SBill Paul  * modification, are permitted provided that the following conditions
9a07bd003SBill Paul  * are met:
10a07bd003SBill Paul  * 1. Redistributions of source code must retain the above copyright
11a07bd003SBill Paul  *    notice, this list of conditions and the following disclaimer.
12a07bd003SBill Paul  * 2. Redistributions in binary form must reproduce the above copyright
13a07bd003SBill Paul  *    notice, this list of conditions and the following disclaimer in the
14a07bd003SBill Paul  *    documentation and/or other materials provided with the distribution.
15a07bd003SBill Paul  * 3. All advertising materials mentioning features or use of this software
16a07bd003SBill Paul  *    must display the following acknowledgement:
17a07bd003SBill Paul  *	This product includes software developed by Bill Paul.
18a07bd003SBill Paul  * 4. Neither the name of the author nor the names of any co-contributors
19a07bd003SBill Paul  *    may be used to endorse or promote products derived from this software
20a07bd003SBill Paul  *    without specific prior written permission.
21a07bd003SBill Paul  *
22a07bd003SBill Paul  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23a07bd003SBill Paul  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24a07bd003SBill Paul  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25a07bd003SBill Paul  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
26a07bd003SBill Paul  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27a07bd003SBill Paul  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28a07bd003SBill Paul  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29a07bd003SBill Paul  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30a07bd003SBill Paul  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31a07bd003SBill Paul  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32a07bd003SBill Paul  * THE POSSIBILITY OF SUCH DAMAGE.
33a07bd003SBill Paul  */
34a07bd003SBill Paul 
35a07bd003SBill Paul /*
36a07bd003SBill Paul  * Register definitions for the VIA VT6122 gigabit ethernet controller.
37a07bd003SBill Paul  * Definitions for the built-in copper PHY can be found in vgphy.h.
38a07bd003SBill Paul  *
39a07bd003SBill Paul  * The VT612x controllers have 256 bytes of register space. The
40a07bd003SBill Paul  * manual seems to imply that the registers should all be accessed
41a07bd003SBill Paul  * using 32-bit I/O cycles, but some of them are less than 32 bits
42a07bd003SBill Paul  * wide. Go figure.
43a07bd003SBill Paul  */
44a07bd003SBill Paul 
45a07bd003SBill Paul #ifndef _IF_VGEREG_H_
46a07bd003SBill Paul #define _IF_VGEREG_H_
47a07bd003SBill Paul 
48a07bd003SBill Paul #define VIA_VENDORID		0x1106
49a07bd003SBill Paul #define VIA_DEVICEID_61XX	0x3119
50a07bd003SBill Paul 
51a07bd003SBill Paul #define VGE_PAR0		0x00	/* physical address register */
52a07bd003SBill Paul #define VGE_PAR1		0x02
53a07bd003SBill Paul #define VGE_PAR2		0x04
54a07bd003SBill Paul #define VGE_RXCTL		0x06	/* RX control register */
55a07bd003SBill Paul #define VGE_TXCTL		0x07	/* TX control register */
56a07bd003SBill Paul #define VGE_CRS0		0x08	/* Global cmd register 0 (w to set) */
57a07bd003SBill Paul #define VGE_CRS1		0x09	/* Global cmd register 1 (w to set) */
58a07bd003SBill Paul #define VGE_CRS2		0x0A	/* Global cmd register 2 (w to set) */
59a07bd003SBill Paul #define VGE_CRS3		0x0B	/* Global cmd register 3 (w to set) */
60a07bd003SBill Paul #define VGE_CRC0		0x0C	/* Global cmd register 0 (w to clr) */
61a07bd003SBill Paul #define VGE_CRC1		0x0D	/* Global cmd register 1 (w to clr) */
62a07bd003SBill Paul #define VGE_CRC2		0x0E	/* Global cmd register 2 (w to clr) */
63a07bd003SBill Paul #define VGE_CRC3		0x0F	/* Global cmd register 3 (w to clr) */
64a07bd003SBill Paul #define VGE_MAR0		0x10	/* Mcast hash/CAM register 0 */
65a07bd003SBill Paul #define VGE_MAR1		0x14	/* Mcast hash/CAM register 1 */
66a07bd003SBill Paul #define VGE_CAM0		0x10
67a07bd003SBill Paul #define VGE_CAM1		0x11
68a07bd003SBill Paul #define VGE_CAM2		0x12
69a07bd003SBill Paul #define VGE_CAM3		0x13
70a07bd003SBill Paul #define VGE_CAM4		0x14
71a07bd003SBill Paul #define VGE_CAM5		0x15
72a07bd003SBill Paul #define VGE_CAM6		0x16
73a07bd003SBill Paul #define VGE_CAM7		0x17
74a07bd003SBill Paul #define VGE_TXDESC_HIADDR	0x18	/* Hi part of 64bit txdesc base addr */
75a07bd003SBill Paul #define VGE_DATABUF_HIADDR	0x1D	/* Hi part of 64bit data buffer addr */
76a07bd003SBill Paul #define VGE_INTCTL0		0x20	/* interrupt control register */
77a07bd003SBill Paul #define VGE_RXSUPPTHR		0x20
78a07bd003SBill Paul #define VGE_TXSUPPTHR		0x20
79a07bd003SBill Paul #define VGE_INTHOLDOFF		0x20
80a07bd003SBill Paul #define VGE_INTCTL1		0x21	/* interrupt control register */
81a07bd003SBill Paul #define VGE_TXHOSTERR		0x22	/* TX host error status */
82a07bd003SBill Paul #define VGE_RXHOSTERR		0x23	/* RX host error status */
83a07bd003SBill Paul #define VGE_ISR			0x24	/* Interrupt status register */
84a07bd003SBill Paul #define VGE_IMR			0x28	/* Interrupt mask register */
85a07bd003SBill Paul #define VGE_TXSTS_PORT		0x2C	/* Transmit status port (???) */
86a07bd003SBill Paul #define VGE_TXQCSRS		0x30	/* TX queue ctl/status set */
87a07bd003SBill Paul #define VGE_RXQCSRS		0x32	/* RX queue ctl/status set */
88a07bd003SBill Paul #define VGE_TXQCSRC		0x34	/* TX queue ctl/status clear */
89a07bd003SBill Paul #define VGE_RXQCSRC		0x36	/* RX queue ctl/status clear */
90a07bd003SBill Paul #define VGE_RXDESC_ADDR_LO	0x38	/* RX desc base addr (lo 32 bits) */
91a07bd003SBill Paul #define VGE_RXDESC_CONSIDX	0x3C	/* Current RX descriptor index */
9212ea9becSPyun YongHyeon #define VGE_TXQTIMER		0x3E	/* TX queue timer pend register */
9312ea9becSPyun YongHyeon #define VGE_RXQTIMER		0x3F	/* RX queue timer pend register */
94a07bd003SBill Paul #define VGE_TXDESC_ADDR_LO0	0x40	/* TX desc0 base addr (lo 32 bits) */
95a07bd003SBill Paul #define VGE_TXDESC_ADDR_LO1	0x44	/* TX desc1 base addr (lo 32 bits) */
96a07bd003SBill Paul #define VGE_TXDESC_ADDR_LO2	0x48	/* TX desc2 base addr (lo 32 bits) */
97a07bd003SBill Paul #define VGE_TXDESC_ADDR_LO3	0x4C	/* TX desc3 base addr (lo 32 bits) */
98a07bd003SBill Paul #define VGE_RXDESCNUM		0x50	/* Size of RX desc ring */
99a07bd003SBill Paul #define VGE_TXDESCNUM		0x52	/* Size of TX desc ring */
100a07bd003SBill Paul #define VGE_TXDESC_CONSIDX0	0x54	/* Current TX descriptor index */
101a07bd003SBill Paul #define VGE_TXDESC_CONSIDX1	0x56	/* Current TX descriptor index */
102a07bd003SBill Paul #define VGE_TXDESC_CONSIDX2	0x58	/* Current TX descriptor index */
103a07bd003SBill Paul #define VGE_TXDESC_CONSIDX3	0x5A	/* Current TX descriptor index */
104a07bd003SBill Paul #define VGE_TX_PAUSE_TIMER	0x5C	/* TX pause frame timer */
105a07bd003SBill Paul #define VGE_RXDESC_RESIDUECNT	0x5E	/* RX descriptor residue count */
106a07bd003SBill Paul #define VGE_FIFOTEST0		0x60	/* FIFO test register */
107a07bd003SBill Paul #define VGE_FIFOTEST1		0x64	/* FIFO test register */
108a07bd003SBill Paul #define VGE_CAMADDR		0x68	/* CAM address register */
109a07bd003SBill Paul #define VGE_CAMCTL		0x69	/* CAM control register */
110a07bd003SBill Paul #define VGE_GFTEST		0x6A
111a07bd003SBill Paul #define VGE_FTSCMD		0x6B
112a07bd003SBill Paul #define VGE_MIICFG		0x6C	/* MII port config register */
113a07bd003SBill Paul #define VGE_MIISTS		0x6D	/* MII port status register */
114a07bd003SBill Paul #define VGE_PHYSTS0		0x6E	/* PHY status register */
115a07bd003SBill Paul #define VGE_PHYSTS1		0x6F	/* PHY status register */
116a07bd003SBill Paul #define VGE_MIICMD		0x70	/* MII command register */
117a07bd003SBill Paul #define VGE_MIIADDR		0x71	/* MII address register */
118a07bd003SBill Paul #define VGE_MIIDATA		0x72	/* MII data register */
119a07bd003SBill Paul #define VGE_SSTIMER		0x74	/* single-shot timer */
120a07bd003SBill Paul #define VGE_PTIMER		0x76	/* periodic timer */
121a07bd003SBill Paul #define VGE_CHIPCFG0		0x78	/* chip config A */
122a07bd003SBill Paul #define VGE_CHIPCFG1		0x79	/* chip config B */
123a07bd003SBill Paul #define VGE_CHIPCFG2		0x7A	/* chip config C */
124a07bd003SBill Paul #define VGE_CHIPCFG3		0x7B	/* chip config D */
125a07bd003SBill Paul #define VGE_DMACFG0		0x7C	/* DMA config 0 */
126a07bd003SBill Paul #define VGE_DMACFG1		0x7D	/* DMA config 1 */
127a07bd003SBill Paul #define VGE_RXCFG		0x7E	/* MAC RX config */
128a07bd003SBill Paul #define VGE_TXCFG		0x7F	/* MAC TX config */
129a07bd003SBill Paul #define VGE_PWRMGMT		0x82	/* power management shadow register */
130a07bd003SBill Paul #define VGE_PWRSTAT		0x83	/* power state shadow register */
131a07bd003SBill Paul #define VGE_MIBCSR		0x84	/* MIB control/status register */
132a07bd003SBill Paul #define VGE_SWEEDATA		0x85	/* EEPROM software loaded data */
133a07bd003SBill Paul #define VGE_MIBDATA		0x88	/* MIB data register */
134a07bd003SBill Paul #define VGE_EEWRDAT		0x8C	/* EEPROM embedded write */
135a07bd003SBill Paul #define VGE_EECSUM		0x92	/* EEPROM checksum */
136a07bd003SBill Paul #define VGE_EECSR		0x93	/* EEPROM control/status */
137a07bd003SBill Paul #define VGE_EERDDAT		0x94	/* EEPROM embedded read */
138a07bd003SBill Paul #define VGE_EEADDR		0x96	/* EEPROM address */
139a07bd003SBill Paul #define VGE_EECMD		0x97	/* EEPROM embedded command */
140a07bd003SBill Paul #define VGE_CHIPSTRAP		0x99	/* Chip jumper strapping status */
141a07bd003SBill Paul #define VGE_MEDIASTRAP		0x9B	/* Media jumper strapping */
142a07bd003SBill Paul #define VGE_DIAGSTS		0x9C	/* Chip diagnostic status */
143a07bd003SBill Paul #define VGE_DBGCTL		0x9E	/* Chip debug control */
144a07bd003SBill Paul #define VGE_DIAGCTL		0x9F	/* Chip diagnostic control */
145a07bd003SBill Paul #define VGE_WOLCR0S		0xA0	/* WOL0 event set */
146a07bd003SBill Paul #define VGE_WOLCR1S		0xA1	/* WOL1 event set */
147a07bd003SBill Paul #define VGE_PWRCFGS		0xA2	/* Power management config set */
148a07bd003SBill Paul #define VGE_WOLCFGS		0xA3	/* WOL config set */
149a07bd003SBill Paul #define VGE_WOLCR0C		0xA4	/* WOL0 event clear */
150a07bd003SBill Paul #define VGE_WOLCR1C		0xA5	/* WOL1 event clear */
151a07bd003SBill Paul #define VGE_PWRCFGC		0xA6	/* Power management config clear */
152a07bd003SBill Paul #define VGE_WOLCFGC		0xA7	/* WOL config clear */
153a07bd003SBill Paul #define VGE_WOLSR0S		0xA8	/* WOL status set */
154a07bd003SBill Paul #define VGE_WOLSR1S		0xA9	/* WOL status set */
155a07bd003SBill Paul #define VGE_WOLSR0C		0xAC	/* WOL status clear */
156a07bd003SBill Paul #define VGE_WOLSR1C		0xAD	/* WOL status clear */
157a07bd003SBill Paul #define VGE_WAKEPAT_CRC0	0xB0
158a07bd003SBill Paul #define VGE_WAKEPAT_CRC1	0xB2
159a07bd003SBill Paul #define VGE_WAKEPAT_CRC2	0xB4
160a07bd003SBill Paul #define VGE_WAKEPAT_CRC3	0xB6
161a07bd003SBill Paul #define VGE_WAKEPAT_CRC4	0xB8
162a07bd003SBill Paul #define VGE_WAKEPAT_CRC5	0xBA
163a07bd003SBill Paul #define VGE_WAKEPAT_CRC6	0xBC
164a07bd003SBill Paul #define VGE_WAKEPAT_CRC7	0xBE
165a07bd003SBill Paul #define VGE_WAKEPAT_MSK0_0	0xC0
166a07bd003SBill Paul #define VGE_WAKEPAT_MSK0_1	0xC4
167a07bd003SBill Paul #define VGE_WAKEPAT_MSK0_2	0xC8
168a07bd003SBill Paul #define VGE_WAKEPAT_MSK0_3	0xCC
169a07bd003SBill Paul #define VGE_WAKEPAT_MSK1_0	0xD0
170a07bd003SBill Paul #define VGE_WAKEPAT_MSK1_1	0xD4
171a07bd003SBill Paul #define VGE_WAKEPAT_MSK1_2	0xD8
172a07bd003SBill Paul #define VGE_WAKEPAT_MSK1_3	0xDC
173a07bd003SBill Paul #define VGE_WAKEPAT_MSK2_0	0xE0
174a07bd003SBill Paul #define VGE_WAKEPAT_MSK2_1	0xE4
175a07bd003SBill Paul #define VGE_WAKEPAT_MSK2_2	0xE8
176a07bd003SBill Paul #define VGE_WAKEPAT_MSK2_3	0xEC
177a07bd003SBill Paul #define VGE_WAKEPAT_MSK3_0	0xF0
178a07bd003SBill Paul #define VGE_WAKEPAT_MSK3_1	0xF4
179a07bd003SBill Paul #define VGE_WAKEPAT_MSK3_2	0xF8
180a07bd003SBill Paul #define VGE_WAKEPAT_MSK3_3	0xFC
181a07bd003SBill Paul 
182a07bd003SBill Paul /* Receive control register */
183a07bd003SBill Paul 
184a07bd003SBill Paul #define VGE_RXCTL_RX_BADFRAMES		0x01 /* accept CRC error frames */
185a07bd003SBill Paul #define VGE_RXCTL_RX_RUNT		0x02 /* accept runts */
186a07bd003SBill Paul #define VGE_RXCTL_RX_MCAST		0x04 /* accept multicasts */
187a07bd003SBill Paul #define VGE_RXCTL_RX_BCAST		0x08 /* accept broadcasts */
188a07bd003SBill Paul #define VGE_RXCTL_RX_PROMISC		0x10 /* promisc mode */
189a07bd003SBill Paul #define VGE_RXCTL_RX_GIANT		0x20 /* accept VLAN tagged frames */
190a07bd003SBill Paul #define VGE_RXCTL_RX_UCAST		0x40 /* use perfect filtering */
191a07bd003SBill Paul #define VGE_RXCTL_RX_SYMERR		0x80 /* accept symbol err packet */
192a07bd003SBill Paul 
193a07bd003SBill Paul /* Transmit control register */
194a07bd003SBill Paul 
195a07bd003SBill Paul #define VGE_TXCTL_LOOPCTL		0x03 /* loopback control */
196a07bd003SBill Paul #define VGE_TXCTL_COLLCTL		0x0C /* collision retry control */
197a07bd003SBill Paul 
198a07bd003SBill Paul #define VGE_TXLOOPCTL_OFF		0x00
199a07bd003SBill Paul #define VGE_TXLOOPCTL_MAC_INTERNAL	0x01
200a07bd003SBill Paul #define VGE_TXLOOPCTL_EXTERNAL		0x02
201a07bd003SBill Paul 
202a07bd003SBill Paul #define VGE_TXCOLLS_NORMAL		0x00 /* one set of 16 retries */
203a07bd003SBill Paul #define VGE_TXCOLLS_32			0x04 /* two sets of 16 retries */
204a07bd003SBill Paul #define VGE_TXCOLLS_48			0x08 /* three sets of 16 retries */
205a07bd003SBill Paul #define VGE_TXCOLLS_INFINITE		0x0C /* retry forever */
206a07bd003SBill Paul 
207a07bd003SBill Paul /* Global command register 0 */
208a07bd003SBill Paul 
209a07bd003SBill Paul #define VGE_CR0_START			0x01 /* start NIC */
210a07bd003SBill Paul #define VGE_CR0_STOP			0x02 /* stop NIC */
211a07bd003SBill Paul #define VGE_CR0_RX_ENABLE		0x04 /* turn on RX engine */
212a07bd003SBill Paul #define VGE_CR0_TX_ENABLE		0x08 /* turn on TX engine */
213a07bd003SBill Paul 
214a07bd003SBill Paul /* Global command register 1 */
215a07bd003SBill Paul 
216a07bd003SBill Paul #define VGE_CR1_NOUCAST			0x01 /* disable unicast reception */
217a07bd003SBill Paul #define VGE_CR1_NOPOLL			0x08 /* disable RX/TX desc polling */
218a07bd003SBill Paul #define VGE_CR1_TIMER0_ENABLE		0x20 /* enable single shot timer */
219a07bd003SBill Paul #define VGE_CR1_TIMER1_ENABLE		0x40 /* enable periodic timer */
220a07bd003SBill Paul #define VGE_CR1_SOFTRESET		0x80 /* software reset */
221a07bd003SBill Paul 
222a07bd003SBill Paul /* Global command register 2 */
223a07bd003SBill Paul 
224a07bd003SBill Paul #define VGE_CR2_TXPAUSE_THRESH_LO	0x03 /* TX pause frame lo threshold */
225a07bd003SBill Paul #define VGE_CR2_TXPAUSE_THRESH_HI	0x0C /* TX pause frame hi threshold */
226a07bd003SBill Paul #define VGE_CR2_HDX_FLOWCTL_ENABLE	0x10 /* half duplex flow control */
227a07bd003SBill Paul #define VGE_CR2_FDX_RXFLOWCTL_ENABLE	0x20 /* full duplex RX flow control */
228a07bd003SBill Paul #define VGE_CR2_FDX_TXFLOWCTL_ENABLE	0x40 /* full duplex TX flow control */
229a07bd003SBill Paul #define VGE_CR2_XON_ENABLE		0x80 /* 802.3x XON/XOFF flow control */
230a07bd003SBill Paul 
231a07bd003SBill Paul /* Global command register 3 */
232a07bd003SBill Paul 
233a07bd003SBill Paul #define VGE_CR3_INT_SWPEND		0x01 /* disable multi-level int bits */
234a07bd003SBill Paul #define VGE_CR3_INT_GMSK		0x02 /* mask off all interrupts */
235a07bd003SBill Paul #define VGE_CR3_INT_HOLDOFF		0x04 /* enable int hold off timer */
236a07bd003SBill Paul #define VGE_CR3_DIAG			0x10 /* diagnostic enabled */
237a07bd003SBill Paul #define VGE_CR3_PHYRST			0x20 /* assert PHYRSTZ */
238a07bd003SBill Paul #define VGE_CR3_STOP_FORCE		0x40 /* force NIC to stopped state */
239a07bd003SBill Paul 
240a07bd003SBill Paul /* Interrupt control register */
241a07bd003SBill Paul 
242a07bd003SBill Paul #define VGE_INTCTL_SC_RELOAD		0x01 /* reload hold timer */
243a07bd003SBill Paul #define VGE_INTCTL_HC_RELOAD		0x02 /* enable hold timer reload */
244a07bd003SBill Paul #define VGE_INTCTL_STATUS		0x04 /* interrupt pending status */
245a07bd003SBill Paul #define VGE_INTCTL_MASK			0x18 /* multilayer int mask */
246a07bd003SBill Paul #define VGE_INTCTL_RXINTSUP_DISABLE	0x20 /* disable RX int supression */
247a07bd003SBill Paul #define VGE_INTCTL_TXINTSUP_DISABLE	0x40 /* disable TX int supression */
248a07bd003SBill Paul #define VGE_INTCTL_SOFTINT		0x80 /* request soft interrupt */
249a07bd003SBill Paul 
250a07bd003SBill Paul #define VGE_INTMASK_LAYER0		0x00
251a07bd003SBill Paul #define VGE_INTMASK_LAYER1		0x08
252a07bd003SBill Paul #define VGE_INTMASK_ALL			0x10
253a07bd003SBill Paul #define VGE_INTMASK_ALL2		0x18
254a07bd003SBill Paul 
255a07bd003SBill Paul /* Transmit host error status register */
256a07bd003SBill Paul 
257a07bd003SBill Paul #define VGE_TXHOSTERR_TDSTRUCT		0x01 /* bad TX desc structure */
258a07bd003SBill Paul #define VGE_TXHOSTERR_TDFETCH_BUSERR	0x02 /* bus error on desc fetch */
259a07bd003SBill Paul #define VGE_TXHOSTERR_TDWBACK_BUSERR	0x04 /* bus error on desc writeback */
260a07bd003SBill Paul #define VGE_TXHOSTERR_FIFOERR		0x08 /* TX FIFO DMA bus error */
261a07bd003SBill Paul 
262a07bd003SBill Paul /* Receive host error status register */
263a07bd003SBill Paul 
264a07bd003SBill Paul #define VGE_RXHOSTERR_RDSTRUCT		0x01 /* bad RX desc structure */
265a07bd003SBill Paul #define VGE_RXHOSTERR_RDFETCH_BUSERR	0x02 /* bus error on desc fetch */
266a07bd003SBill Paul #define VGE_RXHOSTERR_RDWBACK_BUSERR	0x04 /* bus error on desc writeback */
267a07bd003SBill Paul #define VGE_RXHOSTERR_FIFOERR		0x08 /* RX FIFO DMA bus error */
268a07bd003SBill Paul 
269a07bd003SBill Paul /* Interrupt status register */
270a07bd003SBill Paul 
271a07bd003SBill Paul #define VGE_ISR_RXOK_HIPRIO	0x00000001 /* hi prio RX int */
272a07bd003SBill Paul #define VGE_ISR_TXOK_HIPRIO	0x00000002 /* hi prio TX int */
273a07bd003SBill Paul #define VGE_ISR_RXOK		0x00000004 /* normal RX done */
274a07bd003SBill Paul #define VGE_ISR_TXOK		0x00000008 /* combo results for next 4 bits */
275a07bd003SBill Paul #define VGE_ISR_TXOK0		0x00000010 /* TX complete on queue 0 */
276a07bd003SBill Paul #define VGE_ISR_TXOK1		0x00000020 /* TX complete on queue 1 */
277a07bd003SBill Paul #define VGE_ISR_TXOK2		0x00000040 /* TX complete on queue 2 */
278a07bd003SBill Paul #define VGE_ISR_TXOK3		0x00000080 /* TX complete on queue 3 */
279a07bd003SBill Paul #define VGE_ISR_RXCNTOFLOW	0x00000400 /* RX packet count overflow */
280a07bd003SBill Paul #define VGE_ISR_RXPAUSE		0x00000800 /* pause frame RX'ed */
281a07bd003SBill Paul #define VGE_ISR_RXOFLOW		0x00001000 /* RX FIFO overflow */
282a07bd003SBill Paul #define VGE_ISR_RXNODESC	0x00002000 /* ran out of RX descriptors */
283a07bd003SBill Paul #define VGE_ISR_RXNODESC_WARN	0x00004000 /* running out of RX descs */
284a07bd003SBill Paul #define VGE_ISR_LINKSTS		0x00008000 /* link status change */
285a07bd003SBill Paul #define VGE_ISR_TIMER0		0x00010000 /* one shot timer expired */
286a07bd003SBill Paul #define VGE_ISR_TIMER1		0x00020000 /* periodic timer expired */
287a07bd003SBill Paul #define VGE_ISR_PWR		0x00040000 /* wake up power event */
288a07bd003SBill Paul #define VGE_ISR_PHYINT		0x00080000 /* PHY interrupt */
289a07bd003SBill Paul #define VGE_ISR_STOPPED		0x00100000 /* software shutdown complete */
290a07bd003SBill Paul #define VGE_ISR_MIBOFLOW	0x00200000 /* MIB counter overflow warning */
291a07bd003SBill Paul #define VGE_ISR_SOFTINT		0x00400000 /* software interrupt */
292a07bd003SBill Paul #define VGE_ISR_HOLDOFF_RELOAD	0x00800000 /* reload hold timer */
293a07bd003SBill Paul #define VGE_ISR_RXDMA_STALL	0x01000000 /* RX DMA stall */
294a07bd003SBill Paul #define VGE_ISR_TXDMA_STALL	0x02000000 /* TX DMA STALL */
295a07bd003SBill Paul #define VGE_ISR_ISRC0		0x10000000 /* interrupt source indication */
296a07bd003SBill Paul #define VGE_ISR_ISRC1		0x20000000 /* interrupt source indication */
297a07bd003SBill Paul #define VGE_ISR_ISRC2		0x40000000 /* interrupt source indication */
298a07bd003SBill Paul #define VGE_ISR_ISRC3		0x80000000 /* interrupt source indication */
299a07bd003SBill Paul 
300a07bd003SBill Paul #define VGE_INTRS	(VGE_ISR_TXOK0|VGE_ISR_RXOK|VGE_ISR_STOPPED|	\
301a07bd003SBill Paul 			 VGE_ISR_RXOFLOW|VGE_ISR_PHYINT|		\
302a07bd003SBill Paul 			 VGE_ISR_LINKSTS|VGE_ISR_RXNODESC|		\
3033b2b8afbSPyun YongHyeon 			 VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL)
304a07bd003SBill Paul 
305a3f4b452SPyun YongHyeon #define VGE_INTRS_POLLING	(VGE_ISR_PHYINT|VGE_ISR_LINKSTS)
306a3f4b452SPyun YongHyeon 
307a07bd003SBill Paul /* Interrupt mask register */
308a07bd003SBill Paul 
309a07bd003SBill Paul #define VGE_IMR_RXOK_HIPRIO	0x00000001 /* hi prio RX int */
310a07bd003SBill Paul #define VGE_IMR_TXOK_HIPRIO	0x00000002 /* hi prio TX int */
311a07bd003SBill Paul #define VGE_IMR_RXOK		0x00000004 /* normal RX done */
312a07bd003SBill Paul #define VGE_IMR_TXOK		0x00000008 /* combo results for next 4 bits */
313a07bd003SBill Paul #define VGE_IMR_TXOK0		0x00000010 /* TX complete on queue 0 */
314a07bd003SBill Paul #define VGE_IMR_TXOK1		0x00000020 /* TX complete on queue 1 */
315a07bd003SBill Paul #define VGE_IMR_TXOK2		0x00000040 /* TX complete on queue 2 */
316a07bd003SBill Paul #define VGE_IMR_TXOK3		0x00000080 /* TX complete on queue 3 */
317a07bd003SBill Paul #define VGE_IMR_RXCNTOFLOW	0x00000400 /* RX packet count overflow */
318a07bd003SBill Paul #define VGE_IMR_RXPAUSE		0x00000800 /* pause frame RX'ed */
319a07bd003SBill Paul #define VGE_IMR_RXOFLOW		0x00001000 /* RX FIFO overflow */
320a07bd003SBill Paul #define VGE_IMR_RXNODESC	0x00002000 /* ran out of RX descriptors */
321a07bd003SBill Paul #define VGE_IMR_RXNODESC_WARN	0x00004000 /* running out of RX descs */
322a07bd003SBill Paul #define VGE_IMR_LINKSTS		0x00008000 /* link status change */
323a07bd003SBill Paul #define VGE_IMR_TIMER0		0x00010000 /* one shot timer expired */
324a07bd003SBill Paul #define VGE_IMR_TIMER1		0x00020000 /* periodic timer expired */
325a07bd003SBill Paul #define VGE_IMR_PWR		0x00040000 /* wake up power event */
326a07bd003SBill Paul #define VGE_IMR_PHYINT		0x00080000 /* PHY interrupt */
327a07bd003SBill Paul #define VGE_IMR_STOPPED		0x00100000 /* software shutdown complete */
328a07bd003SBill Paul #define VGE_IMR_MIBOFLOW	0x00200000 /* MIB counter overflow warning */
329a07bd003SBill Paul #define VGE_IMR_SOFTINT		0x00400000 /* software interrupt */
330a07bd003SBill Paul #define VGE_IMR_HOLDOFF_RELOAD	0x00800000 /* reload hold timer */
331a07bd003SBill Paul #define VGE_IMR_RXDMA_STALL	0x01000000 /* RX DMA stall */
332a07bd003SBill Paul #define VGE_IMR_TXDMA_STALL	0x02000000 /* TX DMA STALL */
333a07bd003SBill Paul #define VGE_IMR_ISRC0		0x10000000 /* interrupt source indication */
334a07bd003SBill Paul #define VGE_IMR_ISRC1		0x20000000 /* interrupt source indication */
335a07bd003SBill Paul #define VGE_IMR_ISRC2		0x40000000 /* interrupt source indication */
336a07bd003SBill Paul #define VGE_IMR_ISRC3		0x80000000 /* interrupt source indication */
337a07bd003SBill Paul 
338a07bd003SBill Paul /* TX descriptor queue control/status register */
339a07bd003SBill Paul 
340a07bd003SBill Paul #define VGE_TXQCSR_RUN0		0x0001	/* Enable TX queue 0 */
341a07bd003SBill Paul #define VGE_TXQCSR_ACT0		0x0002	/* queue 0 active indicator */
342a07bd003SBill Paul #define VGE_TXQCSR_WAK0		0x0004	/* Wake up (poll) queue 0 */
343bf93bee5SPyun YongHyeon #define VGE_TXQCSR_DEAD0	0x0008	/* queue 0 dead indicator */
344a07bd003SBill Paul #define VGE_TXQCSR_RUN1		0x0010	/* Enable TX queue 1 */
345a07bd003SBill Paul #define VGE_TXQCSR_ACT1		0x0020	/* queue 1 active indicator */
346a07bd003SBill Paul #define VGE_TXQCSR_WAK1		0x0040	/* Wake up (poll) queue 1 */
347bf93bee5SPyun YongHyeon #define VGE_TXQCSR_DEAD1	0x0080	/* queue 1 dead indicator */
348a07bd003SBill Paul #define VGE_TXQCSR_RUN2		0x0100	/* Enable TX queue 2 */
349a07bd003SBill Paul #define VGE_TXQCSR_ACT2		0x0200	/* queue 2 active indicator */
350a07bd003SBill Paul #define VGE_TXQCSR_WAK2		0x0400	/* Wake up (poll) queue 2 */
351bf93bee5SPyun YongHyeon #define VGE_TXQCSR_DEAD2	0x0800	/* queue 2 dead indicator */
352a07bd003SBill Paul #define VGE_TXQCSR_RUN3		0x1000	/* Enable TX queue 3 */
353a07bd003SBill Paul #define VGE_TXQCSR_ACT3		0x2000	/* queue 3 active indicator */
354a07bd003SBill Paul #define VGE_TXQCSR_WAK3		0x4000	/* Wake up (poll) queue 3 */
355bf93bee5SPyun YongHyeon #define VGE_TXQCSR_DEAD3	0x8000	/* queue 3 dead indicator */
356a07bd003SBill Paul 
357a07bd003SBill Paul /* RX descriptor queue control/status register */
358a07bd003SBill Paul 
359a07bd003SBill Paul #define VGE_RXQCSR_RUN		0x0001	/* Enable RX queue */
360a07bd003SBill Paul #define VGE_RXQCSR_ACT		0x0002	/* queue active indicator */
361a07bd003SBill Paul #define VGE_RXQCSR_WAK		0x0004	/* Wake up (poll) queue */
362a07bd003SBill Paul #define VGE_RXQCSR_DEAD		0x0008	/* queue dead indicator */
363a07bd003SBill Paul 
364a07bd003SBill Paul /* RX/TX queue empty interrupt delay timer register */
365a07bd003SBill Paul 
366a07bd003SBill Paul #define VGE_QTIMER_PENDCNT	0x3F
367a07bd003SBill Paul #define VGE_QTIMER_RESOLUTION	0xC0
368a07bd003SBill Paul 
369a07bd003SBill Paul #define VGE_QTIMER_RES_1US	0x00
370a07bd003SBill Paul #define VGE_QTIMER_RES_4US	0x40
371a07bd003SBill Paul #define VGE_QTIMER_RES_16US	0x80
372a07bd003SBill Paul #define VGE_QTIMER_RES_64US	0xC0
373a07bd003SBill Paul 
374a07bd003SBill Paul /* CAM address register */
375a07bd003SBill Paul 
376a07bd003SBill Paul #define VGE_CAMADDR_ADDR	0x3F	/* CAM address to program */
377a07bd003SBill Paul #define VGE_CAMADDR_AVSEL	0x40	/* 0 = address cam, 1 = VLAN cam */
378a07bd003SBill Paul #define VGE_CAMADDR_ENABLE	0x80	/* enable CAM read/write */
379a07bd003SBill Paul 
380a07bd003SBill Paul #define VGE_CAM_MAXADDRS	64
381a07bd003SBill Paul 
382a07bd003SBill Paul /*
383a07bd003SBill Paul  * CAM command register
384a07bd003SBill Paul  * Note that the page select bits in this register affect three
385a07bd003SBill Paul  * different things:
386a07bd003SBill Paul  * - The behavior of the MAR0/MAR1 registers at offset 0x10 (the
387a07bd003SBill Paul  *   page select bits control whether the MAR0/MAR1 registers affect
388a07bd003SBill Paul  *   the multicast hash filter or the CAM table)
389a07bd003SBill Paul  * - The behavior of the interrupt holdoff timer register at offset
390a07bd003SBill Paul  *   0x20 (the page select bits allow you to set the interrupt
391a07bd003SBill Paul  *   holdoff timer, the TX interrupt supression count or the
392a07bd003SBill Paul  *   RX interrupt supression count)
393a07bd003SBill Paul  * - The behavior the WOL pattern programming registers at offset
394a07bd003SBill Paul  *   0xC0 (controls which pattern is set)
395a07bd003SBill Paul  */
396a07bd003SBill Paul 
397a07bd003SBill Paul #define VGE_CAMCTL_WRITE	0x04	/* CAM write command */
398a07bd003SBill Paul #define VGE_CAMCTL_READ		0x08	/* CAM read command */
399a07bd003SBill Paul #define VGE_CAMCTL_INTPKT_SIZ	0x10	/* select interesting pkt CAM size */
400a07bd003SBill Paul #define VGE_CAMCTL_INTPKT_ENB	0x20	/* enable interesting packet mode */
401a07bd003SBill Paul #define VGE_CAMCTL_PAGESEL	0xC0	/* page select */
402a07bd003SBill Paul 
403a07bd003SBill Paul #define VGE_PAGESEL_MAR		0x00
404a07bd003SBill Paul #define VGE_PAGESEL_CAMMASK	0x40
405a07bd003SBill Paul #define VGE_PAGESEL_CAMDATA	0x80
406a07bd003SBill Paul 
407a07bd003SBill Paul #define VGE_PAGESEL_INTHLDOFF	0x00
408a07bd003SBill Paul #define VGE_PAGESEL_TXSUPPTHR	0x40
409a07bd003SBill Paul #define VGE_PAGESEL_RXSUPPTHR	0x80
410a07bd003SBill Paul 
411a07bd003SBill Paul #define VGE_PAGESEL_WOLPAT0	0x00
412a07bd003SBill Paul #define VGE_PAGESEL_WOLPAT1	0x40
413a07bd003SBill Paul 
414a07bd003SBill Paul /* MII port config register */
415a07bd003SBill Paul 
416a07bd003SBill Paul #define VGE_MIICFG_PHYADDR	0x1F	/* PHY address (internal PHY is 1) */
417a07bd003SBill Paul #define VGE_MIICFG_MDCSPEED	0x20	/* MDC accelerate x 4 */
418a07bd003SBill Paul #define VGE_MIICFG_POLLINT	0xC0	/* polling interval */
419a07bd003SBill Paul 
420a07bd003SBill Paul #define VGE_MIIPOLLINT_1024	0x00
421a07bd003SBill Paul #define VGE_MIIPOLLINT_512	0x40
422a07bd003SBill Paul #define VGE_MIIPOLLINT_128	0x80
423a07bd003SBill Paul #define VGE_MIIPOLLINT_64	0xC0
424a07bd003SBill Paul 
425a07bd003SBill Paul /* MII port status register */
426a07bd003SBill Paul 
427a07bd003SBill Paul #define VGE_MIISTS_IIDL		0x80	/* not at sofrware/timer poll cycle */
428a07bd003SBill Paul 
429a07bd003SBill Paul /* PHY status register */
430a07bd003SBill Paul 
431a07bd003SBill Paul #define VGE_PHYSTS_TXFLOWCAP	0x01	/* resolved TX flow control cap */
432a07bd003SBill Paul #define VGE_PHYSTS_RXFLOWCAP	0x02	/* resolved RX flow control cap */
433a07bd003SBill Paul #define VGE_PHYSTS_SPEED10	0x04	/* PHY in 10Mbps mode */
434a07bd003SBill Paul #define VGE_PHYSTS_SPEED1000	0x08	/* PHY in giga mode */
435a07bd003SBill Paul #define VGE_PHYSTS_FDX		0x10	/* PHY in full duplex mode */
436a07bd003SBill Paul #define VGE_PHYSTS_LINK		0x40	/* link status */
437a07bd003SBill Paul #define VGE_PHYSTS_RESETSTS	0x80	/* reset status */
438a07bd003SBill Paul 
439a07bd003SBill Paul /* MII management command register */
440a07bd003SBill Paul 
441a07bd003SBill Paul #define VGE_MIICMD_MDC		0x01	/* clock pin */
442a07bd003SBill Paul #define VGE_MIICMD_MDI		0x02	/* data in pin */
443a07bd003SBill Paul #define VGE_MIICMD_MDO		0x04	/* data out pin */
444a07bd003SBill Paul #define VGE_MIICMD_MOUT		0x08	/* data out pin enable */
445a07bd003SBill Paul #define VGE_MIICMD_MDP		0x10	/* enable direct programming mode */
446a07bd003SBill Paul #define VGE_MIICMD_WCMD		0x20	/* embedded mode write */
447*04440331SGordon Bergling #define VGE_MIICMD_RCMD		0x40	/* embedded mode read */
448a07bd003SBill Paul #define VGE_MIICMD_MAUTO	0x80	/* enable autopolling */
449a07bd003SBill Paul 
450a07bd003SBill Paul /* MII address register */
451a07bd003SBill Paul 
452a07bd003SBill Paul #define VGE_MIIADDR_SWMPL	0x80	/* initiate priority resolution */
453a07bd003SBill Paul 
454a07bd003SBill Paul /* Chip config register A */
455a07bd003SBill Paul 
456a07bd003SBill Paul #define VGE_CHIPCFG0_PACPI	0x01	/* pre-ACPI wakeup function */
457a07bd003SBill Paul #define VGE_CHIPCFG0_ABSHDN	0x02	/* abnormal shutdown function */
458a07bd003SBill Paul #define VGE_CHIPCFG0_GPIO1PD	0x04	/* GPIO pin enable */
459a07bd003SBill Paul #define VGE_CHIPCFG0_SKIPTAG	0x08	/* omit 802.1p tag from CRC calc */
460a07bd003SBill Paul #define VGE_CHIPCFG0_PHLED	0x30	/* phy LED select */
461a07bd003SBill Paul 
462a07bd003SBill Paul /* Chip config register B */
463a07bd003SBill Paul /* Note: some of these bits are not documented in the manual! */
464a07bd003SBill Paul 
465a07bd003SBill Paul #define VGE_CHIPCFG1_BAKOPT	0x01
466a07bd003SBill Paul #define VGE_CHIPCFG1_MBA	0x02
467a07bd003SBill Paul #define VGE_CHIPCFG1_CAP	0x04
468a07bd003SBill Paul #define VGE_CHIPCFG1_CRANDOM	0x08
469a07bd003SBill Paul #define VGE_CHIPCFG1_OFSET	0x10
470a07bd003SBill Paul #define VGE_CHIPCFG1_SLOTTIME	0x20	/* slot time 512/500 in giga mode */
471a07bd003SBill Paul #define VGE_CHIPCFG1_MIIOPT	0x40
472a07bd003SBill Paul #define VGE_CHIPCFG1_GTCKOPT	0x80
473a07bd003SBill Paul 
474a07bd003SBill Paul /* Chip config register C */
475a07bd003SBill Paul 
476a07bd003SBill Paul #define VGE_CHIPCFG2_EELOAD	0x80	/* enable EEPROM programming */
477a07bd003SBill Paul 
478a07bd003SBill Paul /* Chip config register D */
479a07bd003SBill Paul 
480a07bd003SBill Paul #define VGE_CHIPCFG3_64BIT_DAC	0x20	/* enable 64bit via DAC */
481a07bd003SBill Paul #define VGE_CHIPCFG3_IODISABLE	0x80	/* disable I/O access mode */
482a07bd003SBill Paul 
483a07bd003SBill Paul /* DMA config register 0 */
484a07bd003SBill Paul 
485a07bd003SBill Paul #define VGE_DMACFG0_BURSTLEN	0x07	/* RX/TX DMA burst (in dwords) */
486a07bd003SBill Paul 
487a07bd003SBill Paul #define VGE_DMABURST_8		0x00
488a07bd003SBill Paul #define VGE_DMABURST_16		0x01
489a07bd003SBill Paul #define VGE_DMABURST_32		0x02
490a07bd003SBill Paul #define VGE_DMABURST_64		0x03
491a07bd003SBill Paul #define VGE_DMABURST_128	0x04
492a07bd003SBill Paul #define VGE_DMABURST_256	0x05
493a07bd003SBill Paul #define VGE_DMABURST_STRFWD	0x07
494a07bd003SBill Paul 
495a07bd003SBill Paul /* DMA config register 1 */
496a07bd003SBill Paul 
497a07bd003SBill Paul #define VGE_DMACFG1_LATENB	0x01	/* Latency timer enable */
498a07bd003SBill Paul #define VGE_DMACFG1_MWWAIT	0x02	/* insert wait on master write */
499a07bd003SBill Paul #define VGE_DMACFG1_MRWAIT	0x04	/* insert wait on master read */
500a07bd003SBill Paul #define VGE_DMACFG1_MRM		0x08	/* use memory read multiple */
501a07bd003SBill Paul #define VGE_DMACFG1_PERR_DIS	0x10	/* disable parity error checking */
502a07bd003SBill Paul #define VGE_DMACFG1_XMRL	0x20	/* disable memory read line support */
503a07bd003SBill Paul 
504a07bd003SBill Paul /* RX MAC config register */
505a07bd003SBill Paul 
506a07bd003SBill Paul #define VGE_RXCFG_VLANFILT	0x01	/* filter VLAN ID mismatches */
507a07bd003SBill Paul #define VGE_RXCFG_VTAGOPT	0x06	/* VLAN tag handling */
508a07bd003SBill Paul #define VGE_RXCFG_FIFO_LOWAT	0x08	/* RX FIFO low watermark (7QW/15QW) */
509a07bd003SBill Paul #define VGE_RXCFG_FIFO_THR	0x30	/* RX FIFO threshold */
510a07bd003SBill Paul #define VGE_RXCFG_ARB_PRIO	0x80	/* arbitration priority */
511a07bd003SBill Paul 
512a07bd003SBill Paul #define VGE_VTAG_OPT0		0x00	/* TX: no tag insertion
513a07bd003SBill Paul 					   RX: rx all, no tag extraction */
514a07bd003SBill Paul 
515a07bd003SBill Paul #define VGE_VTAG_OPT1		0x02	/* TX: no tag insertion
516a07bd003SBill Paul 					   RX: rx only tagged pkts, no
517a07bd003SBill Paul 					       extraction */
518a07bd003SBill Paul 
519a07bd003SBill Paul #define VGE_VTAG_OPT2		0x04	/* TX: perform tag insertion,
520a07bd003SBill Paul 					   RX: rx all, extract tags */
521a07bd003SBill Paul 
522a07bd003SBill Paul #define VGE_VTAG_OPT3		0x06	/* TX: perform tag insertion,
523a07bd003SBill Paul 					   RX: rx only tagged pkts,
524a07bd003SBill Paul 					       with extraction */
525a07bd003SBill Paul 
526a07bd003SBill Paul #define VGE_RXFIFOTHR_128BYTES	0x00
527a07bd003SBill Paul #define VGE_RXFIFOTHR_512BYTES	0x10
528a07bd003SBill Paul #define VGE_RXFIFOTHR_1024BYTES	0x20
529a07bd003SBill Paul #define VGE_RXFIFOTHR_STRNFWD	0x30
530a07bd003SBill Paul 
531a07bd003SBill Paul /* TX MAC config register */
532a07bd003SBill Paul 
533a07bd003SBill Paul #define VGE_TXCFG_SNAPOPT	0x01	/* 1 == insert VLAN tag at
534a07bd003SBill Paul 					   13th byte
535a07bd003SBill Paul 					   0 == insert VLANM tag after
536a07bd003SBill Paul 					   SNAP header (21st byte) */
537a07bd003SBill Paul #define VGE_TXCFG_NONBLK	0x02	/* priority TX/non-blocking mode */
538a07bd003SBill Paul #define VGE_TXCFG_NONBLK_THR	0x0C	/* non-blocking threshold */
539a07bd003SBill Paul #define VGE_TXCFG_ARB_PRIO	0x80	/* arbitration priority */
540a07bd003SBill Paul 
541a07bd003SBill Paul #define VGE_TXBLOCK_64PKTS	0x00
542a07bd003SBill Paul #define VGE_TXBLOCK_32PKTS	0x04
543a07bd003SBill Paul #define VGE_TXBLOCK_128PKTS	0x08
544a07bd003SBill Paul #define VGE_TXBLOCK_8PKTS	0x0C
545a07bd003SBill Paul 
5467129fb20SPyun YongHyeon /* MIB control/status register */
5477129fb20SPyun YongHyeon #define	VGE_MIBCSR_CLR		0x01
5487129fb20SPyun YongHyeon #define	VGE_MIBCSR_RINI		0x02
5497129fb20SPyun YongHyeon #define	VGE_MIBCSR_FLUSH	0x04
5507129fb20SPyun YongHyeon #define	VGE_MIBCSR_FREEZE	0x08
5517129fb20SPyun YongHyeon #define	VGE_MIBCSR_HI_80	0x00
5527129fb20SPyun YongHyeon #define	VGE_MIBCSR_HI_C0	0x10
5537129fb20SPyun YongHyeon #define	VGE_MIBCSR_BISTGO	0x40
5547129fb20SPyun YongHyeon #define	VGE_MIBCSR_BISTOK	0x80
5557129fb20SPyun YongHyeon 
5567129fb20SPyun YongHyeon /* MIB data index. */
5577129fb20SPyun YongHyeon #define	VGE_MIB_RX_FRAMES		0
5587129fb20SPyun YongHyeon #define	VGE_MIB_RX_GOOD_FRAMES		1
5597129fb20SPyun YongHyeon #define	VGE_MIB_TX_GOOD_FRAMES		2
5607129fb20SPyun YongHyeon #define	VGE_MIB_RX_FIFO_OVERRUNS	3
5617129fb20SPyun YongHyeon #define	VGE_MIB_RX_RUNTS		4
5627129fb20SPyun YongHyeon #define	VGE_MIB_RX_RUNTS_ERRS		5
5637129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_64		6
5647129fb20SPyun YongHyeon #define	VGE_MIB_TX_PKTS_64		7
5657129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_65_127		8
5667129fb20SPyun YongHyeon #define	VGE_MIB_TX_PKTS_65_127		9
5677129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_128_255		10
5687129fb20SPyun YongHyeon #define	VGE_MIB_TX_PKTS_128_255		11
5697129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_256_511		12
5707129fb20SPyun YongHyeon #define	VGE_MIB_TX_PKTS_256_511		13
5717129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_512_1023	14
5727129fb20SPyun YongHyeon #define	VGE_MIB_TX_PKTS_512_1023	15
5737129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_1024_1518	16
5747129fb20SPyun YongHyeon #define	VGE_MIB_TX_PKTS_1024_1518	17
5757129fb20SPyun YongHyeon #define	VGE_MIB_TX_COLLS		18
5767129fb20SPyun YongHyeon #define	VGE_MIB_RX_CRCERRS		19
5777129fb20SPyun YongHyeon #define	VGE_MIB_RX_JUMBOS		20
5787129fb20SPyun YongHyeon #define	VGE_MIB_TX_JUMBOS		21
5797129fb20SPyun YongHyeon #define	VGE_MIB_RX_PAUSE		22
5807129fb20SPyun YongHyeon #define	VGE_MIB_TX_PAUSE		23
5817129fb20SPyun YongHyeon #define	VGE_MIB_RX_ALIGNERRS		24
5827129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_1519_MAX	25
5837129fb20SPyun YongHyeon #define	VGE_MIB_RX_PKTS_1519_MAX_ERRS	26
5847129fb20SPyun YongHyeon #define	VGE_MIB_TX_SQEERRS		27
5857129fb20SPyun YongHyeon #define	VGE_MIB_RX_NOBUFS		28
5867129fb20SPyun YongHyeon #define	VGE_MIB_RX_SYMERRS		29
5877129fb20SPyun YongHyeon #define	VGE_MIB_RX_LENERRS		30
5887129fb20SPyun YongHyeon #define	VGE_MIB_TX_LATECOLLS		31
5897129fb20SPyun YongHyeon 
5907129fb20SPyun YongHyeon #define	VGE_MIB_CNT		(VGE_MIB_TX_LATECOLLS - VGE_MIB_RX_FRAMES + 1)
5917129fb20SPyun YongHyeon #define	VGE_MIB_DATA_MASK	0x00FFFFFF
5927129fb20SPyun YongHyeon #define	VGE_MIB_DATA_IDX(x)	((x) >> 24)
5937129fb20SPyun YongHyeon 
5947fc94bc4SPyun YongHyeon /* Sticky bit shadow register */
5957fc94bc4SPyun YongHyeon 
5967fc94bc4SPyun YongHyeon #define	VGE_STICKHW_DS0		0x01
5977fc94bc4SPyun YongHyeon #define	VGE_STICKHW_DS1		0x02
5987fc94bc4SPyun YongHyeon #define	VGE_STICKHW_WOL_ENB	0x04
5997fc94bc4SPyun YongHyeon #define	VGE_STICKHW_WOL_STS	0x08
6007fc94bc4SPyun YongHyeon #define	VGE_STICKHW_SWPTAG	0x10
6017fc94bc4SPyun YongHyeon 
6027fc94bc4SPyun YongHyeon /* WOL pattern control */
6037fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN0	0x01
6047fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN1	0x02
6057fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN2	0x04
6067fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN3	0x08
6077fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN4	0x10
6087fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN5	0x20
6097fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN6	0x40
6107fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN7	0x80
6117fc94bc4SPyun YongHyeon #define	VGE_WOLCR0_PATTERN_ALL	0xFF
6127fc94bc4SPyun YongHyeon 
6137fc94bc4SPyun YongHyeon /* WOL event control */
6147fc94bc4SPyun YongHyeon #define	VGE_WOLCR1_UCAST	0x01
6157fc94bc4SPyun YongHyeon #define	VGE_WOLCR1_MAGIC	0x02
6167fc94bc4SPyun YongHyeon #define	VGE_WOLCR1_LINKON	0x04
6177fc94bc4SPyun YongHyeon #define	VGE_WOLCR1_LINKOFF	0x08
6187fc94bc4SPyun YongHyeon 
6197fc94bc4SPyun YongHyeon /* Poweer management config */
6207fc94bc4SPyun YongHyeon #define VGE_PWRCFG_LEGACY_WOLEN	0x01
6217fc94bc4SPyun YongHyeon #define VGE_PWRCFG_WOL_PULSE	0x20
6227fc94bc4SPyun YongHyeon #define VGE_PWRCFG_WOL_BUTTON	0x00
6237fc94bc4SPyun YongHyeon 
6247fc94bc4SPyun YongHyeon /* WOL config register */
6257fc94bc4SPyun YongHyeon #define	VGE_WOLCFG_PHYINT_ENB	0x01
6267fc94bc4SPyun YongHyeon #define	VGE_WOLCFG_SAB		0x10
6277fc94bc4SPyun YongHyeon #define	VGE_WOLCFG_SAM		0x20
6287fc94bc4SPyun YongHyeon #define	VGE_WOLCFG_PMEOVR	0x80
6297fc94bc4SPyun YongHyeon 
630a07bd003SBill Paul /* EEPROM control/status register */
631a07bd003SBill Paul 
632a07bd003SBill Paul #define VGE_EECSR_EDO		0x01	/* data out pin */
633a07bd003SBill Paul #define VGE_EECSR_EDI		0x02	/* data in pin */
634a07bd003SBill Paul #define VGE_EECSR_ECK		0x04	/* clock pin */
635a07bd003SBill Paul #define VGE_EECSR_ECS		0x08	/* chip select pin */
636a07bd003SBill Paul #define VGE_EECSR_DPM		0x10	/* direct program mode enable */
637a07bd003SBill Paul #define VGE_EECSR_RELOAD	0x20	/* trigger reload from EEPROM */
638a07bd003SBill Paul #define VGE_EECSR_EMBP		0x40	/* embedded program mode enable */
639a07bd003SBill Paul 
640a07bd003SBill Paul /* EEPROM embedded command register */
641a07bd003SBill Paul 
642a07bd003SBill Paul #define VGE_EECMD_ERD		0x01	/* EEPROM read command */
643a07bd003SBill Paul #define VGE_EECMD_EWR		0x02	/* EEPROM write command */
644a07bd003SBill Paul #define VGE_EECMD_EWEN		0x04	/* EEPROM write enable */
645a07bd003SBill Paul #define VGE_EECMD_EWDIS		0x08	/* EEPROM write disable */
646a07bd003SBill Paul #define VGE_EECMD_EDONE		0x80	/* read/write done */
647a07bd003SBill Paul 
648a07bd003SBill Paul /* Chip operation and diagnostic control register */
649a07bd003SBill Paul 
650a07bd003SBill Paul #define VGE_DIAGCTL_PHYINT_ENB	0x01	/* Enable PHY interrupts */
651a07bd003SBill Paul #define VGE_DIAGCTL_TIMER0_RES	0x02	/* timer0 uSec resolution */
652a07bd003SBill Paul #define VGE_DIAGCTL_TIMER1_RES	0x04	/* timer1 uSec resolution */
653a07bd003SBill Paul #define VGE_DIAGCTL_LPSEL_DIS	0x08	/* disable LPSEL field */
654a07bd003SBill Paul #define VGE_DIAGCTL_MACFORCE	0x10	/* MAC side force mode */
655a07bd003SBill Paul #define VGE_DIAGCTL_FCRSVD	0x20	/* reserved for future fiber use */
656a07bd003SBill Paul #define VGE_DIAGCTL_FDXFORCE	0x40	/* force full duplex mode */
657a07bd003SBill Paul #define VGE_DIAGCTL_GMII	0x80	/* force GMII mode, otherwise MII */
658a07bd003SBill Paul 
659a07bd003SBill Paul /* Location of station address in EEPROM */
660a07bd003SBill Paul #define VGE_EE_EADDR		0
661a07bd003SBill Paul 
662a07bd003SBill Paul /* DMA descriptor structures */
663a07bd003SBill Paul 
664a07bd003SBill Paul /*
665a07bd003SBill Paul  * Each TX DMA descriptor has a control and status word, and 7
666a07bd003SBill Paul  * fragment address/length words. If a transmitted packet spans
667a07bd003SBill Paul  * more than 7 fragments, it has to be coalesced.
668a07bd003SBill Paul  */
669a07bd003SBill Paul 
670a07bd003SBill Paul #define VGE_TX_FRAGS	7
671a07bd003SBill Paul 
672a07bd003SBill Paul struct vge_tx_frag {
673a07bd003SBill Paul 	uint32_t		vge_addrlo;
674410f4c60SPyun YongHyeon 	uint32_t		vge_addrhi;
675a07bd003SBill Paul };
676a07bd003SBill Paul 
677a07bd003SBill Paul /*
678a07bd003SBill Paul  * The high bit in the buflen field of fragment #0 has special meaning.
679a07bd003SBill Paul  * Normally, the chip requires the driver to issue a TX poll command
680a07bd003SBill Paul  * for every packet that gets put in the TX DMA queue. Sometimes though,
681a07bd003SBill Paul  * the driver might want to queue up several packets at once and just
682a07bd003SBill Paul  * issue one transmit command to have all of them processed. In order
683a07bd003SBill Paul  * to obtain this behavior, the special 'queue' bit must be set.
684a07bd003SBill Paul  */
685a07bd003SBill Paul 
686410f4c60SPyun YongHyeon #define VGE_TXDESC_Q		0x80000000
687a07bd003SBill Paul 
688a07bd003SBill Paul struct vge_tx_desc {
689a07bd003SBill Paul 	uint32_t		vge_sts;
690a07bd003SBill Paul 	uint32_t		vge_ctl;
691a07bd003SBill Paul 	struct vge_tx_frag	vge_frag[VGE_TX_FRAGS];
692a07bd003SBill Paul };
693a07bd003SBill Paul 
694a07bd003SBill Paul #define VGE_TDSTS_COLLCNT	0x0000000F	/* TX collision count */
695a07bd003SBill Paul #define VGE_TDSTS_COLL		0x00000010	/* collision seen */
696a07bd003SBill Paul #define VGE_TDSTS_OWINCOLL	0x00000020	/* out of window collision */
697a07bd003SBill Paul #define VGE_TDSTS_OWT		0x00000040	/* jumbo frame tx abort */
698a07bd003SBill Paul #define VGE_TDSTS_EXCESSCOLL	0x00000080	/* TX aborted, excess colls */
699a07bd003SBill Paul #define VGE_TDSTS_HBEATFAIL	0x00000100	/* heartbeat detect failed */
700a07bd003SBill Paul #define VGE_TDSTS_CARRLOSS	0x00000200	/* carrier sense lost */
701a07bd003SBill Paul #define VGE_TDSTS_SHUTDOWN	0x00000400	/* shutdown during TX */
702a07bd003SBill Paul #define VGE_TDSTS_LINKFAIL	0x00001000	/* link fail during TX */
703a07bd003SBill Paul #define VGE_TDSTS_GMII		0x00002000	/* GMII transmission */
704a07bd003SBill Paul #define VGE_TDSTS_FDX		0x00004000	/* full duplex transmit */
705a07bd003SBill Paul #define VGE_TDSTS_TXERR		0x00008000	/* error occurred */
706a07bd003SBill Paul #define VGE_TDSTS_SEGSIZE	0x3FFF0000	/* TCP large send size */
707a07bd003SBill Paul #define VGE_TDSTS_OWN		0x80000000	/* own bit */
708a07bd003SBill Paul 
709a07bd003SBill Paul #define VGE_TDCTL_VLANID	0x00000FFF	/* VLAN ID */
710a07bd003SBill Paul #define VGE_TDCTL_CFI		0x00001000	/* VLAN CFI bit */
711a07bd003SBill Paul #define VGE_TDCTL_PRIO		0x0000E000	/* VLAN prio bits */
712a07bd003SBill Paul #define VGE_TDCTL_NOCRC		0x00010000	/* disable CRC generation */
713a07bd003SBill Paul #define VGE_TDCTL_JUMBO		0x00020000	/* jumbo frame */
714a07bd003SBill Paul #define VGE_TDCTL_TCPCSUM	0x00040000	/* do TCP hw checksum */
715a07bd003SBill Paul #define VGE_TDCTL_UDPCSUM	0x00080000	/* do UDP hw checksum */
716a07bd003SBill Paul #define VGE_TDCTL_IPCSUM	0x00100000	/* do IP hw checksum */
717a07bd003SBill Paul #define VGE_TDCTL_VTAG		0x00200000	/* insert VLAN tag */
718a07bd003SBill Paul #define VGE_TDCTL_PRIO_INT	0x00400000	/* priority int request */
719a07bd003SBill Paul #define VGE_TDCTL_TIC		0x00800000	/* transfer int request */
720a07bd003SBill Paul #define VGE_TDCTL_TCPLSCTL	0x03000000	/* TCP large send ctl */
721a07bd003SBill Paul #define VGE_TDCTL_FRAGCNT	0xF0000000	/* number of frags used */
722a07bd003SBill Paul 
723a07bd003SBill Paul #define VGE_TD_LS_MOF		0x00000000	/* middle of large send */
724a07bd003SBill Paul #define VGE_TD_LS_SOF		0x01000000	/* start of large send */
725a07bd003SBill Paul #define VGE_TD_LS_EOF		0x02000000	/* end of large send */
726a07bd003SBill Paul #define VGE_TD_LS_NORM		0x03000000	/* normal frame */
727a07bd003SBill Paul 
728a07bd003SBill Paul /* Receive DMA descriptors have a single fragment pointer. */
729a07bd003SBill Paul 
730a07bd003SBill Paul struct vge_rx_desc {
731410f4c60SPyun YongHyeon 	uint32_t	vge_sts;
732410f4c60SPyun YongHyeon 	uint32_t	vge_ctl;
733410f4c60SPyun YongHyeon 	uint32_t	vge_addrlo;
734410f4c60SPyun YongHyeon 	uint32_t	vge_addrhi;
735a07bd003SBill Paul };
736a07bd003SBill Paul 
737a07bd003SBill Paul /*
738a07bd003SBill Paul  * Like the TX descriptor, the high bit in the buflen field in the
739a07bd003SBill Paul  * RX descriptor has special meaning. This bit controls whether or
740a07bd003SBill Paul  * not interrupts are generated for this descriptor.
741a07bd003SBill Paul  */
742a07bd003SBill Paul 
743410f4c60SPyun YongHyeon #define VGE_RXDESC_I		0x80000000
744a07bd003SBill Paul 
745a07bd003SBill Paul #define VGE_RDSTS_VIDM		0x00000001	/* VLAN tag filter miss */
746a07bd003SBill Paul #define VGE_RDSTS_CRCERR	0x00000002	/* bad CRC error */
747a07bd003SBill Paul #define VGE_RDSTS_FAERR		0x00000004	/* frame alignment error */
748a07bd003SBill Paul #define VGE_RDSTS_CSUMERR	0x00000008	/* bad TCP/IP checksum */
749a07bd003SBill Paul #define VGE_RDSTS_RLERR		0x00000010	/* RX length error */
750a07bd003SBill Paul #define VGE_RDSTS_SYMERR	0x00000020	/* PCS symbol error */
751a07bd003SBill Paul #define VGE_RDSTS_SNTAG		0x00000040	/* RX'ed tagged SNAP pkt */
752a07bd003SBill Paul #define VGE_RDSTS_DETAG		0x00000080	/* VLAN tag extracted */
753a07bd003SBill Paul #define VGE_RDSTS_BOUNDARY	0x00000300	/* frame boundary bits */
754a07bd003SBill Paul #define VGE_RDSTS_VTAG		0x00000400	/* VLAN tag indicator */
755a07bd003SBill Paul #define VGE_RDSTS_UCAST		0x00000800	/* unicast frame */
756a07bd003SBill Paul #define VGE_RDSTS_BCAST		0x00001000	/* broadcast frame */
757a07bd003SBill Paul #define VGE_RDSTS_MCAST		0x00002000	/* multicast frame */
758a07bd003SBill Paul #define VGE_RDSTS_PFT		0x00004000	/* perfect filter hit */
759a07bd003SBill Paul #define VGE_RDSTS_RXOK		0x00008000	/* frame is good. */
760a07bd003SBill Paul #define VGE_RDSTS_BUFSIZ	0x3FFF0000	/* received frame len */
761a07bd003SBill Paul #define VGE_RDSTS_SHUTDOWN	0x40000000	/* shutdown during RX */
762a07bd003SBill Paul #define VGE_RDSTS_OWN		0x80000000	/* own bit. */
763a07bd003SBill Paul 
764a07bd003SBill Paul #define VGE_RXPKT_ONEFRAG	0x00000000	/* only one fragment */
765c7438496SPyun YongHyeon #define VGE_RXPKT_EOF		0x00000100	/* last frag in frame */
766c7438496SPyun YongHyeon #define VGE_RXPKT_SOF		0x00000200	/* first frag in frame */
767a07bd003SBill Paul #define VGE_RXPKT_MOF		0x00000300	/* intermediate frag */
768a07bd003SBill Paul 
769a07bd003SBill Paul #define VGE_RDCTL_VLANID	0x0000FFFF	/* VLAN ID info */
770a07bd003SBill Paul #define VGE_RDCTL_UDPPKT	0x00010000	/* UDP packet received */
771a07bd003SBill Paul #define VGE_RDCTL_TCPPKT	0x00020000	/* TCP packet received */
772a07bd003SBill Paul #define VGE_RDCTL_IPPKT		0x00040000	/* IP packet received */
773a07bd003SBill Paul #define VGE_RDCTL_UDPZERO	0x00080000	/* pkt with UDP CSUM of 0 */
774a07bd003SBill Paul #define VGE_RDCTL_FRAG		0x00100000	/* received IP frag */
775a07bd003SBill Paul #define VGE_RDCTL_PROTOCSUMOK	0x00200000	/* TCP/UDP checksum ok */
776a07bd003SBill Paul #define VGE_RDCTL_IPCSUMOK	0x00400000	/* IP checksum ok */
777a07bd003SBill Paul #define VGE_RDCTL_FILTIDX	0x3C000000	/* interesting filter idx */
778a07bd003SBill Paul 
779a07bd003SBill Paul #endif /* _IF_VGEREG_H_ */
780