if_xereg.h revision 47136
1/*-
2 * Copyright (c) 1998, 1999 Scott Mitchell
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 *	$Id: if_xereg.h,v 1.3 1999/02/22 14:00:53 root Exp $
27 */
28
29/*
30 * Register definitions for Xircom CreditCard Ethernet adapters.  See if_xe.c
31 * for details of supported hardware.  Adapted from Werner Koch's 'xirc2ps'
32 * driver for Linux and the FreeBSD 'xl' driver (for the MII support).
33 */
34
35#include "xe.h"
36#if NXE > 0
37
38
39/*
40 * Common registers
41 */
42#define XE_CR  0	/* Command register (write) */
43#define XE_ESR 0	/* Ethernet status register (read) */
44#define XE_PSR 1	/* Page select register */
45#define XE_EDP 4	/* Ethernet data port */
46#define XE_ISR 6	/* Interrupt status register */
47
48/*
49 * Command register values
50 */
51#define XE_CR_TX_PACKET     0x01
52#define XE_CR_SOFT_RESET    0x02
53#define XE_CR_ENABLE_INTR   0x04
54#define XE_CR_FORCE_INTR    0x08
55#define XE_CR_CLEAR_FIFO    0x10
56#define XE_CR_CLEAR_OVERRUN 0x20
57#define XE_CR_RESTART_TX    0x40
58
59/*
60 * Status register values
61 */
62#define XE_ESR_FULL_PKT_RX  0x01
63#define XE_ESR_PKT_REJECT   0x04
64#define XE_ESR_TX_PENDING   0x08
65#define XE_ESR_BAD_POLARITY 0x10
66#define XE_ESR_MEDIA_SELECT 0x20
67
68/*
69 * Interrupt register values
70 */
71#define XE_ISR_TX_OVERFLOW 0x01
72#define XE_ISR_TX_PACKET   0x02
73#define XE_ISR_MAC_INTR    0x04
74#define XE_ISR_TX_RES      0x08
75#define XE_ISR_RX_PACKET   0x20
76#define XE_ISR_RX_REJECT   0x40
77#define XE_ISR_FORCE_INTR  0x80
78
79
80/*
81 * Page 0 registers
82 */
83#define XE_TSO 8	/* Transmit space open */
84#define XE_TRS 10	/* Transmit reservation size */
85#define XE_DOR 12	/* Data offset register (write) */
86#define XE_RSR 12	/* Receive status register (read) */
87#define XE_PTR 13	/* Packets transmitted register (read) */
88#define XE_RBC 14	/* Received byte count (read) */
89
90/*
91 * RSR values
92 */
93#define XE_RSR_PHYS_PKT  0x01
94#define XE_RSR_BCAST_PKT 0x02
95#define XE_RSR_LONG_PKT  0x04
96#define XE_RSR_ALIGN_ERR 0x10
97#define XE_RSR_CRC_ERR   0x20
98#define XE_RSR_RX_OK     0x80
99
100
101/*
102 * Page 1 registers
103 */
104#define XE_IMR0 12	/* Interrupt mask register, part 1 */
105#define XE_IMR1 13	/* Interrupt mask register, part 2 */
106#define XE_ECR  14	/* Ethernet configuration register */
107
108/*
109 * ECR values
110 */
111#define XE_ECR_FULL_DUPLEX  0x04
112#define XE_ECR_LONG_TPCABLE 0x08
113#define XE_ECR_NO_POLCOL    0x10
114#define XE_ECR_NO_LINKPULSE 0x20
115#define XE_ECR_NO_AUTOTX    0x40
116
117
118/*
119 * Page 2 registers
120 */
121#define XE_RBS  8	/* Receive buffer start */
122#define XE_LED  10	/* LED configuration register */
123#define XE_MSR  12	/* Mohawk specfic register (Mohawk = CE3) */
124#define XE_GPR2 13	/* General purpose register 2 */
125
126
127/*
128 * Page 4 registers
129 */
130#define XE_GPR0 8	/* General purpose register 0 */
131#define XE_GPR1 9	/* General purpose register 1 */
132#define XE_BOV  10	/* Bonding version register */
133#define XE_LMA  12	/* Local memory address */
134#define XE_LMD  14	/* Local memory data */
135
136
137/*
138 * Page 5 registers
139 */
140#define XE_RHS 10	/* Receive host start address */
141
142
143/*
144 * Page 0x40 registers
145 */
146#define XE_OCR  8	/* The Other command register */
147#define XE_RXS0 9	/* Receive status 0 */
148#define XE_TXS0 11	/* Transmit status 0 */
149#define XE_TXS1 12	/* Transmit status 1 */
150#define XE_RXM0 13	/* Receive mask register 0 */
151#define XE_TXM0 14      /* Transmit mask register 0 */
152#define XE_TXM1 15	/* Transmit mask register 1 */
153
154/*
155 * OCR values
156 */
157#define XE_OCR_TX         0x01
158#define XE_OCR_RX_ENABLE  0x04
159#define XE_OCR_RX_DISABLE 0x08
160#define XE_OCR_ABORT      0x10
161#define XE_OCR_ONLINE     0x20
162#define XE_OCR_ACK_INTR   0x40
163#define XE_OCR_OFFLINE    0x80
164
165
166/*
167 * Page 0x42 registers
168 */
169#define XE_SWC0 8	/* Software configuration register 0 */
170#define XE_SWC1 9	/* Software configuration register 1 */
171#define XE_BOC  10	/* Back-off configuration */
172
173
174/*
175 * Page 0x44 registers
176 */
177#define XE_TDR0 8	/* Time domain reflectometry register 0 */
178#define XE_TDR1 9	/* Time domain reflectometry register 1 */
179#define XE_RXC0 10	/* Receive byte count low */
180#define XE_RXC1 11	/* Receive byte count high */
181
182
183/*
184 * Page 0x45 registers
185 */
186#define XE_REV  15	/* Revision (read) */
187
188
189/*
190 * Page 0x50 registers
191 */
192#define XE_IAR  8	/* Individual address register */
193
194
195/*
196 * Pages 0x43, 0x46-0x4f and 0x51-0x5e apparently don't exist.
197 * The remainder of 0x0-0x8 and 0x40-0x5f exist, but I have no
198 * idea what's on most of them.
199 */
200
201
202
203/*
204 * Definitions for the Micro Linear ML6692 100Base-TX PHY, which handles the
205 * 100Mbit functionality of CE3 type cards, including media autonegotiation.
206 * It appears to be mostly compatible with the National Semiconductor
207 * DP83840A, but with a much smaller register set.  Please refer to the data
208 * sheets for these devices for the definitive word on what all this stuff
209 * means :)
210 *
211 * Note that the ML6692 has no 10Mbit capability -- that is handled by another
212 * chip that we don't know anything about.
213 *
214 * Most of these definitions were adapted from the xl driver.
215 */
216
217/*
218 * Masks for the MII-related bits in GPR2.  For some reason read and write
219 * data are on separate bits.
220 */
221#define XE_MII_CLK	0x01
222#define XE_MII_DIR	0x08
223#define XE_MII_WRD	0x02
224#define XE_MII_RDD	0x20
225
226/*
227 * MII command (etc) bit strings.
228 */
229#define XE_MII_STARTDELIM	0x01
230#define XE_MII_READOP		0x02
231#define XE_MII_WRITEOP		0x01
232#define XE_MII_TURNAROUND	0x02
233
234/*
235 * PHY registers.
236 */
237#define PHY_BMCR		0x00	/* Basic Mode Control Register */
238#define PHY_BMSR		0x01	/* Basic Mode Status Register */
239#define PHY_ANAR		0x04	/* Auto-Negotiation Advertisment Register */
240#define PHY_LPAR		0x05	/* Auto-Negotiation Link Partner Ability Register */
241#define PHY_ANER		0x06	/* Auto-Negotiation Expansion Register */
242
243#define PHY_BMCR_RESET		0x8000	/* Soft reset PHY.  Self-clearing */
244#define PHY_BMCR_LOOPBK		0x4000	/* Enable loopback */
245#define PHY_BMCR_SPEEDSEL	0x2000	/* 1=100Mbps, 0=10Mbps */
246#define PHY_BMCR_AUTONEGENBL	0x1000	/* Auto-negotiation enabled */
247#define PHY_BMCR_ISOLATE	0x0400	/* Isolate ML6692 from MII */
248#define PHY_BMCR_AUTONEGRSTR	0x0200	/* Restart auto-negotiation.  Self-clearing */
249#define PHY_BMCR_DUPLEX		0x0100	/* Full duplex operation */
250#define PHY_BMCR_COLLTEST	0x0080	/* Enable collision test */
251
252#define PHY_BMSR_100BT4		0x8000	/* 100Base-T4 capable */
253#define PHY_BMSR_100BTXFULL	0x4000	/* 100Base-TX full duplex capable */
254#define PHY_BMSR_100BTXHALF	0x2000	/* 100Base-TX half duplex capable */
255#define PHY_BMSR_10BTFULL	0x1000	/* 10Base-T full duplex capable */
256#define PHY_BMSR_10BTHALF	0x0800	/* 10Base-T half duplex capable */
257#define PHY_BMSR_AUTONEGCOMP	0x0020	/* Auto-negotiation complete */
258#define PHY_BMSR_CANAUTONEG	0x0008	/* Auto-negotiation supported */
259#define PHY_BMSR_LINKSTAT	0x0004	/* Link is up */
260#define PHY_BMSR_EXTENDED	0x0001	/* Extended register capabilities */
261
262#define PHY_ANAR_NEXTPAGE	0x8000	/* Additional link code word pages */
263#define PHY_ANAR_TLRFLT		0x2000	/* Remote wire fault detected */
264#define PHY_ANAR_100BT4		0x0200	/* 100Base-T4 capable */
265#define PHY_ANAR_100BTXFULL	0x0100	/* 100Base-TX full duplex capable */
266#define PHY_ANAR_100BTXHALF	0x0080	/* 100Base-TX half duplex capable */
267#define PHY_ANAR_10BTFULL	0x0040	/* 10Base-T full duplex capable */
268#define PHY_ANAR_10BTHALF	0x0020	/* 10Base-T half duplex capable */
269#define PHY_ANAR_PROTO4		0x0010	/* Protocol selection (00001 = 802.3) */
270#define PHY_ANAR_PROTO3		0x0008
271#define PHY_ANAR_PROTO2		0x0004
272#define PHY_ANAR_PROTO1		0x0002
273#define PHY_ANAR_PROTO0		0x0001
274
275#define PHY_LPAR_NEXTPAGE	0x8000	/* Additional link code word pages */
276#define PHY_LPAR_LPACK		0x4000	/* Link partner acknowledged receipt */
277#define PHY_LPAR_TLRFLT		0x2000	/* Remote wire fault detected */
278#define PHY_LPAR_100BT4		0x0200	/* 100Base-T4 capable */
279#define PHY_LPAR_100BTXFULL	0x0100	/* 100Base-TX full duplex capable */
280#define PHY_LPAR_100BTXHALF	0x0080	/* 100Base-TX half duplex capable */
281#define PHY_LPAR_10BTFULL	0x0040	/* 10Base-T full duplex capable */
282#define PHY_LPAR_10BTHALF	0x0020	/* 10Base-T half duplex capable */
283#define PHY_LPAR_PROTO4		0x0010	/* Protocol selection (00001 = 802.3) */
284#define PHY_LPAR_PROTO3		0x0008
285#define PHY_LPAR_PROTO2		0x0004
286#define PHY_LPAR_PROTO1		0x0002
287#define PHY_LPAR_PROTO0		0x0001
288
289#define PHY_ANER_MLFAULT	0x0010	/* More than one link is up! */
290#define PHY_ANER_LPNPABLE	0x0008	/* Link partner supports next page */
291#define PHY_ANER_NPABLE		0x0004	/* Local port supports next page */
292#define PHY_ANER_PAGERX		0x0002	/* Page received */
293#define PHY_ANER_LPAUTONEG	0x0001	/* Link partner can auto-negotiate */
294
295
296#endif /* NXE > 0 */
297