gemreg.h revision 1.14 1 1.14 jdc /* $NetBSD: gemreg.h,v 1.14 2008/09/15 19:43:24 jdc Exp $ */
2 1.1 eeh
3 1.1 eeh /*
4 1.6 heas *
5 1.1 eeh * Copyright (C) 2001 Eduardo Horvath.
6 1.1 eeh * All rights reserved.
7 1.1 eeh *
8 1.1 eeh *
9 1.1 eeh * Redistribution and use in source and binary forms, with or without
10 1.1 eeh * modification, are permitted provided that the following conditions
11 1.1 eeh * are met:
12 1.1 eeh * 1. Redistributions of source code must retain the above copyright
13 1.1 eeh * notice, this list of conditions and the following disclaimer.
14 1.1 eeh * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 eeh * notice, this list of conditions and the following disclaimer in the
16 1.1 eeh * documentation and/or other materials provided with the distribution.
17 1.6 heas *
18 1.1 eeh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
19 1.1 eeh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 1.1 eeh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 1.1 eeh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
22 1.1 eeh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.1 eeh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 1.1 eeh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1 eeh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.1 eeh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1 eeh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1 eeh * SUCH DAMAGE.
29 1.1 eeh *
30 1.1 eeh */
31 1.1 eeh
32 1.1 eeh #ifndef _IF_GEMREG_H
33 1.1 eeh #define _IF_GEMREG_H
34 1.1 eeh
35 1.11 jdc /*
36 1.11 jdc * Register definitions for Sun GEM Gigabit Ethernet
37 1.11 jdc * See `GEM Gigabit Ethernet ASIC Specification'
38 1.11 jdc * http://www.sun.com/processors/manuals/ge.pdf
39 1.14 jdc * and `Sbus GEM Specification'
40 1.14 jdc * http://mediacast.sun.com/users/Barton808/media/gem_sbus-1.pdf
41 1.14 jdc * section 3.1.3 GEM Register Space
42 1.11 jdc */
43 1.1 eeh
44 1.9 martin /*
45 1.11 jdc * Global Resources
46 1.11 jdc * Section 3.1.4.1
47 1.11 jdc *
48 1.9 martin * First bank: this registers live at the start of the PCI
49 1.14 jdc * mapping, and at the start of the second bank of the SBus
50 1.9 martin * version.
51 1.9 martin */
52 1.11 jdc #define GEM_SEB_STATE 0x0000 /* SEB State (R/O) */
53 1.11 jdc #define GEM_CONFIG 0x0004 /* Configuration */
54 1.11 jdc #define GEM_STATUS 0x000c /* Status */
55 1.11 jdc /* Note: Reading the status register auto-clears bits 0-6 */
56 1.11 jdc #define GEM_INTMASK 0x0010 /* Interrupt Mask */
57 1.11 jdc #define GEM_INTACK 0x0014 /* Interrupt Acknowledge (W/O) */
58 1.11 jdc #define GEM_STATUS_ALIAS 0x001c /* Status Alias */
59 1.11 jdc /* This is the same as GEM_STATUS but reading it does not auto-clear bits. */
60 1.9 martin
61 1.9 martin /*
62 1.9 martin * Second bank: this registers live at offset 0x1000 of the PCI
63 1.14 jdc * mapping, and at the start of the first bank of the SBus
64 1.9 martin * version.
65 1.9 martin */
66 1.9 martin #define GEM_PCI_BANK2_OFFSET 0x1000
67 1.9 martin #define GEM_PCI_BANK2_SIZE 0x14
68 1.12 jdc #define GEM_ERROR_STATUS 0x0000 /* PCI Error Status */
69 1.11 jdc #define GEM_ERROR_MASK 0x0004 /* PCI Error Mask */
70 1.12 jdc #define GEM_BIF_CONFIG 0x0008 /* PCI BIF Configuration */
71 1.12 jdc #define GEM_BIF_DIAG 0x000c /* PCI BIF Diagnostic */
72 1.12 jdc #define GEM_RESET 0x0010 /* PCI Software Reset */
73 1.12 jdc
74 1.14 jdc #define GEM_SBUS_RESET 0x0000 /* SBus Reset */
75 1.14 jdc #define GEM_SBUS_CONFIG 0x0004 /* SBus Burst-Size Configuration */
76 1.14 jdc #define GEM_SBUS_ERROR_STATUS 0x0008 /* SBus Fatal Error */
77 1.14 jdc #define GEM_SBUS_REVISION 0x000c /* SBus Revision */
78 1.14 jdc /* SBus Software Reset at same offset (0x0010) as PCI Software Reset above */
79 1.1 eeh
80 1.11 jdc /*
81 1.11 jdc * Bits in GEM_SEB_STATE register
82 1.11 jdc * For diagnostic use
83 1.11 jdc */
84 1.1 eeh #define GEM_SEB_ARB 0x000000002 /* Arbitration status */
85 1.1 eeh #define GEM_SEB_RXWON 0x000000004
86 1.1 eeh
87 1.11 jdc /*
88 1.11 jdc * Bits in GEM_CONFIG register
89 1.11 jdc * Default: 0x00042
90 1.11 jdc */
91 1.5 wiz #define GEM_CONFIG_BURST_64 0x000000000 /* 0->infinity, 1->64KB */
92 1.5 wiz #define GEM_CONFIG_BURST_INF 0x000000001 /* 0->infinity, 1->64KB */
93 1.1 eeh #define GEM_CONFIG_TXDMA_LIMIT 0x00000003e
94 1.1 eeh #define GEM_CONFIG_RXDMA_LIMIT 0x0000007c0
95 1.11 jdc /* GEM_CONFIG_RONPAULBIT and GEM_CONFIG_BUG2FIX are Apple only. */
96 1.11 jdc #define GEM_CONFIG_RONPAULBIT 0x000000800 /* after infinite burst use
97 1.11 jdc * memory read multiple for
98 1.11 jdc * PCI commands */
99 1.11 jdc #define GEM_CONFIG_BUG2FIX 0x000001000 /* fix RX hang after overflow */
100 1.1 eeh
101 1.1 eeh #define GEM_CONFIG_TXDMA_LIMIT_SHIFT 1
102 1.1 eeh #define GEM_CONFIG_RXDMA_LIMIT_SHIFT 6
103 1.1 eeh
104 1.1 eeh
105 1.6 heas /*
106 1.6 heas * Interrupt bits, for both the GEM_STATUS and GEM_INTMASK regs.
107 1.6 heas * Bits 0-6 auto-clear when read.
108 1.6 heas */
109 1.1 eeh #define GEM_INTR_TX_INTME 0x000000001 /* Frame w/INTME bit set sent */
110 1.1 eeh #define GEM_INTR_TX_EMPTY 0x000000002 /* TX ring empty */
111 1.1 eeh #define GEM_INTR_TX_DONE 0x000000004 /* TX complete */
112 1.1 eeh #define GEM_INTR_RX_DONE 0x000000010 /* Got a packet */
113 1.11 jdc #define GEM_INTR_RX_NOBUF 0x000000020 /* No free receive buffers */
114 1.11 jdc #define GEM_INTR_RX_TAG_ERR 0x000000040 /* RX Tag framing error */
115 1.11 jdc #define GEM_INTR_PERR 0x000000080 /* Parity error */
116 1.11 jdc #define GEM_INTR_PCS 0x000002000 /* PCS interrupt */
117 1.11 jdc #define GEM_INTR_TX_MAC 0x000004000 /* TX MAC interrupt */
118 1.11 jdc #define GEM_INTR_RX_MAC 0x000008000 /* RX MAC interrupt */
119 1.1 eeh #define GEM_INTR_MAC_CONTROL 0x000010000 /* MAC control interrupt */
120 1.11 jdc #define GEM_INTR_MIF 0x000020000 /* MIF interrupt */
121 1.1 eeh #define GEM_INTR_BERR 0x000040000 /* Bus error interrupt */
122 1.1 eeh #define GEM_INTR_BITS "\177\020" \
123 1.1 eeh "b\0INTME\0b\1TXEMPTY\0b\2TXDONE\0" \
124 1.1 eeh "b\4RXDONE\0b\5RXNOBUF\0b\6RX_TAG_ERR\0" \
125 1.7 heas "b\xdPCS\0b\xeTXMAC\0b\xfRXMAC\0" \
126 1.7 heas "b\x10MAC_CONTROL\0b\x11MIF\0b\x12IBERR\0\0"
127 1.1 eeh
128 1.11 jdc /* Top part (bits 19-31) of GEM_STATUS has TX completion information */
129 1.11 jdc #define GEM_STATUS_TX_COMPL 0xfff800000 /* TX completion reg. */
130 1.1 eeh
131 1.1 eeh
132 1.11 jdc /*
133 1.11 jdc * Bits in GEM_ERROR_STATUS and GEM_ERROR_MASK PCI registers
134 1.11 jdc */
135 1.1 eeh #define GEM_ERROR_STAT_BADACK 0x000000001 /* No ACK64# */
136 1.1 eeh #define GEM_ERROR_STAT_DTRTO 0x000000002 /* Delayed xaction timeout */
137 1.11 jdc #define GEM_ERROR_STAT_OTHERS 0x000000004 /* Other PCI errors. Read PCI
138 1.11 jdc Status Register in PCI
139 1.11 jdc Configuration space */
140 1.7 heas #define GEM_ERROR_BITS "\177\020b\0ACKBAD\0b\1DTRTO\0b\2OTHER\0\0"
141 1.1 eeh
142 1.1 eeh
143 1.11 jdc /*
144 1.11 jdc * Bits in GEM_SBUS_CONFIG register
145 1.11 jdc */
146 1.12 jdc #define GEM_SBUS_CFG_BSIZE32 0x00000001
147 1.12 jdc #define GEM_SBUS_CFG_BSIZE64 0x00000002
148 1.12 jdc #define GEM_SBUS_CFG_BSIZE128 0x00000004
149 1.11 jdc #define GEM_SBUS_CFG_BMODE64 0x00000008
150 1.11 jdc #define GEM_SBUS_CFG_PARITY 0x00000200
151 1.11 jdc
152 1.11 jdc
153 1.11 jdc /*
154 1.11 jdc * Bits in GEM_BIF_CONFIG register
155 1.11 jdc * Default: 0x0
156 1.11 jdc */
157 1.1 eeh #define GEM_BIF_CONFIG_SLOWCLK 0x000000001 /* Parity error timing */
158 1.1 eeh #define GEM_BIF_CONFIG_HOST_64 0x000000002 /* 64-bit host */
159 1.1 eeh #define GEM_BIF_CONFIG_B64D_DIS 0x000000004 /* no 64-bit data cycle */
160 1.1 eeh #define GEM_BIF_CONFIG_M66EN 0x000000008
161 1.7 heas #define GEM_BIF_CONFIG_BITS "\177\020b\0SLOWCLK\0b\1HOST64\0" \
162 1.7 heas "b\2B64DIS\0b\3M66EN\0\0"
163 1.1 eeh
164 1.1 eeh
165 1.11 jdc /*
166 1.11 jdc * Bits in GEM_BIF_DIAG register
167 1.11 jdc * Default: 0x00000000
168 1.11 jdc */
169 1.11 jdc #define GEN_BIF_DIAG_PCIBURST 0x007f0000 /* PCI Burst Controller state
170 1.11 jdc * machine */
171 1.11 jdc #define GEN_BIF_DIAG_STATE 0xff000000 /* BIF state machine */
172 1.11 jdc
173 1.11 jdc /*
174 1.11 jdc * Bits in GEM_RESET register
175 1.11 jdc * RESET_TX and RESET_RX self clear when complete.
176 1.11 jdc */
177 1.1 eeh #define GEM_RESET_TX 0x000000001 /* Reset TX half */
178 1.1 eeh #define GEM_RESET_RX 0x000000002 /* Reset RX half */
179 1.11 jdc #define GEM_RESET_GLOBAL 0x000000003 /* Global Reset */
180 1.1 eeh #define GEM_RESET_RSTOUT 0x000000004 /* Force PCI RSTOUT# */
181 1.1 eeh
182 1.1 eeh
183 1.11 jdc /*
184 1.11 jdc * TX DMA Programmable Resources
185 1.11 jdc * Section 3.1.4.2
186 1.11 jdc * The 53 most significant bits of the Descriptor Base Low/High registers
187 1.11 jdc * are used as the TX descriptor ring base address. The ring base must be
188 1.11 jdc * initialized to a 2KByte-aligned address after power-on or software reset.
189 1.11 jdc */
190 1.11 jdc #define GEM_TX_KICK 0x2000 /* TX Kick */
191 1.11 jdc /* Note: Write last valid desc + 1 */
192 1.11 jdc #define GEM_TX_CONFIG 0x2004 /* TX Configuration */
193 1.11 jdc #define GEM_TX_RING_PTR_LO 0x2008 /* TX Descriptor Base Low */
194 1.11 jdc #define GEM_TX_RING_PTR_HI 0x200c /* TX Descriptor Base High */
195 1.11 jdc /* 0x2010 Reserved */
196 1.11 jdc #define GEM_TX_FIFO_WR_PTR 0x2014 /* TX FIFO Write Pointer */
197 1.11 jdc #define GEM_TX_FIFO_SDWR_PTR 0x2018 /* TX FIFO Shadow Write Ptr */
198 1.11 jdc #define GEM_TX_FIFO_RD_PTR 0x201c /* TX FIFO Read Pointer */
199 1.11 jdc #define GEM_TX_FIFO_SDRD_PTR 0x2020 /* TX FIFO Shadow Read Ptr */
200 1.11 jdc #define GEM_TX_FIFO_PKT_CNT 0x2024 /* TX FIFO Packet Counter */
201 1.11 jdc #define GEM_TX_STATE_MACHINE 0x2028 /* TX State Machine */
202 1.11 jdc /* 0x202c Unknown */
203 1.11 jdc #define GEM_TX_DATA_PTR_LO 0x2030 /* TX Data Pointer Low */
204 1.11 jdc #define GEM_TX_DATA_PTR_HI 0x2034 /* TX Data Pointer High */
205 1.11 jdc
206 1.11 jdc #define GEM_TX_COMPLETION 0x2100 /* TX Completion */
207 1.11 jdc #define GEM_TX_FIFO_ADDRESS 0x2104 /* TX FIFO Address */
208 1.11 jdc #define GEM_TX_FIFO_TAG 0x2108 /* TX FIFO Tag */
209 1.11 jdc #define GEM_TX_FIFO_DATA_LO 0x210c /* TX FIFO Data Low */
210 1.11 jdc #define GEM_TX_FIFO_DATA_HI_T1 0x2110 /* TX FIFO Data HighT1 */
211 1.11 jdc #define GEM_TX_FIFO_DATA_HI_T0 0x2114 /* TX FIFO Data HighT0 */
212 1.11 jdc #define GEM_TX_FIFO_SIZE 0x2118 /* TX FIFO Size */
213 1.1 eeh #define GEM_TX_DEBUG 0x3028
214 1.1 eeh
215 1.1 eeh
216 1.11 jdc /*
217 1.11 jdc * Bits in GEM_TX_CONFIG register
218 1.11 jdc * Default: 0x118c10
219 1.11 jdc * TX FIFO Threshold should be set to 0x4ff
220 1.11 jdc */
221 1.1 eeh #define GEM_TX_CONFIG_TXDMA_EN 0x00000001 /* TX DMA enable */
222 1.1 eeh #define GEM_TX_CONFIG_TXRING_SZ 0x0000001e /* TX ring size */
223 1.11 jdc #define GEM_TX_CONFIG_TXFIFO_SL 0x00000020 /* TX DMA FIFO PIO select */
224 1.1 eeh #define GEM_TX_CONFIG_TXFIFO_TH 0x001ffc00 /* TX fifo threshold */
225 1.1 eeh #define GEM_TX_CONFIG_PACED 0x00200000 /* TX_all_int modifier */
226 1.1 eeh
227 1.1 eeh #define GEM_RING_SZ_32 (0<<1) /* 32 descriptors */
228 1.1 eeh #define GEM_RING_SZ_64 (1<<1)
229 1.1 eeh #define GEM_RING_SZ_128 (2<<1)
230 1.1 eeh #define GEM_RING_SZ_256 (3<<1)
231 1.1 eeh #define GEM_RING_SZ_512 (4<<1)
232 1.1 eeh #define GEM_RING_SZ_1024 (5<<1)
233 1.1 eeh #define GEM_RING_SZ_2048 (6<<1)
234 1.1 eeh #define GEM_RING_SZ_4096 (7<<1)
235 1.11 jdc #define GEM_RING_SZ_8192 (8<<1) /* Default */
236 1.1 eeh
237 1.1 eeh
238 1.11 jdc /*
239 1.11 jdc * Bits in GEM_TX_COMPLETION register
240 1.11 jdc */
241 1.1 eeh #define GEM_TX_COMPLETION_MASK 0x00001fff /* # of last descriptor */
242 1.1 eeh
243 1.1 eeh
244 1.11 jdc /*
245 1.11 jdc * RX DMA Programmable Resources
246 1.11 jdc * Section 3.1.4.3
247 1.11 jdc * The 53 most significant bits of the Descriptor Base Low/High registers
248 1.11 jdc * are used as the RX descriptor ring base address. The ring base must be
249 1.11 jdc * initialized to a 2KByte-aligned address after power-on or software reset.
250 1.11 jdc */
251 1.11 jdc #define GEM_RX_CONFIG 0x4000 /* RX Configuration */
252 1.11 jdc #define GEM_RX_RING_PTR_LO 0x4004 /* RX Descriptor Base Low */
253 1.11 jdc #define GEM_RX_RING_PTR_HI 0x4008 /* RX Descriptor Base High */
254 1.11 jdc #define GEM_RX_FIFO_WR_PTR 0x400c /* RX FIFO Write Pointer */
255 1.11 jdc #define GEM_RX_FIFO_SDWR_PTR 0x4010 /* RX FIFO Shadow Write Ptr */
256 1.11 jdc #define GEM_RX_FIFO_RD_PTR 0x4014 /* RX FIFO Read Pointer */
257 1.11 jdc #define GEM_RX_FIFO_PKT_CNT 0x4018 /* RX FIFO Packet Counter */
258 1.11 jdc #define GEM_RX_STATE_MACHINE 0x401c /* RX State Machine */
259 1.11 jdc #define GEM_RX_PAUSE_THRESH 0x4020 /* Pause Thresholds */
260 1.11 jdc #define GEM_RX_DATA_PTR_LO 0x4024 /* RX Data Pointer Low */
261 1.11 jdc #define GEM_RX_DATA_PTR_HI 0x4028 /* RX Data Pointer High */
262 1.11 jdc
263 1.11 jdc #define GEM_RX_KICK 0x4100 /* RX Kick */
264 1.11 jdc /* Note: Write last valid desc + 1. Must be a multiple of 4 */
265 1.11 jdc #define GEM_RX_COMPLETION 0x4104 /* RX Completion */
266 1.11 jdc #define GEM_RX_BLANKING 0x4108 /* RX Blanking */
267 1.11 jdc #define GEM_RX_FIFO_ADDRESS 0x410c /* RX FIFO Address */
268 1.11 jdc #define GEM_RX_FIFO_TAG 0x4110 /* RX FIFO Tag */
269 1.11 jdc #define GEM_RX_FIFO_DATA_LO 0x4114 /* RX FIFO Data Low */
270 1.11 jdc #define GEM_RX_FIFO_DATA_HI_T1 0x4118 /* RX FIFO Data HighT0 */
271 1.11 jdc #define GEM_RX_FIFO_DATA_HI_T0 0x411c /* RX FIFO Data HighT1 */
272 1.11 jdc #define GEM_RX_FIFO_SIZE 0x4120 /* RX FIFO Size */
273 1.1 eeh
274 1.1 eeh
275 1.11 jdc /*
276 1.11 jdc * Bits in GEM_RX_CONFIG register
277 1.11 jdc * Default: 0x1000010
278 1.11 jdc */
279 1.1 eeh #define GEM_RX_CONFIG_RXDMA_EN 0x00000001 /* RX DMA enable */
280 1.1 eeh #define GEM_RX_CONFIG_RXRING_SZ 0x0000001e /* RX ring size */
281 1.1 eeh #define GEM_RX_CONFIG_BATCH_DIS 0x00000020 /* desc batching disable */
282 1.1 eeh #define GEM_RX_CONFIG_FBOFF 0x00001c00 /* first byte offset */
283 1.7 heas #define GEM_RX_CONFIG_CXM_START 0x000fe000 /* cksum start offset bytes */
284 1.1 eeh #define GEM_RX_CONFIG_FIFO_THRS 0x07000000 /* fifo threshold size */
285 1.1 eeh
286 1.1 eeh #define GEM_THRSH_64 0
287 1.1 eeh #define GEM_THRSH_128 1
288 1.1 eeh #define GEM_THRSH_256 2
289 1.1 eeh #define GEM_THRSH_512 3
290 1.1 eeh #define GEM_THRSH_1024 4
291 1.1 eeh #define GEM_THRSH_2048 5
292 1.1 eeh
293 1.1 eeh #define GEM_RX_CONFIG_FIFO_THRS_SHIFT 24
294 1.1 eeh #define GEM_RX_CONFIG_FBOFF_SHFT 10
295 1.1 eeh #define GEM_RX_CONFIG_CXM_START_SHFT 13
296 1.1 eeh
297 1.1 eeh
298 1.1 eeh /* GEM_RX_PAUSE_THRESH register bits -- sizes in multiples of 64 bytes */
299 1.1 eeh #define GEM_RX_PTH_XOFF_THRESH 0x000001ff
300 1.4 matt #define GEM_RX_PTH_XON_THRESH 0x001ff000
301 1.1 eeh
302 1.1 eeh
303 1.1 eeh /* GEM_RX_BLANKING register bits */
304 1.1 eeh #define GEM_RX_BLANKING_PACKETS 0x000001ff /* Delay intr for x packets */
305 1.4 matt #define GEM_RX_BLANKING_TIME 0x000ff000 /* Delay intr for x ticks */
306 1.4 matt #define GEM_RX_BLANKING_TIME_SHIFT 12
307 1.4 matt /* One tick is 2048 PCI clocks, or 16us at 66MHz */
308 1.1 eeh
309 1.1 eeh
310 1.11 jdc /*
311 1.11 jdc * MAC Programmable Resources
312 1.11 jdc * Section 3.1.5
313 1.11 jdc */
314 1.11 jdc #define GEM_MAC_TXRESET 0x6000 /* TX MAC Software Reset Cmd */
315 1.11 jdc #define GEM_MAC_RXRESET 0x6004 /* RX MAC Software Reset Cmd */
316 1.11 jdc /* Note: Store 1, cleared when done for TXRESET and RXRESET */
317 1.11 jdc #define GEM_MAC_SEND_PAUSE_CMD 0x6008 /* Send Pause Command */
318 1.11 jdc #define GEM_MAC_TX_STATUS 0x6010 /* TX MAC Status */
319 1.11 jdc #define GEM_MAC_RX_STATUS 0x6014 /* RX MAC Status */
320 1.11 jdc #define GEM_MAC_CONTROL_STATUS 0x6018 /* MAC Control Status */
321 1.11 jdc #define GEM_MAC_TX_MASK 0x6020 /* TX MAC Mask */
322 1.11 jdc #define GEM_MAC_RX_MASK 0x6024 /* RX MAC Mask */
323 1.11 jdc #define GEM_MAC_CONTROL_MASK 0x6028 /* MAC Control Mask */
324 1.11 jdc #define GEM_MAC_TX_CONFIG 0x6030 /* TX MAC Configuration */
325 1.11 jdc #define GEM_MAC_RX_CONFIG 0x6034 /* XX MAC Configuration */
326 1.11 jdc #define GEM_MAC_CONTROL_CONFIG 0x6038 /* MAC Control Configuration */
327 1.11 jdc #define GEM_MAC_XIF_CONFIG 0x603c /* XIF Configuration */
328 1.11 jdc #define GEM_MAC_IPG0 0x6040 /* InterPacketGap0 */
329 1.11 jdc #define GEM_MAC_IPG1 0x6044 /* InterPacketGap1 */
330 1.11 jdc #define GEM_MAC_IPG2 0x6048 /* InterPacketGap2 */
331 1.11 jdc #define GEM_MAC_SLOT_TIME 0x604c /* SlotTime, bits 0-7 */
332 1.11 jdc #define GEM_MAC_MAC_MIN_FRAME 0x6050 /* MinFrameSize */
333 1.11 jdc #define GEM_MAC_MAC_MAX_FRAME 0x6054 /* MaxFrameSize */
334 1.11 jdc #define GEM_MAC_PREAMBLE_LEN 0x6058 /* PA Size */
335 1.11 jdc #define GEM_MAC_JAM_SIZE 0x605c /* JamSize */
336 1.11 jdc #define GEM_MAC_ATTEMPT_LIMIT 0x6060 /* Attempt Limit */
337 1.11 jdc #define GEM_MAC_CONTROL_TYPE 0x6064 /* MAC Control Type */
338 1.1 eeh
339 1.1 eeh #define GEM_MAC_ADDR0 0x6080 /* Normal MAC address 0 */
340 1.1 eeh #define GEM_MAC_ADDR1 0x6084
341 1.1 eeh #define GEM_MAC_ADDR2 0x6088
342 1.1 eeh #define GEM_MAC_ADDR3 0x608c /* Alternate MAC address 0 */
343 1.1 eeh #define GEM_MAC_ADDR4 0x6090
344 1.1 eeh #define GEM_MAC_ADDR5 0x6094
345 1.1 eeh #define GEM_MAC_ADDR6 0x6098 /* Control MAC address 0 */
346 1.1 eeh #define GEM_MAC_ADDR7 0x609c
347 1.1 eeh #define GEM_MAC_ADDR8 0x60a0
348 1.1 eeh
349 1.11 jdc #define GEM_MAC_ADDR_FILTER0 0x60a4 /* Address Filter */
350 1.1 eeh #define GEM_MAC_ADDR_FILTER1 0x60a8
351 1.1 eeh #define GEM_MAC_ADDR_FILTER2 0x60ac
352 1.11 jdc #define GEM_MAC_ADR_FLT_MASK1_2 0x60b0 /* Address Filter Mask 2&1 */
353 1.11 jdc #define GEM_MAC_ADR_FLT_MASK0 0x60b4 /* Address Filter Mask 0 */
354 1.1 eeh
355 1.1 eeh #define GEM_MAC_HASH0 0x60c0 /* Hash table 0 */
356 1.1 eeh #define GEM_MAC_HASH1 0x60c4
357 1.1 eeh #define GEM_MAC_HASH2 0x60c8
358 1.1 eeh #define GEM_MAC_HASH3 0x60cc
359 1.1 eeh #define GEM_MAC_HASH4 0x60d0
360 1.1 eeh #define GEM_MAC_HASH5 0x60d4
361 1.1 eeh #define GEM_MAC_HASH6 0x60d8
362 1.1 eeh #define GEM_MAC_HASH7 0x60dc
363 1.1 eeh #define GEM_MAC_HASH8 0x60e0
364 1.1 eeh #define GEM_MAC_HASH9 0x60e4
365 1.1 eeh #define GEM_MAC_HASH10 0x60e8
366 1.1 eeh #define GEM_MAC_HASH11 0x60ec
367 1.1 eeh #define GEM_MAC_HASH12 0x60f0
368 1.1 eeh #define GEM_MAC_HASH13 0x60f4
369 1.1 eeh #define GEM_MAC_HASH14 0x60f8
370 1.1 eeh #define GEM_MAC_HASH15 0x60fc
371 1.1 eeh
372 1.11 jdc #define GEM_MAC_NORM_COLL_CNT 0x6100 /* Normal Collision Counter */
373 1.11 jdc #define GEM_MAC_FIRST_COLL_CNT 0x6104 /* First Attempt Successful
374 1.11 jdc Collision Counter */
375 1.11 jdc #define GEM_MAC_EXCESS_COLL_CNT 0x6108 /* Excess Collision Counter */
376 1.11 jdc #define GEM_MAC_LATE_COLL_CNT 0x610c /* Late Collision Counter */
377 1.11 jdc #define GEM_MAC_DEFER_TMR_CNT 0x6110 /* Defer Timer */
378 1.11 jdc #define GEM_MAC_PEAK_ATTEMPTS 0x6114 /* Peak Attempts */
379 1.11 jdc #define GEM_MAC_RX_FRAME_COUNT 0x6118 /* Receive Frame Counter */
380 1.11 jdc #define GEM_MAC_RX_LEN_ERR_CNT 0x611c /* Length Error Counter */
381 1.11 jdc #define GEM_MAC_RX_ALIGN_ERR 0x6120 /* Alignment Error Counter */
382 1.11 jdc #define GEM_MAC_RX_CRC_ERR_CNT 0x6124 /* FCS Error Counter */
383 1.11 jdc #define GEM_MAC_RX_CODE_VIOL 0x6128 /* RX Code Violation Error
384 1.11 jdc Counter */
385 1.1 eeh
386 1.11 jdc #define GEM_MAC_RANDOM_SEED 0x6130 /* Random Number Seed */
387 1.11 jdc #define GEM_MAC_MAC_STATE 0x6134 /* State Machine */
388 1.1 eeh
389 1.11 jdc
390 1.11 jdc /*
391 1.11 jdc * Bits in GEM_MAC_SEND_PAUSE_CMD register
392 1.11 jdc * Pause time is in units of Slot Times.
393 1.11 jdc */
394 1.1 eeh #define GEM_MAC_PAUSE_CMD_TIME 0x0000ffff
395 1.1 eeh #define GEM_MAC_PAUSE_CMD_SEND 0x00010000
396 1.1 eeh
397 1.1 eeh
398 1.11 jdc /*
399 1.11 jdc * Bits in GEM_MAC_TX_STATUS and _MASK register
400 1.11 jdc * Interrupt bits are auto-cleared when the status register is read and
401 1.11 jdc * the corresponding bit is set in the mask register.
402 1.11 jdc */
403 1.11 jdc #define GEM_MAC_TX_XMIT_DONE 0x00000001 /* Successful transmission */
404 1.11 jdc #define GEM_MAC_TX_UNDERRUN 0x00000002 /* TX "data starvation" */
405 1.11 jdc #define GEM_MAC_TX_PKT_TOO_LONG 0x00000004 /* Frame exceeds max. length */
406 1.11 jdc #define GEM_MAC_TX_NCC_EXP 0x00000008 /* Normal collision counter has
407 1.11 jdc rolled over */
408 1.11 jdc #define GEM_MAC_TX_ECC_EXP 0x00000010 /* Excessive coll cnt rolled */
409 1.11 jdc #define GEM_MAC_TX_LCC_EXP 0x00000020 /* Late coll cnt rolled */
410 1.11 jdc #define GEM_MAC_TX_FCC_EXP 0x00000040 /* First coll cnt rolled */
411 1.11 jdc #define GEM_MAC_TX_DEFER_EXP 0x00000080 /* Defer timer cnt rolled */
412 1.11 jdc #define GEM_MAC_TX_PEAK_EXP 0x00000100 /* Peak attempts cnt rolled */
413 1.11 jdc
414 1.11 jdc
415 1.11 jdc /*
416 1.11 jdc * Bits in GEM_MAC_RX_STATUS and _MASK register
417 1.11 jdc */
418 1.11 jdc #define GEM_MAC_RX_DONE 0x00000001 /* Successful reception */
419 1.11 jdc #define GEM_MAC_RX_OVERFLOW 0x00000002 /* RX resource lack */
420 1.11 jdc #define GEM_MAC_RX_FRAME_CNT 0x00000004 /* Receive frame counter has
421 1.11 jdc rolled over */
422 1.11 jdc #define GEM_MAC_RX_ALIGN_EXP 0x00000008 /* Alignment error cnt rolled */
423 1.11 jdc #define GEM_MAC_RX_CRC_EXP 0x00000010 /* CRC error cnt rolled */
424 1.11 jdc #define GEM_MAC_RX_LEN_EXP 0x00000020 /* Length error cnt rolled */
425 1.11 jdc #define GEM_MAC_RX_CVI_EXP 0x00000040 /* Code violation err rolled */
426 1.1 eeh
427 1.1 eeh
428 1.11 jdc /*
429 1.11 jdc * Bits in GEM_MAC_CONTROL_STATUS and GEM_MAC_CONTROL_MASK register
430 1.11 jdc */
431 1.1 eeh #define GEM_MAC_PAUSED 0x00000001 /* Pause received */
432 1.1 eeh #define GEM_MAC_PAUSE 0x00000002 /* enter pause state */
433 1.1 eeh #define GEM_MAC_RESUME 0x00000004 /* exit pause state */
434 1.11 jdc #define GEM_MAC_PAUSE_TIME 0xffff0000 /* Pause time received */
435 1.7 heas #define GEM_MAC_STATUS_BITS "\177\020b\0PAUSED\0b\1PAUSE\0b\2RESUME\0\0"
436 1.1 eeh
437 1.11 jdc
438 1.11 jdc /*
439 1.11 jdc * Bits in GEM_MAC_XIF_CONFIG register
440 1.11 jdc * Default: 0x00
441 1.11 jdc */
442 1.11 jdc #define GEM_MAC_XIF_TX_MII_ENA 0x00000001 /* Enable MII output */
443 1.11 jdc #define GEM_MAC_XIF_MII_LOOPBK 0x00000002 /* Enable (G)MII loopback */
444 1.1 eeh #define GEM_MAC_XIF_ECHO_DISABL 0x00000004 /* Disable echo */
445 1.3 matt #define GEM_MAC_XIF_GMII_MODE 0x00000008 /* Select GMII/MII mode */
446 1.1 eeh #define GEM_MAC_XIF_MII_BUF_ENA 0x00000010 /* Enable MII recv buffers */
447 1.1 eeh #define GEM_MAC_XIF_LINK_LED 0x00000020 /* force link LED active */
448 1.1 eeh #define GEM_MAC_XIF_FDPLX_LED 0x00000040 /* force FDPLX LED active */
449 1.7 heas #define GEM_MAC_XIF_BITS "\177\020b\0TXMIIENA\0b\1MIILOOP\0b\2NOECHO" \
450 1.7 heas "\0b\3GMII\0b\4MIIBUFENA\0b\5LINKLED\0" \
451 1.7 heas "b\6FDLED\0\0"
452 1.7 heas
453 1.1 eeh
454 1.11 jdc /*
455 1.11 jdc * Bits in GEM_MAC_TX_CONFIG register
456 1.11 jdc * GEM_MAC_TX_ENABLE must be cleared and a delay imposed before writing to
457 1.11 jdc * other bits in this register or any of the MAC parameters registers.
458 1.11 jdc * The GEM_MAC_TX_ENABLE bit will read 0 when the transmitter has stopped.
459 1.11 jdc * Carrier Extension must be set when operating in Half-Duplex at 1Gbps,
460 1.11 jdc * and disabled otherwise. To enable this GEM_MAC_TX_CARR_EXTEND and
461 1.11 jdc * GEM_MAC_RX_CARR_EXTEND must be set to 1 and the Slot Time register must
462 1.11 jdc * be set to 0x200.
463 1.11 jdc */
464 1.1 eeh #define GEM_MAC_TX_ENABLE 0x00000001 /* TX enable */
465 1.1 eeh #define GEM_MAC_TX_IGN_CARRIER 0x00000002 /* Ignore carrier sense */
466 1.5 wiz #define GEM_MAC_TX_IGN_COLLIS 0x00000004 /* ignore collisions */
467 1.1 eeh #define GEM_MAC_TX_ENA_IPG0 0x00000008 /* extend Rx-to-TX IPG */
468 1.1 eeh #define GEM_MAC_TX_NGU 0x00000010 /* Never give up */
469 1.1 eeh #define GEM_MAC_TX_NGU_LIMIT 0x00000020 /* Never give up limit */
470 1.11 jdc #define GEM_MAC_TX_NO_BACKOFF 0x00000040 /* Never backoff on coll */
471 1.11 jdc #define GEM_MAC_TX_SLOWDOWN 0x00000080 /* Watch carrier sense */
472 1.1 eeh #define GEM_MAC_TX_NO_FCS 0x00000100 /* no FCS will be generated */
473 1.1 eeh #define GEM_MAC_TX_CARR_EXTEND 0x00000200 /* Ena TX Carrier Extension */
474 1.7 heas #define GEM_MAC_TX_CONFIG_BITS "\177\020" \
475 1.7 heas "b\0TXENA\0b\1IGNCAR\0b\2IGNCOLLIS\0" \
476 1.7 heas "b\3IPG0ENA\0b\4TXNGU\0b\5TXNGULIM\0" \
477 1.7 heas "b\6NOBKOFF\0b\7SLOWDN\0b\x8NOFCS\0" \
478 1.7 heas "b\x9TXCARREXT\0\0"
479 1.1 eeh
480 1.1 eeh
481 1.11 jdc /*
482 1.11 jdc * Bits in GEM_MAC_RX_CONFIG register
483 1.11 jdc * The GEM_MAC_RX_ENABLE bit must be cleared and a delay of 3.2ms imposed
484 1.11 jdc * before writing to other bits in this register or any of the MAC
485 1.11 jdc * parameters registers. The GEM_MAC_RX_ENABLE bit will read 0 when the
486 1.11 jdc * receiver has stopped.
487 1.11 jdc * The GEM_MAC_RX_HASH_FILTER bit must be cleared and a delay of 3.2ms
488 1.11 jdc * imposed before writing to any of the Hash Table registers. The
489 1.11 jdc * GEM_MAC_RX_HASH_FILTER bit will read 0 when the registers may be written.
490 1.11 jdc * The GEM_MAC_RX_ADDR_FILTER bit must be cleared and a delay of 3.2ms
491 1.11 jdc * imposed before writing to any of the Address Filter registers. The
492 1.11 jdc * GEM_MAC_RX_ADDR_FILTER bit will read 0 when the registers may be written.
493 1.11 jdc * See "Carrier Extension" above.
494 1.11 jdc */
495 1.1 eeh #define GEM_MAC_RX_ENABLE 0x00000001 /* RX enable */
496 1.1 eeh #define GEM_MAC_RX_STRIP_PAD 0x00000002 /* strip pad bytes */
497 1.1 eeh #define GEM_MAC_RX_STRIP_CRC 0x00000004
498 1.1 eeh #define GEM_MAC_RX_PROMISCUOUS 0x00000008 /* promiscuous mode */
499 1.1 eeh #define GEM_MAC_RX_PROMISC_GRP 0x00000010 /* promiscuous group mode */
500 1.1 eeh #define GEM_MAC_RX_HASH_FILTER 0x00000020 /* enable hash filter */
501 1.1 eeh #define GEM_MAC_RX_ADDR_FILTER 0x00000040 /* enable address filter */
502 1.11 jdc #define GEM_MAC_RX_ERRCHK_DIS 0x00000080 /* disable error discard */
503 1.1 eeh #define GEM_MAC_RX_CARR_EXTEND 0x00000100 /* Ena RX Carrier Extension */
504 1.7 heas #define GEM_MAC_RX_CONFIG_BITS "\177\020" \
505 1.7 heas "b\0RXENA\0b\1STRPAD\0b\2STRCRC\0" \
506 1.7 heas "b\3PROMIS\0b\4PROMISCGRP\0b\5HASHFLTR\0" \
507 1.7 heas "b\6ADDRFLTR\0b\7ERRCHKDIS\0b\x9TXCARREXT\0\0"
508 1.1 eeh
509 1.1 eeh
510 1.11 jdc /*
511 1.11 jdc * Bits in GEM_MAC_CONTROL_CONFIG
512 1.11 jdc * Default; 0x0
513 1.11 jdc */
514 1.1 eeh #define GEM_MAC_CC_TX_PAUSE 0x00000001 /* send pause enabled */
515 1.1 eeh #define GEM_MAC_CC_RX_PAUSE 0x00000002 /* receive pause enabled */
516 1.1 eeh #define GEM_MAC_CC_PASS_PAUSE 0x00000004 /* pass pause up */
517 1.7 heas #define GEM_MAC_CC_BITS "\177\020b\0TXPAUSE\0b\1RXPAUSE\0b\2NOPAUSE\0\0"
518 1.1 eeh
519 1.1 eeh
520 1.11 jdc /*
521 1.11 jdc * Bits in GEM_MAC_SLOT_TIME register
522 1.11 jdc * The slot time is used as PAUSE time unit, value depends on whether carrier
523 1.11 jdc * extension is enabled.
524 1.11 jdc */
525 1.11 jdc #define GEM_MAC_SLOT_TIME_CARR_EXTEND 0x200
526 1.11 jdc #define GEM_MAC_SLOT_TIME_NORMAL 0x40
527 1.11 jdc
528 1.11 jdc
529 1.11 jdc /*
530 1.11 jdc * Recommended values for MAC registers:
531 1.11 jdc * GEM_MAC_IPG0 0x00
532 1.11 jdc * GEM_MAC_IPG1 0x08
533 1.11 jdc * GEM_MAC_IPG2 0x04
534 1.11 jdc * GEM_MAC_SLOT_TIME 0x40 (see "Carrier Extension" above)
535 1.11 jdc * Bits in GEM_MAC_MAC_MAX_FRAME register
536 1.11 jdc * max burst size 0x7fff0000
537 1.11 jdc * max frame size 0x00007fff
538 1.11 jdc * GEM_MAC_MAC_MIN_FRAME 0x40
539 1.11 jdc * GEM_MAC_MAC_MAX_FRAME 0x200005ee
540 1.11 jdc * GEM_MAC_PREAMBLE_LEN 0x07 (minimum of 0x02)
541 1.11 jdc * GEM_MAC_JAM_SIZE 0x04
542 1.11 jdc * GEM_MAC_ATTEMPT_LIMIT 0x10
543 1.11 jdc * GEM_MAC_CONTROL_TYPE 0x8808
544 1.11 jdc */
545 1.1 eeh
546 1.1 eeh
547 1.11 jdc /*
548 1.11 jdc * Address detection and filtering registers (16-bit unless noted):
549 1.11 jdc * GEM_MAC_ADDR0 normal priority MAC address bits 32-47
550 1.11 jdc * GEM_MAC_ADDR1 normal priority MAC address bits 16-31
551 1.11 jdc * GEM_MAC_ADDR2 normal priority MAC address bits 0-15
552 1.11 jdc * GEM_MAC_ADDR3 alternate MAC address bits 32-47
553 1.11 jdc * GEM_MAC_ADDR4 alternate MAC address bits 16-31
554 1.11 jdc * GEM_MAC_ADDR5 alternate MAC address bits 0-15
555 1.11 jdc * GEM_MAC_ADDR6 MAC control address bits 32-47
556 1.11 jdc * GEM_MAC_ADDR7 MAC control address bits 16-31
557 1.11 jdc * GEM_MAC_ADDR8 MAC control address bits 0-15
558 1.11 jdc * GEM_MAC_ADDR_FILTER0 address filter bits 32-47
559 1.11 jdc * GEM_MAC_ADDR_FILTER1 address filter bits 16-31
560 1.11 jdc * GEM_MAC_ADDR_FILTER2 address filter bits 0-15
561 1.11 jdc * GEM_MAC_ADR_FLT_MASK1_2 mask for GEM_MAC_ADDR_FILTER1 and 2 (8-bit)
562 1.11 jdc * GEM_MAC_ADR_FLT_MASK0 mask for GEM_MAC_ADDR_FILTER0
563 1.11 jdc * GEM_MAC_HASH0 hash table bits 240-255
564 1.11 jdc * GEM_MAC_HASH1 hash table bits 224-239
565 1.11 jdc * GEM_MAC_HASH2 hash table bits 208-223
566 1.11 jdc * GEM_MAC_HASH3 hash table bits 192-207
567 1.11 jdc * GEM_MAC_HASH4 hash table bits 176-191
568 1.11 jdc * GEM_MAC_HASH5 hash table bits 160-175
569 1.11 jdc * GEM_MAC_HASH6 hash table bits 144-159
570 1.11 jdc * GEM_MAC_HASH7 hash table bits 128-143
571 1.11 jdc * GEM_MAC_HASH8 hash table bits 112-127
572 1.11 jdc * GEM_MAC_HASH9 hash table bits 96-111
573 1.11 jdc * GEM_MAC_HASH10 hash table bits 80-95
574 1.11 jdc * GEM_MAC_HASH11 hash table bits 64-79
575 1.11 jdc * GEM_MAC_HASH12 hash table bits 48-63
576 1.11 jdc * GEM_MAC_HASH13 hash table bits 32-47
577 1.11 jdc * GEM_MAC_HASH14 hash table bits 16-31
578 1.11 jdc * GEM_MAC_HASH15 hash table bits 0-15
579 1.11 jdc */
580 1.11 jdc
581 1.11 jdc /*
582 1.11 jdc * Recommended values for statistic registers:
583 1.11 jdc * GEM_MAC_NORM_COLL_CNT 0x0000
584 1.11 jdc * GEM_MAC_FIRST_COLL_CNT 0x0000
585 1.11 jdc * GEM_MAC_EXCESS_COLL_CNT 0x0000
586 1.11 jdc * GEM_MAC_LATE_COLL_CNT 0x0000
587 1.11 jdc * GEM_MAC_DEFER_TMR_CNT 0x0000
588 1.11 jdc * GEM_MAC_PEAK_ATTEMPTS 0x0000
589 1.11 jdc * GEM_MAC_RX_FRAME_COUNT 0x0000
590 1.11 jdc * GEM_MAC_RX_LEN_ERR_CNT 0x0000
591 1.11 jdc * GEM_MAC_RX_ALIGN_ERR 0x0000
592 1.11 jdc * GEM_MAC_RX_CRC_ERR_CNT 0x0000
593 1.11 jdc * GEM_MAC_RX_CODE_VIOL 0x0000
594 1.11 jdc */
595 1.11 jdc
596 1.11 jdc
597 1.11 jdc /*
598 1.11 jdc * MIF Programmable Resources
599 1.11 jdc * Section 3.1.5.8
600 1.11 jdc * Bit-bang registers use low bit only
601 1.11 jdc */
602 1.11 jdc #define GEM_MIF_BB_CLOCK 0x6200 /* MIF Bit-Bang Clock */
603 1.11 jdc #define GEM_MIF_BB_DATA 0x6204 /* MIF Bit-Bang Data */
604 1.11 jdc #define GEM_MIF_BB_OUTPUT_ENAB 0x6208 /* MIF Bit-Bang Output Enable */
605 1.11 jdc #define GEM_MIF_FRAME 0x620c /* MIF Frame/Output */
606 1.11 jdc #define GEM_MIF_CONFIG 0x6210 /* MIF Configuration */
607 1.11 jdc #define GEM_MIF_INTERRUPT_MASK 0x6214 /* MIF Mask */
608 1.11 jdc #define GEM_MIF_BASIC_STATUS 0x6218 /* MIF Status */
609 1.11 jdc #define GEM_MIF_STATE_MACHINE 0x621c /* MIF State Machine */
610 1.11 jdc
611 1.11 jdc
612 1.11 jdc /*
613 1.11 jdc * Bits in GEM_MIF_FRAME register
614 1.11 jdc */
615 1.11 jdc #define GEM_MIF_FRAME_DATA 0x0000ffff /* Instruction payload */
616 1.1 eeh #define GEM_MIF_FRAME_TA0 0x00010000 /* TA bit, 1 for completion */
617 1.1 eeh #define GEM_MIF_FRAME_TA1 0x00020000 /* TA bits */
618 1.11 jdc #define GEM_MIF_FRAME_REG_ADDR 0x007c0000 /* Register address */
619 1.11 jdc #define GEM_MIF_FRAME_PHY_ADDR 0x0f800000 /* PHY address, should be 0 */
620 1.1 eeh #define GEM_MIF_FRAME_OP 0x30000000 /* operation - write/read */
621 1.1 eeh #define GEM_MIF_FRAME_START 0xc0000000 /* START bits */
622 1.1 eeh
623 1.1 eeh #define GEM_MIF_FRAME_READ 0x60020000
624 1.1 eeh #define GEM_MIF_FRAME_WRITE 0x50020000
625 1.1 eeh
626 1.1 eeh #define GEM_MIF_REG_SHIFT 18
627 1.1 eeh #define GEM_MIF_PHY_SHIFT 23
628 1.1 eeh
629 1.1 eeh
630 1.11 jdc /*
631 1.11 jdc * Bits in GEM_MIF_CONFIG register
632 1.11 jdc */
633 1.11 jdc #define GEM_MIF_CONFIG_PHY_SEL 0x00000001 /* PHY select, 0=MDIO_0 */
634 1.1 eeh #define GEM_MIF_CONFIG_POLL_ENA 0x00000002 /* poll enable */
635 1.1 eeh #define GEM_MIF_CONFIG_BB_ENA 0x00000004 /* bit bang enable */
636 1.1 eeh #define GEM_MIF_CONFIG_REG_ADR 0x000000f8 /* poll register address */
637 1.11 jdc #define GEM_MIF_CONFIG_MDI0 0x00000100 /* MDIO_0 B-B data/attached */
638 1.11 jdc #define GEM_MIF_CONFIG_MDI1 0x00000200 /* MDIO_1 B-B data/attached */
639 1.1 eeh #define GEM_MIF_CONFIG_PHY_ADR 0x00007c00 /* poll PHY address */
640 1.11 jdc /* MDIO_0 is onboard transceiver MDIO_1 is external, PHY addr for both is 0 */
641 1.7 heas #define GEM_MIF_CONFIG_BITS "\177\020b\0PHYSEL\0b\1POLL\0b\2BBENA\0" \
642 1.7 heas "b\x8MDIO0\0b\x9MDIO1\0\0"
643 1.1 eeh
644 1.1 eeh
645 1.1 eeh /*
646 1.11 jdc * Bits in GEM_MIF_BASIC_STATUS and GEM_MIF_INTERRUPT_MASK
647 1.1 eeh * The Basic part is the last value read in the POLL field of the config
648 1.1 eeh * register.
649 1.1 eeh * The status part indicates the bits that have changed.
650 1.1 eeh */
651 1.11 jdc #define GEM_MIF_STATUS 0x0000ffff
652 1.11 jdc #define GEM_MIF_BASIC 0xffff0000
653 1.11 jdc
654 1.11 jdc
655 1.11 jdc /*
656 1.11 jdc * PCS/Serialink Registers
657 1.11 jdc * Section 3.1.6
658 1.11 jdc * DO NOT TOUCH THESE REGISTERS ON ERI -- IT HARD HANGS.
659 1.11 jdc */
660 1.11 jdc #define GEM_MII_CONTROL 0x9000 /* PCS MII Control */
661 1.11 jdc #define GEM_MII_STATUS 0x9004 /* PCS MII Status */
662 1.11 jdc #define GEM_MII_ANAR 0x9008 /* PCS MII Advertisement */
663 1.11 jdc #define GEM_MII_ANLPAR 0x900c /* PCS MII Link Partner
664 1.11 jdc Ability */
665 1.11 jdc #define GEM_MII_CONFIG 0x9010 /* PCS Configuration */
666 1.11 jdc #define GEM_MII_STATE_MACHINE 0x9014 /* PCS State Machine */
667 1.11 jdc #define GEM_MII_INTERRUP_STATUS 0x9018 /* PCS Interrupt Status */
668 1.11 jdc #define GEM_MII_DATAPATH_MODE 0x9050 /* Datapath Mode Register */
669 1.11 jdc #define GEM_MII_SLINK_CONTROL 0x9054 /* Serialink Control */
670 1.11 jdc #define GEM_MII_OUTPUT_SELECT 0x9058 /* Share Output Select */
671 1.11 jdc #define GEM_MII_SLINK_STATUS 0x905c /* Serialink Status */
672 1.1 eeh
673 1.1 eeh
674 1.11 jdc /*
675 1.11 jdc * Bits in GEM_MII_CONTROL register
676 1.11 jdc * PCS "BMCR" (Basic Mode Control Reg)
677 1.11 jdc * Default: 0x1040
678 1.11 jdc * AUTONEG and RESET self clear when relevant process is completed.
679 1.11 jdc */
680 1.11 jdc #define GEM_MII_1GB_SPEED_SEL 0x00000040 /* 1000Mb/s, always 1 */
681 1.11 jdc #define GEM_MII_CONTROL_COL_TST 0x00000080 /* collision test */
682 1.11 jdc #define GEM_MII_CONTROL_FDUPLEX 0x00000100 /* full duplex, always 0 */
683 1.11 jdc #define GEM_MII_CONTROL_RAN 0x00000200 /* restart auto negotiation */
684 1.11 jdc #define GEM_MII_CONTROL_ISOLATE 0x00000400 /* isolate PHY, ignored */
685 1.11 jdc #define GEM_MII_CONTROL_POWERDN 0x00000800 /* power down, ignored */
686 1.1 eeh #define GEM_MII_CONTROL_AUTONEG 0x00001000 /* auto negotiation enabled */
687 1.11 jdc #define GEM_MII_CONTROL_SPEED 0x00002000 /* speed select, ignored */
688 1.11 jdc #define GEM_MII_CONTROL_LOOPBK 0x00004000 /* Serialink loopback */
689 1.11 jdc #define GEM_MII_CONTROL_RESET 0x00008000 /* Reset PCS */
690 1.7 heas #define GEM_MII_CONTROL_BITS "\177\020b\7COLTST\0b\x8_FD\0b\x9RAN\0" \
691 1.7 heas "b\xaISOLATE\0b\xbPWRDWN\0b\xc_ANEG\0" \
692 1.7 heas "b\xdGIGE\0b\xeLOOP\0b\xfRESET\0\0"
693 1.1 eeh
694 1.1 eeh
695 1.11 jdc /*
696 1.11 jdc * Bits in GEM_MII_STATUS register.
697 1.11 jdc * PCS "BMSR" (Basic Mode Status Reg)
698 1.11 jdc * Default: 0x0108
699 1.11 jdc */
700 1.11 jdc #define GEM_MII_STATUS_EXTCAP 0x00000001 /* extended capability, always 0 */
701 1.11 jdc #define GEM_MII_STATUS_JABBER 0x00000002 /* jabber detected, always 0 */
702 1.11 jdc #define GEM_MII_STATUS_LINK_STS 0x00000004 /* link status, 1=up */
703 1.11 jdc #define GEM_MII_STATUS_ACFG 0x00000008 /* can auto neg, always 1 */
704 1.11 jdc #define GEM_MII_STATUS_REM_FLT 0x00000010 /* remote fault detected */
705 1.11 jdc #define GEM_MII_STATUS_ANEG_CPT 0x00000020 /* auto negotiate complete */
706 1.11 jdc #define GEM_MII_STATUS_EXT_STS 0x00000100 /* Is 1000Base-X, always 1 */
707 1.11 jdc #define GEM_MII_STATUS_GB_HDX 0x00000200 /* can perform GBit HDX */
708 1.1 eeh #define GEM_MII_STATUS_GB_FDX 0x00000400 /* can perform GBit FDX */
709 1.7 heas #define GEM_MII_STATUS_BITS "\177\020b\0EXTCAP\0b\1JABBER\0b\2LINKSTS\0" \
710 1.7 heas "b\3ACFG\0b\4REMFLT\0b\5ANEGCPT\0b\x9GBHDX\0" \
711 1.7 heas "b\xaGBFDX\0\0"
712 1.1 eeh
713 1.1 eeh
714 1.11 jdc /*
715 1.11 jdc * Bits in GEM_MII_ANAR and GEM_MII_ANLPAR registers
716 1.11 jdc * GEM_MII_ANAR contains our capabilities for auto- negotiation
717 1.11 jdc * (Default: 0x00e0) and GEM_MII_ANLPAR contains the link partners
718 1.11 jdc * abilities and is only valid after auto-negotiation completes.
719 1.11 jdc */
720 1.11 jdc #define GEM_MII_ANEG_FUL_DUPLX 0x00000020 /* can do 1000Base-X FDX */
721 1.11 jdc #define GEM_MII_ANEG_HLF_DUPLX 0x00000040 /* can do 1000Base-X HDX */
722 1.11 jdc #define GEM_MII_ANEG_SYM_PAUSE 0x00000080 /* can do symmetric pause */
723 1.11 jdc #define GEM_MII_ANEG_ASYM_PAUSE 0x00000100 /* can do asymmetric pause */
724 1.11 jdc #define GEM_MII_ANEG_RF 0x00003000 /* advertise remote fault */
725 1.11 jdc #define GEM_MII_ANEG_ACK 0x00004000 /* ack reception of
726 1.11 jdc Link Partner Capability */
727 1.11 jdc #define GEM_MII_ANEG_NP 0x00008000 /* next page bit, always 0 */
728 1.7 heas #define GEM_MII_ANEG_BITS "\177\020b\5FDX\0b\6HDX\0b\7SYMPAUSE\0" \
729 1.7 heas "\b\x8_ASYMPAUSE\0\b\xdREMFLT\0\b\xeLPACK\0" \
730 1.7 heas "\b\xfNPBIT\0\0"
731 1.1 eeh
732 1.1 eeh
733 1.11 jdc /*
734 1.11 jdc * Bits in GEM_MII_CONFIG register
735 1.11 jdc * Default: 0x0
736 1.11 jdc * GEM_MII_CONFIG_ENABLE must be 0 when modifiying the GEM_MII_ANAR
737 1.11 jdc * register. To isolate the MC from the media, set this bit to 0 and
738 1.11 jdc * restart auto-negotiation in GEM_MII_CONTROL.
739 1.11 jdc */
740 1.11 jdc #define GEM_MII_CONFIG_ENABLE 0x00000001 /* Enable PCS */
741 1.11 jdc #define GEM_MII_CONFIG_SDO 0x00000002 /* Signal Detect Override */
742 1.11 jdc #define GEM_MII_CONFIG_SDL 0x00000004 /* Signal Detect active low */
743 1.7 heas #define GEM_MII_CONFIG_TIMER 0x0000000e /* link monitor timer values */
744 1.7 heas #define GEM_MII_CONFIG_JS 0x00000018 /* Jitter Study, 0 normal
745 1.7 heas * 1 high freq, 2 low freq */
746 1.11 jdc #define GEM_MII_CONFIG_ANTO 0x00000020 /* 10ms ANEG timer override */
747 1.7 heas #define GEM_MII_CONFIG_BITS "\177\020b\0PCSENA\0\0"
748 1.1 eeh
749 1.1 eeh
750 1.6 heas /*
751 1.11 jdc * Bits in GEM_MII_STATE_MACHINE register
752 1.6 heas * XXX These are best guesses from observed behavior.
753 1.6 heas */
754 1.6 heas #define GEM_MII_FSM_STOP 0x00000000 /* stopped */
755 1.6 heas #define GEM_MII_FSM_RUN 0x00000001 /* running */
756 1.6 heas #define GEM_MII_FSM_UNKWN 0x00000100 /* unknown */
757 1.6 heas #define GEM_MII_FSM_DONE 0x00000101 /* complete */
758 1.6 heas
759 1.6 heas
760 1.6 heas /*
761 1.11 jdc * Bits in GEM_MII_INTERRUP_STATUS register
762 1.6 heas * No mask register; mask with the global interrupt mask register.
763 1.6 heas */
764 1.11 jdc #define GEM_MII_INTERRUP_LINK 0x00000004 /* PCS link status change */
765 1.6 heas
766 1.6 heas
767 1.11 jdc /*
768 1.11 jdc * Bits in GEM_MII_DATAPATH_MODE register
769 1.11 jdc * Default: none
770 1.11 jdc */
771 1.11 jdc #define GEM_MII_DATAPATH_SERIAL 0x00000001 /* Use internal Serialink */
772 1.1 eeh #define GEM_MII_DATAPATH_SERDES 0x00000002 /* Use PCS via 10bit interfac */
773 1.7 heas #define GEM_MII_DATAPATH_MII 0x00000004 /* Use {G}MII, not PCS */
774 1.11 jdc #define GEM_MII_DATAPATH_MIIOUT 0x00000008 /* Set serial output on GMII */
775 1.11 jdc #define GEM_MII_DATAPATH_BITS "\177\020" \
776 1.4 matt "b\0SERIAL\0b\1SERDES\0b\2MII\0b\3MIIOUT\0\0"
777 1.1 eeh
778 1.1 eeh
779 1.11 jdc /*
780 1.11 jdc * Bits in GEM_MII_SLINK_CONTROL register
781 1.11 jdc * Default: 0x000
782 1.11 jdc */
783 1.11 jdc #define GEM_MII_SLINK_LOOPBACK 0x00000001 /* enable loopback on Serialink
784 1.11 jdc disable loopback on SERDES */
785 1.1 eeh #define GEM_MII_SLINK_EN_SYNC_D 0x00000002 /* enable sync detection */
786 1.1 eeh #define GEM_MII_SLINK_LOCK_REF 0x00000004 /* lock reference clock */
787 1.11 jdc #define GEM_MII_SLINK_EMPHASIS 0x00000018 /* enable emphasis */
788 1.1 eeh #define GEM_MII_SLINK_SELFTEST 0x000001c0
789 1.11 jdc #define GEM_MII_SLINK_POWER_OFF 0x00000200 /* Power down Serialink block */
790 1.11 jdc #define GEM_MII_SLINK_RX_ZERO 0x00000c00 /* PLL input to Serialink */
791 1.11 jdc #define GEM_MII_SLINK_RX_POLL 0x00003000 /* PLL input to Serialink */
792 1.11 jdc #define GEM_MII_SLINK_TX_ZERO 0x0000c000 /* PLL input to Serialink */
793 1.11 jdc #define GEM_MII_SLINK_TX_POLL 0x00030000 /* PLL input to Serialink */
794 1.11 jdc #define GEM_MII_SLINK_CONTROL_BITS \
795 1.7 heas "\177\020b\0LOOP\0b\1ENASYNC\0b\2LOCKREF" \
796 1.11 jdc "\0b\3EMPHASIS1\0b\4EMPHASIS2\0b\x9PWRDWN\0\0"
797 1.11 jdc
798 1.11 jdc
799 1.11 jdc /*
800 1.11 jdc * Bits in GEM_MII_OUTPUT_SELECT register
801 1.11 jdc * Default: 0x0
802 1.11 jdc */
803 1.11 jdc #define GEM_MII_PROM_ADDR 0x00000003 /* Test output multiplexor */
804 1.1 eeh
805 1.1 eeh
806 1.11 jdc /*
807 1.11 jdc * Bits in GEM_MII_SLINK_STATUS register
808 1.11 jdc * Default: 0x0
809 1.11 jdc */
810 1.1 eeh #define GEM_MII_SLINK_TEST 0x00000000 /* undergoing test */
811 1.1 eeh #define GEM_MII_SLINK_LOCKED 0x00000001 /* waiting 500us lockrefn */
812 1.1 eeh #define GEM_MII_SLINK_COMMA 0x00000002 /* waiting for comma detect */
813 1.1 eeh #define GEM_MII_SLINK_SYNC 0x00000003 /* recv data synchronized */
814 1.1 eeh
815 1.1 eeh
816 1.11 jdc /*
817 1.11 jdc * PCI Expansion ROM runtime access
818 1.11 jdc * Sun GEMs map a 1MB space for the PCI Expansion ROM as the second half
819 1.11 jdc * of the first register bank, although they only support up to 64KB ROMs.
820 1.11 jdc */
821 1.11 jdc #define GEM_PCI_ROM_OFFSET 0x100000
822 1.11 jdc #define GEM_PCI_ROM_SIZE 0x10000
823 1.11 jdc
824 1.11 jdc
825 1.1 eeh /* Wired GEM PHY addresses */
826 1.1 eeh #define GEM_PHYAD_INTERNAL 1
827 1.1 eeh #define GEM_PHYAD_EXTERNAL 0
828 1.1 eeh
829 1.1 eeh /*
830 1.1 eeh * GEM descriptor table structures.
831 1.1 eeh */
832 1.1 eeh struct gem_desc {
833 1.10 dyoung volatile uint64_t gd_flags;
834 1.10 dyoung volatile uint64_t gd_addr;
835 1.1 eeh };
836 1.1 eeh
837 1.1 eeh /* Transmit flags */
838 1.1 eeh #define GEM_TD_BUFSIZE 0x0000000000007fffLL
839 1.1 eeh #define GEM_TD_CXSUM_START 0x00000000001f8000LL /* Cxsum start offset */
840 1.7 heas #define GEM_TD_CXSUM_STARTSHFT 15
841 1.1 eeh #define GEM_TD_CXSUM_STUFF 0x000000001fe00000LL /* Cxsum stuff offset */
842 1.7 heas #define GEM_TD_CXSUM_STUFFSHFT 21
843 1.1 eeh #define GEM_TD_CXSUM_ENABLE 0x0000000020000000LL /* Cxsum generation enable */
844 1.1 eeh #define GEM_TD_END_OF_PACKET 0x0000000040000000LL
845 1.1 eeh #define GEM_TD_START_OF_PACKET 0x0000000080000000LL
846 1.1 eeh #define GEM_TD_INTERRUPT_ME 0x0000000100000000LL /* Interrupt me now */
847 1.1 eeh #define GEM_TD_NO_CRC 0x0000000200000000LL /* do not insert crc */
848 1.1 eeh /*
849 1.1 eeh * Only need to set GEM_TD_CXSUM_ENABLE, GEM_TD_CXSUM_STUFF,
850 1.6 heas * GEM_TD_CXSUM_START, and GEM_TD_INTERRUPT_ME in 1st descriptor of a group.
851 1.1 eeh */
852 1.1 eeh
853 1.1 eeh /* Receive flags */
854 1.7 heas #define GEM_RD_CHECKSUM 0x000000000000ffffLL /* is the complement */
855 1.1 eeh #define GEM_RD_BUFSIZE 0x000000007fff0000LL
856 1.1 eeh #define GEM_RD_OWN 0x0000000080000000LL /* 1 - owned by h/w */
857 1.1 eeh #define GEM_RD_HASHVAL 0x0ffff00000000000LL
858 1.1 eeh #define GEM_RD_HASH_PASS 0x1000000000000000LL /* passed hash filter */
859 1.1 eeh #define GEM_RD_ALTERNATE_MAC 0x2000000000000000LL /* Alternate MAC adrs */
860 1.1 eeh #define GEM_RD_BAD_CRC 0x4000000000000000LL
861 1.1 eeh
862 1.1 eeh #define GEM_RD_BUFSHIFT 16
863 1.1 eeh #define GEM_RD_BUFLEN(x) (((x)&GEM_RD_BUFSIZE)>>GEM_RD_BUFSHIFT)
864 1.1 eeh
865 1.1 eeh #endif
866