smc91cxxreg.h revision 1.5 1 1.5 scw /* $NetBSD: smc91cxxreg.h,v 1.5 2003/04/29 08:47:30 scw Exp $ */
2 1.2 thorpej
3 1.2 thorpej /*
4 1.2 thorpej * Copyright (c) 1996 Gardner Buchanan <gbuchanan (at) shl.com>
5 1.2 thorpej * All rights reserved.
6 1.2 thorpej *
7 1.2 thorpej * Redistribution and use in source and binary forms, with or without
8 1.2 thorpej * modification, are permitted provided that the following conditions
9 1.2 thorpej * are met:
10 1.2 thorpej * 1. Redistributions of source code must retain the above copyright
11 1.2 thorpej * notice, this list of conditions and the following disclaimer.
12 1.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
13 1.2 thorpej * notice, this list of conditions and the following disclaimer in the
14 1.2 thorpej * documentation and/or other materials provided with the distribution.
15 1.2 thorpej * 3. All advertising materials mentioning features or use of this software
16 1.2 thorpej * must display the following acknowledgement:
17 1.2 thorpej * This product includes software developed by Gardner Buchanan.
18 1.2 thorpej * 4. The name of Gardner Buchanan may not be used to endorse or promote
19 1.2 thorpej * products derived from this software without specific prior written
20 1.2 thorpej * permission.
21 1.2 thorpej *
22 1.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.2 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.2 thorpej * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.2 thorpej * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.2 thorpej * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.2 thorpej * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.2 thorpej * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.2 thorpej * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.2 thorpej * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.2 thorpej * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.2 thorpej *
33 1.2 thorpej * from FreeBSD Id: if_snreg.h,v 1.4 1996/03/18 15:47:30 gardner Exp
34 1.2 thorpej */
35 1.2 thorpej
36 1.2 thorpej /*
37 1.2 thorpej * This file contains register information and access macros for
38 1.2 thorpej * the SMC91xxx chipset.
39 1.2 thorpej *
40 1.2 thorpej * Information contained in this file was obtained from the SMC91C92
41 1.2 thorpej * and SMC91C94 manuals from SMC. You will need one of these in order
42 1.2 thorpej * to make any meaningful changes to this driver. Information about
43 1.2 thorpej * obtaining one can be found at http://www.smc.com in the components
44 1.2 thorpej * division.
45 1.2 thorpej *
46 1.2 thorpej * This FreeBSD driver is derived in part from the smc9194 Linux driver
47 1.2 thorpej * by Erik Stahlman.
48 1.2 thorpej */
49 1.2 thorpej
50 1.2 thorpej
51 1.2 thorpej /*
52 1.2 thorpej * Wait time for memory to be free. This probably shouldn't be
53 1.2 thorpej * tuned that much, as waiting for this means nothing else happens
54 1.2 thorpej * in the system
55 1.2 thorpej */
56 1.2 thorpej #define MEMORY_WAIT_TIME 1000
57 1.2 thorpej
58 1.2 thorpej
59 1.2 thorpej /* The SMC91xxx uses 16 I/O ports */
60 1.2 thorpej #define SMC_IOSIZE 16
61 1.2 thorpej
62 1.2 thorpej
63 1.2 thorpej /*
64 1.2 thorpej * A description of the SMC registers is probably in order here,
65 1.2 thorpej * although for details, the SMC datasheet is invaluable.
66 1.2 thorpej * The data sheet I (GB) am using is "SMC91C92 Single Chip Ethernet
67 1.2 thorpej * Controller With RAM", Rev. 12/0/94. Constant definitions I give
68 1.2 thorpej * here are loosely based on the mnemonic names given to them in the
69 1.2 thorpej * data sheet, but there are many exceptions.
70 1.2 thorpej *
71 1.2 thorpej * Basically, the chip has 4 banks of registers (0 to 3), which
72 1.2 thorpej * are accessed by writing a number into the BANK_SELECT register
73 1.2 thorpej * (I also use a SMC_SELECT_BANK macro for this). Registers are
74 1.2 thorpej * either Byte or Word sized. My constant definitions end in _B
75 1.2 thorpej * or _W as appropriate.
76 1.2 thorpej *
77 1.2 thorpej * The banks are arranged so that for most purposes, bank 2 is all
78 1.2 thorpej * that is needed for normal run time tasks.
79 1.2 thorpej */
80 1.2 thorpej
81 1.2 thorpej
82 1.2 thorpej /*
83 1.2 thorpej * Bank Select Register. This also doubles as
84 1.2 thorpej * a chip identification register. This register
85 1.2 thorpej * is mapped at the same position in all banks.
86 1.2 thorpej */
87 1.2 thorpej #define BANK_SELECT_REG_W 0x0e
88 1.2 thorpej #define BSR_DETECT_MASK 0xff00
89 1.2 thorpej #define BSR_DETECT_VALUE 0x3300
90 1.2 thorpej
91 1.2 thorpej
92 1.2 thorpej /*
93 1.2 thorpej * BANK 0
94 1.2 thorpej */
95 1.2 thorpej
96 1.2 thorpej /*
97 1.2 thorpej * Transmit Control Register controls some aspects of the transmit
98 1.2 thorpej * behavior of the Ethernet Protocol Handler.
99 1.2 thorpej */
100 1.2 thorpej #define TXMIT_CONTROL_REG_W 0x00
101 1.2 thorpej
102 1.2 thorpej #define TCR_ENABLE 0x0001 /* if this is 1, we can transmit */
103 1.2 thorpej #define TCR_LOOP 0x0002 /* Enable internal analogue loopback */
104 1.2 thorpej #define TCR_FORCOL 0x0004 /* Force Collision on next TX */
105 1.2 thorpej #define TCR_PAD_ENABLE 0x0080 /* Pad short packets to 64 bytes */
106 1.2 thorpej #define TCR_NOCRC 0x0100 /* Do not append CRC */
107 1.2 thorpej #define TCR_MON_CSN 0x0400 /* monitors the carrier status */
108 1.2 thorpej #define TCR_FDUPLX 0x0800 /* receive packets sent out */
109 1.2 thorpej #define TCR_STP_SQET 0x1000 /* stop transmitting if Signal quality error */
110 1.2 thorpej #define TCR_EPH_LOOP 0x2000 /* Enable internal digital loopback */
111 1.3 briggs #define TCR_SWFDUP 0x8000 /* FEAST: Switched full-duplex (only w/ MII) */
112 1.2 thorpej
113 1.2 thorpej
114 1.2 thorpej /*
115 1.2 thorpej * Status of the last transmitted frame and instantaneous status of
116 1.2 thorpej * the Ethernet Protocol Handler jumbled together. In auto-release
117 1.2 thorpej * mode this information is simply discarded after each TX. This info
118 1.2 thorpej * is copied to the status word of in-memory packets after transmit
119 1.2 thorpej * where relevent statuses can be checked.
120 1.2 thorpej */
121 1.2 thorpej #define EPH_STATUS_REG_W 0x02
122 1.2 thorpej
123 1.2 thorpej #define EPHSR_TX_SUC 0x0001 /* Transmit was successful */
124 1.2 thorpej #define EPHSR_SNGLCOL 0x0002 /* Single collision occurred */
125 1.2 thorpej #define EPHSR_MULCOL 0x0004 /* Multiple Collisions occurred */
126 1.2 thorpej #define EPHSR_LTX_MULT 0x0008 /* Transmit was a multicast */
127 1.2 thorpej #define EPHSR_16COL 0x0010 /* 16 Collisions occurred, TX disabled */
128 1.2 thorpej #define EPHSR_SQET 0x0020 /* SQE Test failed, TX disabled */
129 1.2 thorpej #define EPHSR_LTX_BRD 0x0040 /* Transmit was a broadcast */
130 1.2 thorpej #define EPHSR_DEFR 0x0080 /* TX deferred due to carrier det. */
131 1.2 thorpej #define EPHSR_LATCOL 0x0200 /* Late collision detected, TX disabled */
132 1.2 thorpej #define EPHSR_LOST_CAR 0x0400 /* Lost carrier sense, TX disabled */
133 1.2 thorpej #define EPHSR_EXC_DEF 0x0800 /* Excessive deferrals in TX >2 MAXETHER
134 1.2 thorpej * times */
135 1.2 thorpej #define EPHSR_CTR_ROL 0x1000 /* Some ECR Counter(s) rolled over */
136 1.2 thorpej #define EPHSR_RX_OVRN 0x2000 /* Receiver overrun, packets dropped */
137 1.2 thorpej #define EPHSR_LINK_OK 0x4000 /* Link integrity is OK */
138 1.2 thorpej #define EPHSR_TXUNRN 0x8000 /* Transmit underrun */
139 1.2 thorpej
140 1.2 thorpej
141 1.2 thorpej /*
142 1.2 thorpej * Receiver Control Register controls some aspects of the receive
143 1.2 thorpej * behavior of the Ethernet Protocol Handler.
144 1.2 thorpej */
145 1.2 thorpej #define RECV_CONTROL_REG_W 0x04
146 1.2 thorpej
147 1.2 thorpej #define RCR_RX_ABORT 0x0001 /* Received huge packet */
148 1.2 thorpej #define RCR_PROMISC 0x0002 /* enable promiscuous mode */
149 1.2 thorpej #define RCR_ALMUL 0x0004 /* receive all multicast packets */
150 1.4 wiz #define RCR_ENABLE 0x0100 /* IFF this is set, we can receive packets */
151 1.2 thorpej #define RCR_STRIP_CRC 0x0200 /* strips CRC */
152 1.2 thorpej #define RCR_GAIN_BITS 0x0c00 /* PLL Gain control (for testing) */
153 1.2 thorpej #define RCR_FILT_CAR 0x4000 /* Enable 12 bit carrier filter */
154 1.2 thorpej #define RCR_SOFTRESET 0x8000 /* Resets the EPH logic */
155 1.2 thorpej
156 1.2 thorpej
157 1.2 thorpej /*
158 1.2 thorpej * TX Statistics counters
159 1.2 thorpej */
160 1.2 thorpej #define COUNTER_REG_W 0x06
161 1.2 thorpej
162 1.2 thorpej #define ECR_COLN_MASK 0x000f /* Vanilla collisions */
163 1.2 thorpej #define ECR_MCOLN_MASK 0x00f0 /* Multiple collisions */
164 1.2 thorpej #define ECR_DTX_MASK 0x0f00 /* Deferred transmits */
165 1.2 thorpej #define ECR_EXDTX_MASK 0xf000 /* Excessively deferred transmits */
166 1.2 thorpej
167 1.2 thorpej
168 1.2 thorpej /*
169 1.2 thorpej * Memory Information
170 1.2 thorpej */
171 1.2 thorpej #define MEM_INFO_REG_W 0x08
172 1.2 thorpej
173 1.2 thorpej #define MIR_FREE_MASK 0xff00 /* Free memory pages available */
174 1.2 thorpej #define MIR_TOTAL_MASK 0x00ff /* Total memory pages available */
175 1.5 scw #define MIR_MULT_91C111 1
176 1.5 scw #define MIR_SCALE_91C9x 256
177 1.5 scw #define MIR_SCALE_91C111 2048
178 1.2 thorpej
179 1.2 thorpej
180 1.2 thorpej /*
181 1.2 thorpej * Memory Configuration
182 1.2 thorpej */
183 1.5 scw #define MEM_CFG_REG_W 0x0a
184 1.2 thorpej
185 1.3 briggs #define MCR_MEM_MULT(x) (((x)>>9)&7) /* Memory size multiplier */
186 1.2 thorpej #define MCR_TXRSV_MASK 0x001f /* Count of pages reserved for transmit */
187 1.2 thorpej
188 1.5 scw /*
189 1.5 scw * Receive/PHY Control Register (SM91C111 only)
190 1.5 scw */
191 1.5 scw #define RX_PHY_CONTROL_REG_W 0x0a /* 91C111 only */
192 1.5 scw
193 1.5 scw #define RPC_LSB_SHIFT 2 /* Shift for LED-B select bits */
194 1.5 scw #define RPC_LSA_SHIFT 5 /* Shift for LED-A select bits */
195 1.5 scw #define RPC_LS_MASK 0x7 /* LED Select mask */
196 1.5 scw #define RPC_LS_LINK_DETECT 0x0 /* 10/100 link detected */
197 1.5 scw #define RPC_LS_LINK_10MBPS 0x2 /* 10 MBPS link detected */
198 1.5 scw #define RPC_LS_FULL_DUPLEX 0x3 /* Full duplex operation */
199 1.5 scw #define RPC_LS_TXRX 0x4 /* Tx/Rx packet */
200 1.5 scw #define RPC_LS_LINK_100MBPS 0x5 /* 100 MBPS link detected */
201 1.5 scw #define RPC_LS_RX 0x6 /* Rx packet */
202 1.5 scw #define RPC_LS_TX 0x7 /* Tx packet */
203 1.5 scw #define RPC_ANEG 0x0800 /* Autonegotiate enable */
204 1.5 scw #define RPC_DPLX 0x1000 /* Duplex select (set = Full) */
205 1.5 scw #define RPC_SPEED 0x2000 /* Speed (set = 100mbps) */
206 1.5 scw
207 1.2 thorpej
208 1.2 thorpej /*
209 1.2 thorpej * Bank 0, Register 0x0c is unused in the SMC91C92
210 1.2 thorpej */
211 1.2 thorpej
212 1.2 thorpej
213 1.2 thorpej /*
214 1.2 thorpej * BANK 1
215 1.2 thorpej */
216 1.2 thorpej
217 1.2 thorpej /*
218 1.2 thorpej * Adapter configuration
219 1.2 thorpej */
220 1.2 thorpej #define CONFIG_REG_W 0x00
221 1.2 thorpej
222 1.2 thorpej #define CR_INT_SEL0 0x0002 /* Interrupt selector */
223 1.2 thorpej #define CR_INT_SEL1 0x0004 /* Interrupt selector */
224 1.2 thorpej #define CR_DIS_LINK 0x0040 /* Disable 10BaseT Link Test */
225 1.2 thorpej #define CR_16BIT 0x0080 /* Bus width */
226 1.2 thorpej #define CR_AUI_SELECT 0x0100 /* Use external (AUI) Transceiver */
227 1.2 thorpej #define CR_SET_SQLCH 0x0200 /* Squelch level */
228 1.2 thorpej #define CR_FULL_STEP 0x0400 /* AUI signalling mode */
229 1.2 thorpej #define CR_NOW_WAIT_ST 0x1000 /* Disable bus wait states */
230 1.3 briggs #define CR_MII_SELECT 0x8000 /* FEAST: MII port selected */
231 1.2 thorpej
232 1.2 thorpej
233 1.2 thorpej /*
234 1.2 thorpej * The contents of this port are used by the adapter
235 1.2 thorpej * to decode its I/O address. We use it as a varification
236 1.2 thorpej * that the adapter is detected properly when probing.
237 1.2 thorpej */
238 1.2 thorpej #define BASE_ADDR_REG_W 0x02 /* The selected I/O Base addr. */
239 1.2 thorpej
240 1.2 thorpej
241 1.2 thorpej /*
242 1.2 thorpej * These registers hold the Ethernet MAC address.
243 1.2 thorpej */
244 1.2 thorpej #define IAR_ADDR0_REG_W 0x04 /* My Ethernet address */
245 1.2 thorpej #define IAR_ADDR1_REG_W 0x06 /* My Ethernet address */
246 1.2 thorpej #define IAR_ADDR2_REG_W 0x08 /* My Ethernet address */
247 1.2 thorpej
248 1.2 thorpej
249 1.2 thorpej /*
250 1.2 thorpej * General purpose register used for talking to the EEPROM.
251 1.2 thorpej */
252 1.2 thorpej #define GENERAL_REG_W 0x0a
253 1.2 thorpej
254 1.2 thorpej
255 1.2 thorpej /*
256 1.2 thorpej * Control register used for talking to the EEPROM and
257 1.2 thorpej * setting some EPH functions.
258 1.2 thorpej */
259 1.2 thorpej #define CONTROL_REG_W 0x0c
260 1.2 thorpej
261 1.2 thorpej #define CTR_STORE 0x0001 /* Store something to EEPROM */
262 1.2 thorpej #define CTR_RELOAD 0x0002 /* Read EEPROM into registers */
263 1.2 thorpej #define CTR_EEPROM_SEL 0x0004 /* Select registers for Reload/Store */
264 1.2 thorpej #define CTR_TE_ENABLE 0x0020 /* Enable TX Error detection via EPH_INT */
265 1.2 thorpej #define CTR_CR_ENABLE 0x0040 /* Enable Counter Rollover via EPH_INT */
266 1.2 thorpej #define CTR_LE_ENABLE 0x0080 /* Enable Link Error detection via EPH_INT */
267 1.2 thorpej #define CTR_AUTO_RELEASE 0x0800 /* Enable auto release mode for TX */
268 1.2 thorpej #define CTR_POWERDOWN 0x2000 /* Enter powerdown mode */
269 1.2 thorpej #define CTR_RCV_BAD 0x4000 /* Enable receipt of frames with bad CRC */
270 1.2 thorpej
271 1.2 thorpej
272 1.2 thorpej /*
273 1.2 thorpej * BANK 2
274 1.2 thorpej */
275 1.2 thorpej
276 1.2 thorpej
277 1.2 thorpej /*
278 1.2 thorpej * Memory Management Unit Control Register
279 1.2 thorpej * Controls allocation of memory to receive and
280 1.2 thorpej * transmit functions.
281 1.2 thorpej */
282 1.2 thorpej #define MMU_CMD_REG_W 0x00
283 1.2 thorpej
284 1.2 thorpej #define MMUCR_BUSY 0x0001 /* MMU busy performing a release */
285 1.2 thorpej
286 1.2 thorpej /*
287 1.2 thorpej * MMU Commands:
288 1.2 thorpej */
289 1.2 thorpej #define MMUCR_NOP 0x0000 /* Do nothing */
290 1.2 thorpej #define MMUCR_ALLOC 0x0020 /* Or with number of 256 byte packets - 1 */
291 1.2 thorpej #define MMUCR_RESET 0x0040 /* Reset MMU State */
292 1.2 thorpej #define MMUCR_REMOVE 0x0060 /* Dequeue (but not free) current RX packet */
293 1.2 thorpej #define MMUCR_RELEASE 0x0080 /* Dequeue and free the current RX packet */
294 1.2 thorpej #define MMUCR_FREEPKT 0x00a0 /* Release packet in PNR register */
295 1.2 thorpej #define MMUCR_ENQUEUE 0x00c0 /* Enqueue the packet for transmit */
296 1.2 thorpej #define MMUCR_RESETTX 0x00e0 /* Reset transmit queues */
297 1.2 thorpej
298 1.2 thorpej /*
299 1.2 thorpej * Packet Number at TX Area
300 1.2 thorpej */
301 1.2 thorpej #define PACKET_NUM_REG_B 0x02
302 1.2 thorpej
303 1.2 thorpej /*
304 1.2 thorpej * Packet number resulting from MMUCR_ALLOC
305 1.2 thorpej */
306 1.2 thorpej #define ALLOC_RESULT_REG_B 0x03
307 1.2 thorpej #define ARR_FAILED 0x80
308 1.2 thorpej
309 1.2 thorpej /*
310 1.2 thorpej * Transmit and receive queue heads
311 1.2 thorpej */
312 1.2 thorpej #define FIFO_PORTS_REG_W 0x04
313 1.2 thorpej #define FIFO_REMPTY 0x8000
314 1.2 thorpej #define FIFO_TEMPTY 0x0080
315 1.2 thorpej #define FIFO_RX_MASK 0x7f00
316 1.2 thorpej #define FIFO_TX_MASK 0x007f
317 1.2 thorpej
318 1.2 thorpej
319 1.2 thorpej /*
320 1.2 thorpej * The address within the packet for reading/writing. The
321 1.2 thorpej * PTR_RCV bit is tricky. When PTR_RCV==1, the packet number
322 1.2 thorpej * to be read is found in the FIFO_PORTS_REG_W, FIFO_RX_MASK.
323 1.2 thorpej * When PTR_RCV==0, the packet number to be written is found
324 1.2 thorpej * in the PACKET_NUM_REG_B.
325 1.2 thorpej */
326 1.2 thorpej #define POINTER_REG_W 0x06
327 1.2 thorpej
328 1.2 thorpej #define PTR_READ 0x2000 /* Intended access mode */
329 1.2 thorpej #define PTR_AUTOINC 0x4000 /* Do auto inc after read/write */
330 1.2 thorpej #define PTR_RCV 0x8000 /* FIFO_RX is packet, otherwise PNR is packet */
331 1.2 thorpej
332 1.2 thorpej /*
333 1.2 thorpej * Data I/O register to be used in conjunction with
334 1.2 thorpej * The pointer register to read and write data from the
335 1.2 thorpej * card. The same register can be used for byte and word
336 1.2 thorpej * ops.
337 1.2 thorpej */
338 1.2 thorpej #define DATA_REG_W 0x08
339 1.2 thorpej #define DATA_REG_B 0x08
340 1.2 thorpej #define DATA_1_REG_B 0x08
341 1.2 thorpej #define DATA_2_REG_B 0x0a
342 1.2 thorpej
343 1.2 thorpej
344 1.2 thorpej /*
345 1.2 thorpej * Sense interrupt status (READ)
346 1.2 thorpej */
347 1.2 thorpej #define INTR_STAT_REG_B 0x0c
348 1.2 thorpej
349 1.2 thorpej
350 1.2 thorpej /*
351 1.2 thorpej * Acknowledge interrupt sources (WRITE)
352 1.2 thorpej */
353 1.2 thorpej #define INTR_ACK_REG_B 0x0c
354 1.2 thorpej
355 1.2 thorpej
356 1.2 thorpej /*
357 1.2 thorpej * Interrupt mask. Bit set indicates interrupt allowed.
358 1.2 thorpej */
359 1.2 thorpej #define INTR_MASK_REG_B 0x0d
360 1.2 thorpej
361 1.2 thorpej /*
362 1.2 thorpej * Interrupts
363 1.2 thorpej */
364 1.2 thorpej #define IM_RCV_INT 0x01 /* A packet has been received */
365 1.2 thorpej #define IM_TX_INT 0x02 /* Packet TX complete */
366 1.2 thorpej #define IM_TX_EMPTY_INT 0x04 /* No packets left to TX */
367 1.2 thorpej #define IM_ALLOC_INT 0x08 /* Memory allocation completed */
368 1.2 thorpej #define IM_RX_OVRN_INT 0x10 /* Receiver was overrun */
369 1.2 thorpej #define IM_EPH_INT 0x20 /* Misc. EPH conditions (see CONTROL_REG_W) */
370 1.2 thorpej #define IM_ERCV_INT 0x40 /* not on SMC9192 */
371 1.5 scw #define IM_MD_INT 0x80 /* SMC91C111 Internal PHY status change */
372 1.2 thorpej
373 1.2 thorpej
374 1.2 thorpej /*
375 1.2 thorpej * BANK 3
376 1.2 thorpej */
377 1.2 thorpej
378 1.2 thorpej
379 1.2 thorpej /*
380 1.2 thorpej * Multicast subscriptions.
381 1.2 thorpej * The multicast handling in the SMC90Cxx is quite complicated. A table
382 1.2 thorpej * of multicast address subscriptions is provided and a clever way of
383 1.2 thorpej * speeding the search of that table by hashing is implemented in the
384 1.2 thorpej * hardware. I have ignored this and simply subscribed to all multicasts
385 1.2 thorpej * and let the kernel deal with the results.
386 1.2 thorpej */
387 1.2 thorpej #define MULTICAST1_REG_W 0x00
388 1.2 thorpej #define MULTICAST2_REG_W 0x02
389 1.2 thorpej #define MULTICAST3_REG_W 0x04
390 1.2 thorpej #define MULTICAST4_REG_W 0x06
391 1.2 thorpej
392 1.2 thorpej /*
393 1.2 thorpej * These registers do not exist on SMC9192, or at least
394 1.2 thorpej * are not documented in the SMC91C92 data sheet.
395 1.3 briggs *
396 1.2 thorpej * The REVISION_REG_W register does however seem to work.
397 1.3 briggs *
398 1.3 briggs * On the FEAST, the low nibble controls the MII interface.
399 1.2 thorpej */
400 1.2 thorpej #define MGMT_REG_W 0x08
401 1.2 thorpej
402 1.3 briggs #define MR_MDOE 0x08
403 1.3 briggs #define MR_MCLK 0x04
404 1.3 briggs #define MR_MDI 0x02
405 1.3 briggs #define MR_MDO 0x01
406 1.3 briggs
407 1.2 thorpej #define REVISION_REG_W 0x0a /* (hi: chip id low: rev #) */
408 1.2 thorpej #define RR_REV(x) ((x) & 0x0f)
409 1.2 thorpej #define RR_ID(x) (((x) >> 4) & 0x0f)
410 1.2 thorpej
411 1.2 thorpej #define ERCV_REG_W 0x0c
412 1.2 thorpej
413 1.2 thorpej /*
414 1.2 thorpej * These are constants expected to be found in the
415 1.2 thorpej * chip id register.
416 1.2 thorpej */
417 1.2 thorpej #define CHIP_9190 3
418 1.2 thorpej #define CHIP_9194 4
419 1.2 thorpej #define CHIP_9195 5
420 1.2 thorpej #define CHIP_91100 7
421 1.3 briggs #define CHIP_91100FD 8
422 1.5 scw #define CHIP_91C111 9
423 1.2 thorpej
424 1.2 thorpej
425 1.2 thorpej /*
426 1.2 thorpej * When packets are stuffed into the card or sucked out of the card
427 1.2 thorpej * they are set up more or less as follows:
428 1.2 thorpej *
429 1.2 thorpej * Addr msbyte lsbyte
430 1.2 thorpej * 00 SSSSSSSS SSSSSSSS - STATUS-WORD 16 bit TX or RX status
431 1.2 thorpej * 02 RRRRR - RESERVED (unused)
432 1.2 thorpej * 02 CCC CCCCCCCC - BYTE COUNT (RX: always even, TX: bit 0 ignored)
433 1.2 thorpej * 04 DDDDDDDD DDDDDDDD - DESTINATION ADDRESS
434 1.2 thorpej * 06 DDDDDDDD DDDDDDDD (48 bit Ethernet MAC Address)
435 1.2 thorpej * 08 DDDDDDDD DDDDDDDD
436 1.2 thorpej * 0A SSSSSSSS SSSSSSSS - SOURCE ADDRESS
437 1.2 thorpej * 0C SSSSSSSS SSSSSSSS (48 bit Ethernet MAC Address)
438 1.2 thorpej * 0E SSSSSSSS SSSSSSSS
439 1.2 thorpej * 10 PPPPPPPP PPPPPPPP
440 1.2 thorpej * .. PPPPPPPP PPPPPPPP
441 1.2 thorpej * C-2 CCCCCCCC - CONTROL BYTE
442 1.2 thorpej * C-2 PPPPPPPP - Last data byte (If odd length)
443 1.2 thorpej *
444 1.2 thorpej * The STATUS_WORD is derived from the EPH_STATUS_REG_W register
445 1.2 thorpej * during transmit and is composed of another set of bits described
446 1.2 thorpej * below during receive.
447 1.2 thorpej */
448 1.2 thorpej
449 1.2 thorpej
450 1.2 thorpej /*
451 1.2 thorpej * Receive status bits. These values are found in the status word
452 1.2 thorpej * field of a received packet. For receive packets I use the RS_ODDFRAME
453 1.2 thorpej * to detect whether a frame has an extra byte on it. The CTLB_ODD
454 1.2 thorpej * bit of the control byte tells the same thing.
455 1.2 thorpej */
456 1.2 thorpej #define RS_MULTICAST 0x0001 /* Packet is multicast */
457 1.2 thorpej #define RS_HASH_MASK 0x007e /* Mask of multicast hash value */
458 1.2 thorpej #define RS_TOOSHORT 0x0400 /* Frame was a runt, <64 bytes */
459 1.2 thorpej #define RS_TOOLONG 0x0800 /* Frame was giant, >1518 */
460 1.2 thorpej #define RS_ODDFRAME 0x1000 /* Frame is odd lengthed */
461 1.2 thorpej #define RS_BADCRC 0x2000 /* Frame had CRC error */
462 1.2 thorpej #define RS_ALGNERR 0x8000 /* Frame had alignment error */
463 1.2 thorpej #define RS_ERRORS (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT)
464 1.2 thorpej
465 1.2 thorpej #define RLEN_MASK 0x07ff /* Significant length bits in RX length */
466 1.2 thorpej
467 1.2 thorpej /*
468 1.2 thorpej * The control byte has the following significant bits.
469 1.2 thorpej * For transmit, the CTLB_ODD bit specifies whether an extra byte
470 1.2 thorpej * is present in the frame. Bit 0 of the byte count field is
471 1.2 thorpej * ignored. I just pad every frame to even length and forget about
472 1.2 thorpej * it.
473 1.2 thorpej */
474 1.2 thorpej #define CTLB_CRC 0x10 /* Add CRC for this packet (TX only) */
475 1.2 thorpej #define CTLB_ODD 0x20 /* The packet length is ODD */
476