if_wmreg.h revision 1.7 1 1.7 thorpej /* $NetBSD: if_wmreg.h,v 1.7 2003/10/21 05:07:10 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright (c) 2001 Wasabi Systems, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 1.1 thorpej *
9 1.1 thorpej * Redistribution and use in source and binary forms, with or without
10 1.1 thorpej * modification, are permitted provided that the following conditions
11 1.1 thorpej * are met:
12 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
13 1.1 thorpej * notice, this list of conditions and the following disclaimer.
14 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
16 1.1 thorpej * documentation and/or other materials provided with the distribution.
17 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
18 1.1 thorpej * must display the following acknowledgement:
19 1.1 thorpej * This product includes software developed for the NetBSD Project by
20 1.1 thorpej * Wasabi Systems, Inc.
21 1.1 thorpej * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.1 thorpej * or promote products derived from this software without specific prior
23 1.1 thorpej * written permission.
24 1.1 thorpej *
25 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
36 1.1 thorpej */
37 1.1 thorpej
38 1.1 thorpej /*
39 1.4 yamt * Register description for the Intel i82542 (``Wiseman''),
40 1.1 thorpej * i82543 (``Livengood''), and i82544 (``Cordova'') Gigabit
41 1.1 thorpej * Ethernet chips.
42 1.1 thorpej */
43 1.1 thorpej
44 1.1 thorpej /*
45 1.1 thorpej * The wiseman supports 64-bit PCI addressing. This structure
46 1.1 thorpej * describes the address in descriptors.
47 1.1 thorpej */
48 1.1 thorpej typedef struct wiseman_addr {
49 1.1 thorpej uint32_t wa_low; /* low-order 32 bits */
50 1.1 thorpej uint32_t wa_high; /* high-order 32 bits */
51 1.1 thorpej } __attribute__((__packed__)) wiseman_addr_t;
52 1.1 thorpej
53 1.1 thorpej /*
54 1.1 thorpej * The Wiseman receive descriptor.
55 1.1 thorpej *
56 1.1 thorpej * The receive descriptor ring must be aligned to a 4K boundary,
57 1.1 thorpej * and there must be an even multiple of 8 descriptors in the ring.
58 1.1 thorpej */
59 1.1 thorpej typedef struct wiseman_rxdesc {
60 1.1 thorpej wiseman_addr_t wrx_addr; /* buffer address */
61 1.1 thorpej
62 1.1 thorpej uint16_t wrx_len; /* buffer length */
63 1.1 thorpej uint16_t wrx_cksum; /* checksum (starting at PCSS) */
64 1.1 thorpej
65 1.1 thorpej uint8_t wrx_status; /* Rx status */
66 1.1 thorpej uint8_t wrx_errors; /* Rx errors */
67 1.1 thorpej uint16_t wrx_special; /* special field (VLAN, etc.) */
68 1.1 thorpej } __attribute__((__packed__)) wiseman_rxdesc_t;
69 1.1 thorpej
70 1.1 thorpej /* wrx_status bits */
71 1.1 thorpej #define WRX_ST_DD (1U << 0) /* descriptor done */
72 1.1 thorpej #define WRX_ST_EOP (1U << 1) /* end of packet */
73 1.1 thorpej #define WRX_ST_ISXM (1U << 2) /* ignore checksum indication */
74 1.1 thorpej #define WRX_ST_VP (1U << 3) /* VLAN packet */
75 1.1 thorpej #define WRX_ST_BPDU (1U << 4) /* ??? */
76 1.1 thorpej #define WRX_ST_TCPCS (1U << 5) /* TCP checksum performed */
77 1.1 thorpej #define WRX_ST_IPCS (1U << 6) /* IP checksum performed */
78 1.1 thorpej #define WRX_ST_PIF (1U << 7) /* passed in-exact filter */
79 1.1 thorpej
80 1.1 thorpej /* wrx_error bits */
81 1.1 thorpej #define WRX_ER_CE (1U << 0) /* CRC error */
82 1.1 thorpej #define WRX_ER_SE (1U << 1) /* symbol error */
83 1.1 thorpej #define WRX_ER_SEQ (1U << 2) /* sequence error */
84 1.1 thorpej #define WRX_ER_ICE (1U << 3) /* ??? */
85 1.1 thorpej #define WRX_ER_CXE (1U << 4) /* carrier extension error */
86 1.1 thorpej #define WRX_ER_TCPE (1U << 5) /* TCP checksum error */
87 1.1 thorpej #define WRX_ER_IPE (1U << 6) /* IP checksum error */
88 1.1 thorpej #define WRX_ER_RXE (1U << 7) /* Rx data error */
89 1.1 thorpej
90 1.1 thorpej /* wrx_special field for VLAN packets */
91 1.1 thorpej #define WRX_VLAN_ID(x) ((x) & 0x0fff) /* VLAN identifier */
92 1.1 thorpej #define WRX_VLAN_CFI (1U << 12) /* Canonical Form Indicator */
93 1.1 thorpej #define WRX_VLAN_PRI(x) (((x) >> 13) & 7)/* VLAN priority field */
94 1.1 thorpej
95 1.1 thorpej /*
96 1.1 thorpej * The Wiseman transmit descriptor.
97 1.1 thorpej *
98 1.1 thorpej * The transmit descriptor ring must be aligned to a 4K boundary,
99 1.1 thorpej * and there must be an even multiple of 8 descriptors in the ring.
100 1.1 thorpej */
101 1.1 thorpej typedef union wiseman_tx_fields {
102 1.1 thorpej uint32_t wtxu_bits; /* bits; see below; */
103 1.1 thorpej struct {
104 1.1 thorpej uint8_t wtxu_status; /* Tx status */
105 1.1 thorpej uint8_t wtxu_options; /* options */
106 1.1 thorpej uint16_t wtxu_vlan; /* VLAN info */
107 1.1 thorpej } __attribute__((__packed__)) wtxu_fields;
108 1.1 thorpej } __attribute__((__packed__)) wiseman_txfields_t;
109 1.1 thorpej typedef struct wiseman_txdesc {
110 1.1 thorpej wiseman_addr_t wtx_addr; /* buffer address */
111 1.1 thorpej uint32_t wtx_cmdlen; /* command and length */
112 1.1 thorpej wiseman_txfields_t wtx_fields; /* fields; see below */
113 1.1 thorpej } __attribute__((__packed__)) wiseman_txdesc_t;
114 1.1 thorpej
115 1.1 thorpej #define WTX_CMD_EOP (1U << 24) /* end of packet */
116 1.1 thorpej #define WTX_CMD_IFCS (1U << 25) /* insert FCS */
117 1.1 thorpej #define WTX_CMD_RS (1U << 27) /* report status */
118 1.1 thorpej #define WTX_CMD_RPS (1U << 28) /* report packet sent */
119 1.1 thorpej #define WTX_CMD_DEXT (1U << 29) /* descriptor extension */
120 1.1 thorpej #define WTX_CMD_VLE (1U << 30) /* VLAN enable */
121 1.1 thorpej #define WTX_CMD_IDE (1U << 31) /* interrupt delay enable */
122 1.1 thorpej
123 1.1 thorpej /* Descriptor types (if DEXT is set) */
124 1.1 thorpej #define WTX_DTYP_C (0 << 20) /* context */
125 1.1 thorpej #define WTC_DTYP_D (1U << 20) /* data */
126 1.1 thorpej
127 1.1 thorpej /* wtx_fields status bits */
128 1.1 thorpej #define WTX_ST_DD (1U << 0) /* descriptor done */
129 1.1 thorpej #define WTX_ST_EC (1U << 1) /* excessive collisions */
130 1.1 thorpej #define WTX_ST_LC (1U << 2) /* late collision */
131 1.1 thorpej #define WTX_ST_TU (1U << 3) /* transmit underrun */
132 1.1 thorpej
133 1.1 thorpej /* wtx_fields bits for IP/TCP/UDP checksum offload */
134 1.1 thorpej #define WTX_IXSM (1U << 8) /* IP checksum offload */
135 1.1 thorpej #define WTX_TXSM (1U << 9) /* TCP/UDP checksum offload */
136 1.1 thorpej
137 1.1 thorpej /*
138 1.1 thorpej * The Livengood TCP/IP context descriptor.
139 1.1 thorpej */
140 1.1 thorpej struct livengood_tcpip_ctxdesc {
141 1.1 thorpej uint32_t tcpip_ipcs; /* IP checksum context */
142 1.1 thorpej uint32_t tcpip_tucs; /* TCP/UDP checksum context */
143 1.1 thorpej uint32_t tcpip_cmdlen;
144 1.1 thorpej uint32_t tcpip_seg; /* TCP segmentation context */
145 1.1 thorpej };
146 1.1 thorpej
147 1.1 thorpej /* commands for context descriptors */
148 1.2 thorpej #define WTX_TCPIP_CMD_TCP (1U << 24) /* 1 = TCP, 0 = UDP */
149 1.2 thorpej #define WTX_TCPIP_CMD_IP (1U << 25) /* 1 = IPv4, 0 = IPv6 */
150 1.1 thorpej #define WTX_TCPIP_CMD_TSE (1U << 26) /* segmentation context valid */
151 1.1 thorpej
152 1.1 thorpej #define WTX_TCPIP_IPCSS(x) ((x) << 0) /* checksum start */
153 1.1 thorpej #define WTX_TCPIP_IPCSO(x) ((x) << 8) /* checksum value offset */
154 1.1 thorpej #define WTX_TCPIP_IPCSE(x) ((x) << 16) /* checksum end */
155 1.1 thorpej
156 1.1 thorpej #define WTX_TCPIP_TUCSS(x) ((x) << 0) /* checksum start */
157 1.1 thorpej #define WTX_TCPIP_TUCSO(x) ((x) << 8) /* checksum value offset */
158 1.1 thorpej #define WTX_TCPIP_TUCSE(x) ((x) << 16) /* checksum end */
159 1.1 thorpej
160 1.1 thorpej #define WTX_TCPIP_SEG_STATUS(x) ((x) << 0)
161 1.1 thorpej #define WTX_TCPIP_SEG_HDRLEN(x) ((x) << 8)
162 1.1 thorpej #define WTX_TCPIP_SEG_MSS(x) ((x) << 16)
163 1.1 thorpej
164 1.1 thorpej /*
165 1.1 thorpej * PCI config registers used by the Wiseman.
166 1.1 thorpej */
167 1.1 thorpej #define WM_PCI_MMBA PCI_MAPREG_START
168 1.1 thorpej
169 1.1 thorpej /*
170 1.1 thorpej * Wiseman Control/Status Registers.
171 1.1 thorpej */
172 1.1 thorpej #define WMREG_CTRL 0x0000 /* Device Control Register */
173 1.1 thorpej #define CTRL_FD (1U << 0) /* full duplex */
174 1.1 thorpej #define CTRL_BEM (1U << 1) /* big-endian mode */
175 1.1 thorpej #define CTRL_PRIOR (1U << 2) /* 0 = receive, 1 = fair */
176 1.1 thorpej #define CTRL_LRST (1U << 3) /* link reset */
177 1.1 thorpej #define CTRL_ASDE (1U << 5) /* auto speed detect enable */
178 1.1 thorpej #define CTRL_SLU (1U << 6) /* set link up */
179 1.1 thorpej #define CTRL_ILOS (1U << 7) /* invert loss of signal */
180 1.1 thorpej #define CTRL_SPEED(x) ((x) << 8) /* speed (Livengood) */
181 1.1 thorpej #define CTRL_SPEED_10 CTRL_SPEED(0)
182 1.1 thorpej #define CTRL_SPEED_100 CTRL_SPEED(1)
183 1.1 thorpej #define CTRL_SPEED_1000 CTRL_SPEED(2)
184 1.1 thorpej #define CTRL_SPEED_MASK CTRL_SPEED(3)
185 1.1 thorpej #define CTRL_FRCSPD (1U << 11) /* force speed (Livengood) */
186 1.1 thorpej #define CTRL_FRCFDX (1U << 12) /* force full-duplex (Livengood) */
187 1.1 thorpej #define CTRL_SWDPINS_SHIFT 18
188 1.1 thorpej #define CTRL_SWDPINS_MASK 0x0f
189 1.1 thorpej #define CTRL_SWDPIN(x) (1U << (CTRL_SWDPINS_SHIFT + (x)))
190 1.1 thorpej #define CTRL_SWDPIO_SHIFT 22
191 1.1 thorpej #define CTRL_SWDPIO_MASK 0x0f
192 1.1 thorpej #define CTRL_SWDPIO(x) (1U << (CTRL_SWDPIO_SHIFT + (x)))
193 1.1 thorpej #define CTRL_RST (1U << 26) /* device reset */
194 1.1 thorpej #define CTRL_RFCE (1U << 27) /* Rx flow control enable */
195 1.1 thorpej #define CTRL_TFCE (1U << 28) /* Tx flow control enable */
196 1.1 thorpej #define CTRL_VME (1U << 30) /* VLAN Mode Enable */
197 1.1 thorpej #define CTRL_PHY_RESET (1U << 31) /* PHY reset (Cordova) */
198 1.1 thorpej
199 1.7 thorpej #define WMREG_CTRL_SHADOW 0x0004 /* Device Control Register (shadow) */
200 1.6 thorpej
201 1.1 thorpej #define WMREG_STATUS 0x0008 /* Device Status Register */
202 1.1 thorpej #define STATUS_FD (1U << 0) /* full duplex */
203 1.1 thorpej #define STATUS_LU (1U << 1) /* link up */
204 1.1 thorpej #define STATUS_TCKOK (1U << 2) /* Tx clock running */
205 1.1 thorpej #define STATUS_RBCOK (1U << 3) /* Rx clock running */
206 1.3 thorpej #define STATUS_FUNCID_SHIFT 2 /* 82546 function ID */
207 1.3 thorpej #define STATUS_FUNCID_MASK 3 /* ... */
208 1.1 thorpej #define STATUS_TXOFF (1U << 4) /* Tx paused */
209 1.1 thorpej #define STATUS_TBIMODE (1U << 5) /* fiber mode (Livengood) */
210 1.1 thorpej #define STATUS_SPEED(x) ((x) << 6) /* speed indication */
211 1.1 thorpej #define STATUS_SPEED_10 STATUS_SPEED(0)
212 1.1 thorpej #define STATUS_SPEED_100 STATUS_SPEED(1)
213 1.1 thorpej #define STATUS_SPEED_1000 STATUS_SPEED(2)
214 1.1 thorpej #define STATUS_ASDV(x) ((x) << 8) /* auto speed det. val. (Livengood) */
215 1.1 thorpej #define STATUS_MTXCKOK (1U << 10) /* MTXD clock running */
216 1.1 thorpej #define STATUS_PCI66 (1U << 11) /* 66MHz bus (Livengood) */
217 1.1 thorpej #define STATUS_BUS64 (1U << 12) /* 64-bit bus (Livengood) */
218 1.1 thorpej #define STATUS_PCIX_MODE (1U << 13) /* PCIX mode (Cordova) */
219 1.1 thorpej #define STATUS_PCIXSPD(x) ((x) << 14) /* PCIX speed indication (Cordova) */
220 1.1 thorpej #define STATUS_PCIXSPD_50_66 STATUS_PCIXSPD(0)
221 1.1 thorpej #define STATUS_PCIXSPD_66_100 STATUS_PCIXSPD(1)
222 1.1 thorpej #define STATUS_PCIXSPD_100_133 STATUS_PCIXSPD(2)
223 1.1 thorpej
224 1.1 thorpej #define WMREG_EECD 0x0010 /* EEPROM Control Register */
225 1.1 thorpej #define EECD_SK (1U << 0) /* clock */
226 1.1 thorpej #define EECD_CS (1U << 1) /* chip select */
227 1.1 thorpej #define EECD_DI (1U << 2) /* data in */
228 1.1 thorpej #define EECD_DO (1U << 3) /* data out */
229 1.1 thorpej #define EECD_FWE(x) ((x) << 4) /* flash write enable control */
230 1.1 thorpej #define EECD_FWE_DISABLED EECD_FWE(1)
231 1.1 thorpej #define EECD_FWE_ENABLED EECD_FWE(2)
232 1.3 thorpej #define EECD_EE_REQ (1U << 6) /* (shared) EEPROM request */
233 1.3 thorpej #define EECD_EE_GNT (1U << 7) /* (shared) EEPROM grant */
234 1.3 thorpej #define EECD_EE_PRES (1U << 8) /* EEPROM present */
235 1.3 thorpej #define EECD_EE_SIZE (1U << 9) /* EEPROM size
236 1.3 thorpej (0 = 64 word, 1 = 256 word) */
237 1.6 thorpej #define EECD_EE_ABITS (1U << 10) /* EEPROM address bits
238 1.6 thorpej (based on type) */
239 1.6 thorpej #define EECD_EE_TYPE (1U << 13) /* EEPROM type
240 1.6 thorpej (0 = Microwire, 1 = SPI) */
241 1.1 thorpej
242 1.1 thorpej #define UWIRE_OPC_ERASE 0x04 /* MicroWire "erase" opcode */
243 1.1 thorpej #define UWIRE_OPC_WRITE 0x05 /* MicroWire "write" opcode */
244 1.1 thorpej #define UWIRE_OPC_READ 0x06 /* MicroWire "read" opcode */
245 1.6 thorpej
246 1.6 thorpej #define SPI_OPC_WRITE 0x02 /* SPI "write" opcode */
247 1.6 thorpej #define SPI_OPC_READ 0x03 /* SPI "read" opcode */
248 1.6 thorpej #define SPI_OPC_A8 0x08 /* opcode bit 3 == address bit 8 */
249 1.6 thorpej #define SPI_OPC_WREN 0x06 /* SPI "set write enable" opcode */
250 1.6 thorpej #define SPI_OPC_WRDI 0x04 /* SPI "clear write enable" opcode */
251 1.6 thorpej #define SPI_OPC_RDSR 0x05 /* SPI "read status" opcode */
252 1.6 thorpej #define SPI_OPC_WRSR 0x01 /* SPI "write status" opcode */
253 1.6 thorpej #define SPI_MAX_RETRIES 5000 /* max wait of 5ms for RDY signal */
254 1.6 thorpej
255 1.6 thorpej #define SPI_SR_RDY 0x01
256 1.6 thorpej #define SPI_SR_WEN 0x02
257 1.6 thorpej #define SPI_SR_BP0 0x04
258 1.6 thorpej #define SPI_SR_BP1 0x08
259 1.6 thorpej #define SPI_SR_WPEN 0x80
260 1.1 thorpej
261 1.1 thorpej #define EEPROM_OFF_MACADDR 0x00 /* MAC address offset */
262 1.1 thorpej #define EEPROM_OFF_CFG1 0x0a /* config word 1 */
263 1.1 thorpej #define EEPROM_OFF_CFG2 0x0f /* config word 2 */
264 1.1 thorpej #define EEPROM_OFF_SWDPIN 0x20 /* SWD Pins (Cordova) */
265 1.1 thorpej
266 1.1 thorpej #define EEPROM_CFG1_LVDID (1U << 0)
267 1.1 thorpej #define EEPROM_CFG1_LSSID (1U << 1)
268 1.1 thorpej #define EEPROM_CFG1_PME_CLOCK (1U << 2)
269 1.1 thorpej #define EEPROM_CFG1_PM (1U << 3)
270 1.1 thorpej #define EEPROM_CFG1_ILOS (1U << 4)
271 1.1 thorpej #define EEPROM_CFG1_SWDPIO_SHIFT 5
272 1.1 thorpej #define EEPROM_CFG1_SWDPIO_MASK (0xf << EEPROM_CFG1_SWDPIO_SHIFT)
273 1.1 thorpej #define EEPROM_CFG1_IPS1 (1U << 8)
274 1.1 thorpej #define EEPROM_CFG1_LRST (1U << 9)
275 1.1 thorpej #define EEPROM_CFG1_FD (1U << 10)
276 1.1 thorpej #define EEPROM_CFG1_FRCSPD (1U << 11)
277 1.1 thorpej #define EEPROM_CFG1_IPS0 (1U << 12)
278 1.1 thorpej #define EEPROM_CFG1_64_32_BAR (1U << 13)
279 1.1 thorpej
280 1.1 thorpej #define EEPROM_CFG2_CSR_RD_SPLIT (1U << 1)
281 1.1 thorpej #define EEPROM_CFG2_APM_EN (1U << 2)
282 1.1 thorpej #define EEPROM_CFG2_64_BIT (1U << 3)
283 1.1 thorpej #define EEPROM_CFG2_MAX_READ (1U << 4)
284 1.1 thorpej #define EEPROM_CFG2_DMCR_MAP (1U << 5)
285 1.1 thorpej #define EEPROM_CFG2_133_CAP (1U << 6)
286 1.1 thorpej #define EEPROM_CFG2_MSI_DIS (1U << 7)
287 1.1 thorpej #define EEPROM_CFG2_FLASH_DIS (1U << 8)
288 1.1 thorpej #define EEPROM_CFG2_FLASH_SIZE(x) (((x) & 3) >> 9)
289 1.1 thorpej #define EEPROM_CFG2_ANE (1U << 11)
290 1.1 thorpej #define EEPROM_CFG2_PAUSE(x) (((x) & 3) >> 12)
291 1.1 thorpej #define EEPROM_CFG2_ASDE (1U << 14)
292 1.1 thorpej #define EEPROM_CFG2_APM_PME (1U << 15)
293 1.1 thorpej #define EEPROM_CFG2_SWDPIO_SHIFT 4
294 1.1 thorpej #define EEPROM_CFG2_SWDPIO_MASK (0xf << EEPROM_CFG2_SWDPIO_SHIFT)
295 1.1 thorpej
296 1.1 thorpej #define EEPROM_SWDPIN_MASK 0xdf
297 1.1 thorpej #define EEPROM_SWDPIN_SWDPIN_SHIFT 0
298 1.1 thorpej #define EEPROM_SWDPIN_SWDPIO_SHIFT 8
299 1.1 thorpej
300 1.1 thorpej #define WMREG_CTRL_EXT 0x0018 /* Extended Device Control Register */
301 1.1 thorpej #define CTRL_EXT_GPI_EN(x) (1U << (x)) /* gpin interrupt enable */
302 1.1 thorpej #define CTRL_EXT_SWDPINS_SHIFT 4
303 1.1 thorpej #define CTRL_EXT_SWDPINS_MASK 0x0d
304 1.5 matt #define CTRL_EXT_SWDPIN(x) (1U << (CTRL_EXT_SWDPINS_SHIFT + (x) - 4))
305 1.1 thorpej #define CTRL_EXT_SWDPIO_SHIFT 8
306 1.1 thorpej #define CTRL_EXT_SWDPIO_MASK 0x0d
307 1.5 matt #define CTRL_EXT_SWDPIO(x) (1U << (CTRL_EXT_SWDPIO_SHIFT + (x) - 4))
308 1.1 thorpej #define CTRL_EXT_ASDCHK (1U << 12) /* ASD check */
309 1.1 thorpej #define CTRL_EXT_EE_RST (1U << 13) /* EEPROM reset */
310 1.1 thorpej #define CTRL_EXT_IPS (1U << 14) /* invert power state bit 0 */
311 1.1 thorpej #define CTRL_EXT_SPD_BYPS (1U << 15) /* speed select bypass */
312 1.1 thorpej #define CTRL_EXT_IPS1 (1U << 16) /* invert power state bit 1 */
313 1.1 thorpej #define CTRL_EXT_RO_DIS (1U << 17) /* relaxed ordering disabled */
314 1.1 thorpej
315 1.1 thorpej #define WMREG_MDIC 0x0020 /* MDI Control Register */
316 1.1 thorpej #define MDIC_DATA(x) ((x) & 0xffff)
317 1.1 thorpej #define MDIC_REGADD(x) ((x) << 16)
318 1.1 thorpej #define MDIC_PHYADD(x) ((x) << 21)
319 1.1 thorpej #define MDIC_OP_WRITE (1U << 26)
320 1.1 thorpej #define MDIC_OP_READ (2U << 26)
321 1.1 thorpej #define MDIC_READY (1U << 28)
322 1.1 thorpej #define MDIC_I (1U << 29) /* interrupt on MDI complete */
323 1.1 thorpej #define MDIC_E (1U << 30) /* MDI error */
324 1.1 thorpej
325 1.1 thorpej #define WMREG_FCAL 0x0028 /* Flow Control Address Low */
326 1.1 thorpej #define FCAL_CONST 0x00c28001 /* Flow Control MAC addr low */
327 1.1 thorpej
328 1.1 thorpej #define WMREG_FCAH 0x002c /* Flow Control Address High */
329 1.1 thorpej #define FCAH_CONST 0x00000100 /* Flow Control MAC addr high */
330 1.1 thorpej
331 1.1 thorpej #define WMREG_FCT 0x0030 /* Flow Control Type */
332 1.1 thorpej
333 1.1 thorpej #define WMREG_VET 0x0038 /* VLAN Ethertype */
334 1.1 thorpej
335 1.1 thorpej #define WMREG_RAL_BASE 0x0040 /* Receive Address List */
336 1.1 thorpej #define WMREG_CORDOVA_RAL_BASE 0x5400
337 1.1 thorpej #define WMREG_RAL_LO(b, x) ((b) + ((x) << 3))
338 1.1 thorpej #define WMREG_RAL_HI(b, x) (WMREG_RAL_LO(b, x) + 4)
339 1.1 thorpej /*
340 1.1 thorpej * Receive Address List: The LO part is the low-order 32-bits
341 1.1 thorpej * of the MAC address. The HI part is the high-order 16-bits
342 1.1 thorpej * along with a few control bits.
343 1.1 thorpej */
344 1.1 thorpej #define RAL_AS(x) ((x) << 16) /* address select */
345 1.1 thorpej #define RAL_AS_DEST RAL_AS(0) /* (cordova?) */
346 1.1 thorpej #define RAL_AS_SOURCE RAL_AS(1) /* (cordova?) */
347 1.1 thorpej #define RAL_RDR1 (1U << 30) /* put packet in alt. rx ring */
348 1.1 thorpej #define RAL_AV (1U << 31) /* entry is valid */
349 1.1 thorpej
350 1.1 thorpej #define WM_RAL_TABSIZE 16
351 1.1 thorpej
352 1.1 thorpej #define WMREG_ICR 0x00c0 /* Interrupt Cause Register */
353 1.1 thorpej #define ICR_TXDW (1U << 0) /* Tx desc written back */
354 1.1 thorpej #define ICR_TXQE (1U << 1) /* Tx queue empty */
355 1.1 thorpej #define ICR_LSC (1U << 2) /* link status change */
356 1.1 thorpej #define ICR_RXSEQ (1U << 3) /* receive sequence error */
357 1.1 thorpej #define ICR_RXDMT0 (1U << 4) /* Rx ring 0 nearly empty */
358 1.1 thorpej #define ICR_RXO (1U << 6) /* Rx overrun */
359 1.1 thorpej #define ICR_RXT0 (1U << 7) /* Rx ring 0 timer */
360 1.1 thorpej #define ICR_MDAC (1U << 9) /* MDIO access complete */
361 1.1 thorpej #define ICR_RXCFG (1U << 10) /* Receiving /C/ */
362 1.1 thorpej #define ICR_GPI(x) (1U << (x)) /* general purpose interrupts */
363 1.1 thorpej
364 1.1 thorpej #define WMREG_ICS 0x00c8 /* Interrupt Cause Set Register */
365 1.1 thorpej /* See ICR bits. */
366 1.1 thorpej
367 1.1 thorpej #define WMREG_IMS 0x00d0 /* Interrupt Mask Set Register */
368 1.1 thorpej /* See ICR bits. */
369 1.1 thorpej
370 1.1 thorpej #define WMREG_IMC 0x00d8 /* Interrupt Mask Clear Register */
371 1.1 thorpej /* See ICR bits. */
372 1.1 thorpej
373 1.1 thorpej #define WMREG_RCTL 0x0100 /* Receive Control */
374 1.1 thorpej #define RCTL_EN (1U << 1) /* receiver enable */
375 1.1 thorpej #define RCTL_SBP (1U << 2) /* store bad packets */
376 1.1 thorpej #define RCTL_UPE (1U << 3) /* unicast promisc. enable */
377 1.1 thorpej #define RCTL_MPE (1U << 4) /* multicast promisc. enable */
378 1.1 thorpej #define RCTL_LPE (1U << 5) /* large packet enable */
379 1.1 thorpej #define RCTL_LBM(x) ((x) << 6) /* loopback mode */
380 1.1 thorpej #define RCTL_LBM_NONE RCTL_LBM(0)
381 1.1 thorpej #define RCTL_LBM_PHY RCTL_LBM(3)
382 1.1 thorpej #define RCTL_RDMTS(x) ((x) << 8) /* receive desc. min thresh size */
383 1.1 thorpej #define RCTL_RDMTS_1_2 RCTL_RDMTS(0)
384 1.1 thorpej #define RCTL_RDMTS_1_4 RCTL_RDMTS(1)
385 1.1 thorpej #define RCTL_RDMTS_1_8 RCTL_RDMTS(2)
386 1.1 thorpej #define RCTL_RDMTS_MASK RCTL_RDMTS(3)
387 1.1 thorpej #define RCTL_MO(x) ((x) << 12) /* multicast offset */
388 1.1 thorpej #define RCTL_BAM (1U << 15) /* broadcast accept mode */
389 1.1 thorpej #define RCTL_2k (0 << 16) /* 2k Rx buffers */
390 1.1 thorpej #define RCTL_1k (1 << 16) /* 1k Rx buffers */
391 1.1 thorpej #define RCTL_512 (2 << 16) /* 512 byte Rx buffers */
392 1.1 thorpej #define RCTL_256 (3 << 16) /* 256 byte Rx buffers */
393 1.1 thorpej #define RCTL_BSEX_16k (1 << 16) /* 16k Rx buffers (BSEX) */
394 1.1 thorpej #define RCTL_BSEX_8k (2 << 16) /* 8k Rx buffers (BSEX) */
395 1.1 thorpej #define RCTL_BSEX_4k (3 << 16) /* 4k Rx buffers (BSEX) */
396 1.1 thorpej #define RCTL_DPF (1U << 22) /* discard pause frames */
397 1.1 thorpej #define RCTL_PMCF (1U << 23) /* pass MAC control frames */
398 1.1 thorpej #define RCTL_BSEX (1U << 25) /* buffer size extension (Livengood) */
399 1.1 thorpej #define RCTL_SECRC (1U << 26) /* strip Ethernet CRC */
400 1.1 thorpej
401 1.1 thorpej #define WMREG_OLD_RDTR0 0x0108 /* Receive Delay Timer (ring 0) */
402 1.1 thorpej #define WMREG_RDTR 0x2820
403 1.1 thorpej #define RDTR_FPD (1U << 31) /* flush partial descriptor */
404 1.1 thorpej
405 1.1 thorpej #define WMREG_OLD_RDBAL0 0x0110 /* Receive Descriptor Base Low (ring 0) */
406 1.1 thorpej #define WMREG_RDBAL 0x2800
407 1.1 thorpej
408 1.1 thorpej #define WMREG_OLD_RDBAH0 0x0114 /* Receive Descriptor Base High (ring 0) */
409 1.1 thorpej #define WMREG_RDBAH 0x2804
410 1.1 thorpej
411 1.1 thorpej #define WMREG_OLD_RDLEN0 0x0118 /* Receive Descriptor Length (ring 0) */
412 1.1 thorpej #define WMREG_RDLEN 0x2808
413 1.1 thorpej
414 1.1 thorpej #define WMREG_OLD_RDH0 0x0120 /* Receive Descriptor Head (ring 0) */
415 1.1 thorpej #define WMREG_RDH 0x2810
416 1.1 thorpej
417 1.1 thorpej #define WMREG_OLD_RDT0 0x0128 /* Receive Descriptor Tail (ring 0) */
418 1.1 thorpej #define WMREG_RDT 0x2818
419 1.1 thorpej
420 1.1 thorpej #define WMREG_RXDCTL 0x2828 /* Receive Descriptor Control */
421 1.1 thorpej #define RXDCTL_PTHRESH(x) ((x) << 0) /* prefetch threshold */
422 1.1 thorpej #define RXDCTL_HTHRESH(x) ((x) << 8) /* host threshold */
423 1.1 thorpej #define RXDCTL_WTHRESH(x) ((x) << 16) /* write back threshold */
424 1.1 thorpej #define RXDCTL_GRAN (1U << 24) /* 0 = cacheline, 1 = descriptor */
425 1.1 thorpej
426 1.1 thorpej #define WMREG_OLD_RDTR1 0x0130 /* Receive Delay Timer (ring 1) */
427 1.1 thorpej
428 1.1 thorpej #define WMREG_OLD_RDBA1_LO 0x0138 /* Receive Descriptor Base Low (ring 1) */
429 1.1 thorpej
430 1.1 thorpej #define WMREG_OLD_RDBA1_HI 0x013c /* Receive Descriptor Base High (ring 1) */
431 1.1 thorpej
432 1.1 thorpej #define WMREG_OLD_RDLEN1 0x0140 /* Receive Drscriptor Length (ring 1) */
433 1.1 thorpej
434 1.1 thorpej #define WMREG_OLD_RDH1 0x0148
435 1.1 thorpej
436 1.1 thorpej #define WMREG_OLD_RDT1 0x0150
437 1.1 thorpej
438 1.1 thorpej #define WMREG_OLD_FCRTH 0x0160 /* Flow Control Rx Threshold Hi (OLD) */
439 1.1 thorpej #define WMREG_FCRTL 0x2160 /* Flow Control Rx Threshold Lo */
440 1.1 thorpej #define FCRTH_DFLT 0x00008000
441 1.1 thorpej
442 1.1 thorpej #define WMREG_OLD_FCRTL 0x0168 /* Flow Control Rx Threshold Lo (OLD) */
443 1.1 thorpej #define WMREG_FCRTH 0x2168 /* Flow Control Rx Threhsold Hi */
444 1.1 thorpej #define FCRTL_DFLT 0x00004000
445 1.1 thorpej
446 1.1 thorpej #define WMREG_FCTTV 0x0170 /* Flow Control Transmit Timer Value */
447 1.1 thorpej #define FCTTV_DFLT 0x00000100
448 1.1 thorpej
449 1.1 thorpej #define WMREG_TXCW 0x0178 /* Transmit Configuration Word (TBI mode) */
450 1.1 thorpej /* See MII ANAR_X bits. */
451 1.1 thorpej #define TXCW_TxConfig (1U << 30) /* Tx Config */
452 1.1 thorpej #define TXCW_ANE (1U << 31) /* Autonegotiate */
453 1.1 thorpej
454 1.1 thorpej #define WMREG_RXCW 0x0180 /* Receive Configuration Word (TBI mode) */
455 1.1 thorpej /* See MII ANLPAR_X bits. */
456 1.1 thorpej #define RXCW_NC (1U << 26) /* no carrier */
457 1.1 thorpej #define RXCW_IV (1U << 27) /* config invalid */
458 1.1 thorpej #define RXCW_CC (1U << 28) /* config change */
459 1.1 thorpej #define RXCW_C (1U << 29) /* /C/ reception */
460 1.1 thorpej #define RXCW_SYNCH (1U << 30) /* synchronized */
461 1.1 thorpej #define RXCW_ANC (1U << 31) /* autonegotiation complete */
462 1.1 thorpej
463 1.1 thorpej #define WMREG_MTA 0x0200 /* Multicast Table Array */
464 1.1 thorpej #define WMREG_CORDOVA_MTA 0x5200
465 1.1 thorpej
466 1.1 thorpej #define WMREG_TCTL 0x0400 /* Transmit Control Register */
467 1.1 thorpej #define TCTL_EN (1U << 1) /* transmitter enable */
468 1.1 thorpej #define TCTL_PSP (1U << 3) /* pad short packets */
469 1.1 thorpej #define TCTL_CT(x) (((x) & 0xff) << 4) /* 4:11 - collision threshold */
470 1.1 thorpej #define TCTL_COLD(x) (((x) & 0x3ff) << 12) /* 12:21 - collision distance */
471 1.1 thorpej #define TCTL_SWXOFF (1U << 22) /* software XOFF */
472 1.1 thorpej #define TCTL_RTLC (1U << 24) /* retransmit on late collision */
473 1.1 thorpej #define TCTL_NRTU (1U << 25) /* no retransmit on underrun */
474 1.1 thorpej
475 1.1 thorpej #define TX_COLLISION_THRESHOLD 15
476 1.1 thorpej #define TX_COLLISION_DISTANCE_HDX 64
477 1.1 thorpej #define TX_COLLISION_DISTANCE_FDX 512
478 1.1 thorpej
479 1.1 thorpej #define WMREG_TQSA_LO 0x0408
480 1.1 thorpej
481 1.1 thorpej #define WMREG_TQSA_HI 0x040c
482 1.1 thorpej
483 1.1 thorpej #define WMREG_TIPG 0x0410 /* Transmit IPG Register */
484 1.1 thorpej #define TIPG_IPGT(x) (x) /* IPG transmit time */
485 1.1 thorpej #define TIPG_IPGR1(x) ((x) << 10) /* IPG receive time 1 */
486 1.1 thorpej #define TIPG_IPGR2(x) ((x) << 20) /* IPG receive time 2 */
487 1.1 thorpej
488 1.1 thorpej #define TIPG_WM_DFLT (TIPG_IPGT(0x0a) | TIPG_IPGR1(0x02) | TIPG_IPGR2(0x0a))
489 1.1 thorpej #define TIPG_LG_DFLT (TIPG_IPGT(0x06) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
490 1.1 thorpej #define TIPG_1000T_DFLT (TIPG_IPGT(0x08) | TIPG_IPGR1(0x08) | TIPG_IPGR2(0x06))
491 1.1 thorpej
492 1.1 thorpej #define WMREG_TQC 0x0418
493 1.1 thorpej
494 1.1 thorpej #define WMREG_OLD_TBDAL 0x0420 /* Transmit Descriptor Base Lo */
495 1.1 thorpej #define WMREG_TBDAL 0x3800
496 1.1 thorpej
497 1.1 thorpej #define WMREG_OLD_TBDAH 0x0424 /* Transmit Descriptor Base Hi */
498 1.1 thorpej #define WMREG_TBDAH 0x3804
499 1.1 thorpej
500 1.1 thorpej #define WMREG_OLD_TDLEN 0x0428 /* Transmit Descriptor Length */
501 1.1 thorpej #define WMREG_TDLEN 0x3808
502 1.1 thorpej
503 1.1 thorpej #define WMREG_OLD_TDH 0x0430 /* Transmit Descriptor Head */
504 1.1 thorpej #define WMREG_TDH 0x3810
505 1.1 thorpej
506 1.1 thorpej #define WMREG_OLD_TDT 0x0438 /* Transmit Descriptor Tail */
507 1.1 thorpej #define WMREG_TDT 0x3818
508 1.1 thorpej
509 1.1 thorpej #define WMREG_OLD_TIDV 0x0440 /* Transmit Delay Interrupt Value */
510 1.1 thorpej #define WMREG_TIDV 0x3820
511 1.1 thorpej
512 1.1 thorpej #define WMREG_TXDCTL 0x3828 /* Trandmit Descriptor Control */
513 1.1 thorpej #define TXDCTL_PTHRESH(x) ((x) << 0) /* prefetch threshold */
514 1.1 thorpej #define TXDCTL_HTHRESH(x) ((x) << 8) /* host threshold */
515 1.1 thorpej #define TXDCTL_WTHRESH(x) ((x) << 16) /* write back threshold */
516 1.1 thorpej
517 1.1 thorpej #define WMREG_AIT 0x0458 /* Adaptive IFS Throttle */
518 1.1 thorpej
519 1.1 thorpej #define WMREG_VFTA 0x0600
520 1.1 thorpej
521 1.1 thorpej #define WM_MC_TABSIZE 128
522 1.1 thorpej #define WM_VLAN_TABSIZE 128
523 1.1 thorpej
524 1.1 thorpej #define WMREG_PBA 0x1000 /* Packet Buffer Allocation */
525 1.1 thorpej
526 1.1 thorpej #define WMREG_TXDMAC 0x3000 /* Transfer DMA Control */
527 1.1 thorpej #define TXDMAC_DPP (1U << 0) /* disable packet prefetch */
528 1.1 thorpej
529 1.1 thorpej #define WMREG_TSPMT 0x3830 /* TCP Segmentation Pad and Minimum
530 1.1 thorpej Threshold (Cordova) */
531 1.1 thorpej #define TSPMT_TSMT(x) (x) /* TCP seg min transfer */
532 1.1 thorpej #define TSPMT_TSPBP(x) ((x) << 16) /* TCP seg pkt buf padding */
533 1.1 thorpej
534 1.1 thorpej #define WMREG_RXCSUM 0x5000 /* Receive Checksum register */
535 1.1 thorpej #define RXCSUM_PCSS 0x000000ff /* Packet Checksum Start */
536 1.1 thorpej #define RXCSUM_IPOFL (1U << 8) /* IP checksum offload */
537 1.1 thorpej #define RXCSUM_TUOFL (1U << 9) /* TCP/UDP checksum offload */
538