Home | History | Annotate | Line # | Download | only in ic
tulipreg.h revision 1.24
      1  1.24      wiz /*	$NetBSD: tulipreg.h,v 1.24 2001/06/11 01:19:54 wiz Exp $	*/
      2   1.1  thorpej 
      3   1.1  thorpej /*-
      4  1.20  thorpej  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
      5   1.1  thorpej  * All rights reserved.
      6   1.1  thorpej  *
      7   1.1  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1  thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9   1.1  thorpej  * NASA Ames Research Center.
     10   1.1  thorpej  *
     11   1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     12   1.1  thorpej  * modification, are permitted provided that the following conditions
     13   1.1  thorpej  * are met:
     14   1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     15   1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     16   1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17   1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     18   1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     19   1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     20   1.1  thorpej  *    must display the following acknowledgement:
     21   1.1  thorpej  *	This product includes software developed by the NetBSD
     22   1.1  thorpej  *	Foundation, Inc. and its contributors.
     23   1.1  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24   1.1  thorpej  *    contributors may be used to endorse or promote products derived
     25   1.1  thorpej  *    from this software without specific prior written permission.
     26   1.1  thorpej  *
     27   1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28   1.1  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29   1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30   1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31   1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32   1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33   1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34   1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35   1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36   1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37   1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     38   1.1  thorpej  */
     39   1.1  thorpej 
     40   1.1  thorpej #ifndef _DEV_IC_TULIPREG_H_
     41   1.1  thorpej #define	_DEV_IC_TULIPREG_H_
     42   1.1  thorpej 
     43   1.1  thorpej /*
     44   1.1  thorpej  * Register description for the Digital Semiconductor ``Tulip'' (21x4x)
     45   1.1  thorpej  * Ethernet controller family, and a variety of clone chips, including:
     46   1.1  thorpej  *
     47   1.1  thorpej  *	- Macronix 98713, 98713A, 98715, 98715A, 98725 (PMAC):
     48   1.1  thorpej  *
     49   1.1  thorpej  *	  These chips are fairly straight-forward Tulip clones.
     50  1.11  thorpej  *	  The 98713 is a very close 21140A clone.  It has GPR
     51  1.11  thorpej  *	  and MII media, and a GPIO facility, and uses the ISV
     52  1.11  thorpej  *	  SROM format (or, at least, should, because of the GPIO
     53  1.11  thorpej  *	  facility).  The 98713A has MII, no GPIO facility, and
     54  1.11  thorpej  *	  an internal NWay block.  The 98715, 98715A, and 98725
     55  1.11  thorpej  *	  have only GPR media and the NWay block.  The 98715,
     56  1.11  thorpej  *	  98715A, and 98725 support power management.
     57  1.11  thorpej  *
     58  1.21   castor  *        The 98715AEC adds 802.3x flow Frame based Flow Control to the
     59  1.21   castor  *	  98715A.
     60  1.21   castor  *
     61  1.11  thorpej  *	- Lite-On 82C115 (PNIC II):
     62  1.11  thorpej  *
     63  1.11  thorpej  *	  A clone of the Macronix MX98725, with the following differences:
     64  1.11  thorpej  *
     65  1.11  thorpej  *		- Wake-On-LAN support
     66  1.11  thorpej  *		- 128-bit multicast hash table rather than the
     67  1.11  thorpej  *		  standard 512-bit hash table
     68  1.11  thorpej  *		- 802.3x flow control
     69   1.1  thorpej  *
     70   1.1  thorpej  *	- Lite-On 82C168, 82C169 (PNIC):
     71   1.1  thorpej  *
     72  1.11  thorpej  *	  Pretty close, with only a few minor differences:
     73  1.11  thorpej  *
     74  1.11  thorpej  *		- EEPROM is accessed completely differently.
     75  1.11  thorpej  *		- MII is accessed completely differently.
     76  1.11  thorpej  *		- No SIO facility (due to the above two differences).
     77  1.11  thorpej  *		- GPIO interface is different than the 21140's.
     78  1.11  thorpej  *		- Boards that lack PHYs use the internal NWay block
     79  1.24      wiz  *		  and transceiver.
     80   1.1  thorpej  *
     81   1.1  thorpej  *	- Winbond 89C840F
     82   1.1  thorpej  *
     83  1.11  thorpej  *	  Less similar, but still roughly compatible (enough so
     84  1.11  thorpej  *	  that the driver can be adapted, at least):
     85  1.11  thorpej  *
     86  1.11  thorpej  *		- Registers lack the pad word between them.
     87  1.11  thorpej  *		- Instead of a setup frame, there are two station
     88  1.11  thorpej  *		  address registers and two multicast hash table
     89  1.11  thorpej  *		  registers (64-bit multicast hash table).
     90  1.11  thorpej  *		- Only supported media interface is MII-over-SIO.
     91  1.11  thorpej  *		- Different OPMODE register bits for various things
     92  1.11  thorpej  *		  (mostly media related).
     93   1.1  thorpej  *
     94  1.10  thorpej  *	- ADMtek AL981
     95  1.10  thorpej  *
     96  1.11  thorpej  *	  Another pretty-close clone:
     97  1.11  thorpej  *
     98  1.11  thorpej  *		- Wake-On-LAN support
     99  1.11  thorpej  *		- Instead of a setup frame, there are two station
    100  1.11  thorpej  *		  address registers and two multicast hash table
    101  1.11  thorpej  *		  registers (64-bit multicast hash table).
    102  1.11  thorpej  *		- 802.3x flow control
    103  1.11  thorpej  *		- Only supported media interface is built-in PHY
    104  1.11  thorpej  *		  which is accessed through a set of special registers.
    105  1.11  thorpej  *		- Not all registers have the pad word between them,
    106  1.11  thorpej  *		  but luckily, there are all AL981-specific registers,
    107  1.11  thorpej  *		  so this is easy to deal with.
    108  1.10  thorpej  *
    109  1.23  thorpej  *	- ADMtek AN983 and AN985
    110  1.23  thorpej  *
    111  1.23  thorpej  *	  Similar to the ADMtek AL981, but with a few differences.
    112  1.23  thorpej  *
    113  1.18  thorpej  *	- Xircom X3201-3
    114  1.18  thorpej  *
    115  1.18  thorpej  *	  CardBus 21143 clone, with a few differences:
    116  1.18  thorpej  *
    117  1.18  thorpej  *		- No MicroWire SROM; Ethernet address must come
    118  1.18  thorpej  *		  from CIS.
    119  1.18  thorpej  *		- Transmit buffers must also be 32-bit aligned.
    120  1.18  thorpej  *		- The BUSMODE_SWR bit is not self-clearing.
    121  1.19  thorpej  *		- Must include FS|LS in setup packet descriptor.
    122  1.18  thorpej  *		- SIA is not 21143-like, and all media attachments
    123  1.18  thorpej  *		  are MII-on-SIO.
    124  1.18  thorpej  *
    125  1.20  thorpej  *	- Davicom DM9102 and DM9102A
    126  1.20  thorpej  *
    127  1.20  thorpej  *	  Pretty similar to the 21140A, with a few differences:
    128  1.20  thorpej  *
    129  1.20  thorpej  *		- Wake-On-LAN support
    130  1.20  thorpej  *		- DM9102 has built-in 10/100 PHY on MII interface.
    131  1.20  thorpej  *		- DM9102A has built-in 10/100 PHY on MII interface,
    132  1.20  thorpej  *		  as well as a HomePNA 1 PHY on an alternate MII
    133  1.20  thorpej  *		  interface (selected by clearing OPMODE_PS).
    134  1.20  thorpej  *		- The chip has a bug in the transmit DMA logic,
    135  1.20  thorpej  *		  requiring that the packet be comprised of only
    136  1.20  thorpej  *		  one DMA segment.
    137  1.20  thorpej  *		- The bus interface is buggy, and the BUSMODE register
    138  1.20  thorpej  *		  must be initialized to 0.
    139  1.20  thorpej  *		- There seems to be an interrupt logic bug, requiring
    140  1.20  thorpej  *		  that interrupts be disabled on the chip during the
    141  1.20  thorpej  *		  interrupt handler.
    142  1.20  thorpej  *
    143   1.1  thorpej  * Some of the clone chips have different registers, and some have
    144   1.1  thorpej  * different bits in the same registers.  These will be denoted by
    145  1.20  thorpej  * PMAC, PNICII, PNIC, DM, WINB, and ADM in the register/bit names.
    146   1.1  thorpej  */
    147   1.1  thorpej 
    148   1.1  thorpej /*
    149   1.1  thorpej  * Tulip buffer descriptor.  Must be 4-byte aligned.
    150   1.1  thorpej  *
    151   1.1  thorpej  * Note for receive descriptors, the byte count fields must
    152   1.1  thorpej  * be a multiple of 4.
    153   1.1  thorpej  */
    154   1.1  thorpej struct tulip_desc {
    155   1.1  thorpej 	__volatile u_int32_t td_status;	  /* Status */
    156   1.1  thorpej 	__volatile u_int32_t td_ctl;	  /* Control and Byte Counts */
    157   1.1  thorpej 	__volatile u_int32_t td_bufaddr1; /* Buffer Address 1 */
    158   1.1  thorpej 	__volatile u_int32_t td_bufaddr2; /* Buffer Address 2 */
    159   1.1  thorpej };
    160   1.1  thorpej 
    161   1.1  thorpej /*
    162   1.1  thorpej  * Descriptor Status bits common to transmit and receive.
    163   1.1  thorpej  */
    164   1.1  thorpej #define	TDSTAT_OWN	0x80000000	/* Tulip owns descriptor */
    165   1.1  thorpej #define	TDSTAT_ES	0x00008000	/* Error Summary */
    166   1.1  thorpej 
    167   1.1  thorpej /*
    168   1.1  thorpej  * Descriptor Status bits for Receive Descriptor.
    169   1.1  thorpej  */
    170   1.1  thorpej #define	TDSTAT_Rx_FF	0x40000000	/* Filtering Fail */
    171   1.2  thorpej #define	TDSTAT_WINB_Rx_RCMP 0x40000000	/* Receive Complete */
    172   1.1  thorpej #define	TDSTAT_Rx_FL	0x3fff0000	/* Frame Length including CRC */
    173   1.1  thorpej #define	TDSTAT_Rx_DE	0x00004000	/* Descriptor Error */
    174   1.1  thorpej #define	TDSTAT_Rx_DT	0x00003000	/* Data Type */
    175   1.1  thorpej #define	TDSTAT_Rx_RF	0x00000800	/* Runt Frame */
    176   1.1  thorpej #define	TDSTAT_Rx_MF	0x00000400	/* Multicast Frame */
    177   1.1  thorpej #define	TDSTAT_Rx_FS	0x00000200	/* First Descriptor */
    178   1.1  thorpej #define	TDSTAT_Rx_LS	0x00000100	/* Last Descriptor */
    179   1.1  thorpej #define	TDSTAT_Rx_TL	0x00000080	/* Frame Too Long */
    180   1.1  thorpej #define	TDSTAT_Rx_CS	0x00000040	/* Collision Seen */
    181   1.1  thorpej #define	TDSTAT_Rx_RT	0x00000020	/* Frame Type */
    182   1.1  thorpej #define	TDSTAT_Rx_RW	0x00000010	/* Receive Watchdog */
    183   1.1  thorpej #define	TDSTAT_Rx_RE	0x00000008	/* Report on MII Error */
    184   1.1  thorpej #define	TDSTAT_Rx_DB	0x00000004	/* Dribbling Bit */
    185   1.1  thorpej #define	TDSTAT_Rx_CE	0x00000002	/* CRC Error */
    186   1.1  thorpej #define	TDSTAT_Rx_ZER	0x00000001	/* Zero (always 0) */
    187   1.1  thorpej 
    188   1.1  thorpej #define	TDSTAT_Rx_LENGTH(x)	(((x) & TDSTAT_Rx_FL) >> 16)
    189   1.1  thorpej 
    190   1.1  thorpej #define	TDSTAT_Rx_DT_SR	0x00000000	/* Serial Received Frame */
    191   1.1  thorpej #define	TDSTAT_Rx_DT_IL	0x00001000	/* Internal Loopback Frame */
    192   1.1  thorpej #define	TDSTAT_Rx_DT_EL	0x00002000	/* External Loopback Frame */
    193   1.1  thorpej #define	TDSTAT_Rx_DT_r	0x00003000	/* Reserved */
    194   1.1  thorpej 
    195   1.1  thorpej /*
    196   1.1  thorpej  * Descriptor Status bits for Transmit Descriptor.
    197   1.1  thorpej  */
    198   1.2  thorpej #define	TDSTAT_WINB_Tx_TE 0x00008000	/* Transmit Error */
    199   1.1  thorpej #define	TDSTAT_Tx_TO	0x00004000	/* Transmit Jabber Timeout */
    200   1.1  thorpej #define	TDSTAT_Tx_LO	0x00000800	/* Loss of Carrier */
    201   1.1  thorpej #define	TDSTAT_Tx_NC	0x00000400	/* No Carrier */
    202   1.1  thorpej #define	TDSTAT_Tx_LC	0x00000200	/* Late Collision */
    203   1.1  thorpej #define	TDSTAT_Tx_EC	0x00000100	/* Excessive Collisions */
    204   1.1  thorpej #define	TDSTAT_Tx_HF	0x00000080	/* Heartbeat Fail */
    205   1.1  thorpej #define	TDSTAT_Tx_CC	0x00000078	/* Collision Count */
    206   1.1  thorpej #define	TDSTAT_Tx_LF	0x00000004	/* Link Fail */
    207   1.1  thorpej #define	TDSTAT_Tx_UF	0x00000002	/* Underflow Error */
    208   1.1  thorpej #define	TDSTAT_Tx_DE	0x00000001	/* Deferred */
    209   1.1  thorpej 
    210   1.1  thorpej #define	TDSTAT_Tx_COLLISIONS(x)	(((x) & TDSTAT_Tx_CC) >> 3)
    211   1.1  thorpej 
    212   1.1  thorpej /*
    213   1.1  thorpej  * Descriptor Control bits common to transmit and receive.
    214   1.1  thorpej  */
    215   1.1  thorpej #define	TDCTL_SIZE1	0x000007ff	/* Size of buffer 1 */
    216   1.1  thorpej #define	TDCTL_SIZE1_SHIFT 0
    217   1.1  thorpej 
    218   1.1  thorpej #define	TDCTL_SIZE2	0x003ff800	/* Size of buffer 2 */
    219   1.1  thorpej #define	TDCTL_SIZE2_SHIFT 11
    220   1.1  thorpej 
    221   1.1  thorpej #define	TDCTL_ER	0x02000000	/* End of Ring */
    222   1.1  thorpej #define	TDCTL_CH	0x01000000	/* Second Address Chained */
    223   1.1  thorpej 
    224   1.1  thorpej /*
    225   1.1  thorpej  * Descriptor Control bits for Transmit Descriptor.
    226   1.1  thorpej  */
    227   1.1  thorpej #define	TDCTL_Tx_IC	0x80000000	/* Interrupt on Completion */
    228   1.1  thorpej #define	TDCTL_Tx_LS	0x40000000	/* Last Segment */
    229   1.1  thorpej #define	TDCTL_Tx_FS	0x20000000	/* First Segment */
    230   1.1  thorpej #define	TDCTL_Tx_FT1	0x10000000	/* Filtering Type 1 */
    231   1.1  thorpej #define	TDCTL_Tx_SET	0x08000000	/* Setup Packet */
    232   1.1  thorpej #define	TDCTL_Tx_AC	0x04000000	/* Add CRC Disable */
    233   1.1  thorpej #define	TDCTL_Tx_DPD	0x00800000	/* Disabled Padding */
    234   1.1  thorpej #define	TDCTL_Tx_FT0	0x00400000	/* Filtering Type 0 */
    235   1.1  thorpej 
    236   1.1  thorpej /*
    237   1.1  thorpej  * The Tulip filter is programmed by "transmitting" a Setup Packet
    238   1.1  thorpej  * (indicated by TDCTL_Tx_SET).  The filtering type is indicated
    239   1.1  thorpej  * as follows:
    240   1.1  thorpej  *
    241   1.1  thorpej  *	FT1	FT0	Description
    242   1.1  thorpej  *	---	---	-----------
    243   1.1  thorpej  *	0	0	Perfect Filtering: The Tulip interprets the
    244   1.1  thorpej  *			descriptor buffer as a table of 16 MAC addresses
    245   1.1  thorpej  *			that the Tulip should receive.
    246   1.1  thorpej  *
    247   1.1  thorpej  *	0	1	Hash Filtering: The Tulip interprets the
    248   1.1  thorpej  *			descriptor buffer as a 512-bit hash table
    249   1.1  thorpej  *			plus one perfect address.  If the incoming
    250   1.1  thorpej  *			address is Multicast, the hash table filters
    251   1.1  thorpej  *			the address, else the address is filtered by
    252   1.1  thorpej  *			the perfect address.
    253   1.1  thorpej  *
    254   1.1  thorpej  *	1	0	Inverse Filtering: Like Perfect Filtering, except
    255   1.1  thorpej  *			the table is addresses that the Tulip does NOT
    256   1.1  thorpej  *			receive.
    257   1.1  thorpej  *
    258   1.1  thorpej  *	1	1	Hash-only Filtering: Like Hash Filtering, but
    259   1.1  thorpej  *			physical addresses are matched by the hash table
    260   1.1  thorpej  *			as well, and not by matching a single perfect
    261   1.1  thorpej  *			address.
    262   1.1  thorpej  *
    263   1.1  thorpej  * A Setup Packet must always be 192 bytes long.  The Tulip can store
    264   1.1  thorpej  * 16 MAC addresses.  If not all 16 are specified in Perfect Filtering
    265   1.1  thorpej  * or Inverse Filtering mode, then unused entries should duplicate
    266   1.1  thorpej  * one of the valid entries.
    267   1.1  thorpej  */
    268   1.1  thorpej #define	TDCTL_Tx_FT_PERFECT	0
    269   1.1  thorpej #define	TDCTL_Tx_FT_HASH	TDCTL_Tx_FT0
    270   1.1  thorpej #define	TDCTL_Tx_FT_INVERSE	TDCTL_Tx_FT1
    271   1.1  thorpej #define	TDCTL_Tx_FT_HASHONLY	(TDCTL_Tx_FT1|TDCTL_Tx_FT0)
    272   1.1  thorpej 
    273   1.1  thorpej #define	TULIP_SETUP_PACKET_LEN	192
    274   1.1  thorpej #define	TULIP_MAXADDRS		16
    275   1.1  thorpej #define	TULIP_MCHASHSIZE	512
    276  1.11  thorpej #define	TULIP_PNICII_HASHSIZE	128
    277   1.1  thorpej 
    278   1.1  thorpej /*
    279   1.1  thorpej  * Maximum size of a Tulip Ethernet Address ROM or SROM.
    280   1.1  thorpej  */
    281  1.13  thorpej #define	TULIP_ROM_SIZE(bits)	(2 << (bits))
    282  1.13  thorpej #define	TULIP_MAX_ROM_SIZE	512
    283   1.1  thorpej 
    284   1.1  thorpej /*
    285   1.4  thorpej  * Format of the standard Tulip SROM information:
    286   1.4  thorpej  *
    287   1.4  thorpej  *	Byte offset	Size	Usage
    288   1.4  thorpej  *	0		18	reserved
    289   1.4  thorpej  *	18		1	SROM Format Version
    290   1.4  thorpej  *	19		1	Chip Count
    291   1.4  thorpej  *	20		6	IEEE Network Address
    292   1.4  thorpej  *	26		1	Chip 0 Device Number
    293   1.4  thorpej  *	27		2	Chip 0 Info Leaf Offset
    294   1.4  thorpej  *	29		1	Chip 1 Device Number
    295   1.4  thorpej  *	30		2	Chip 1 Info Leaf Offset
    296   1.4  thorpej  *	32		1	Chip 2 Device Number
    297   1.4  thorpej  *	33		2	Chip 2 Info Leaf Offset
    298   1.4  thorpej  *	...		1	Chip n Device Number
    299   1.4  thorpej  *	...		2	Chip n Info Leaf Offset
    300   1.4  thorpej  *	...		...	...
    301   1.4  thorpej  *	Chip Info Leaf Information
    302   1.4  thorpej  *	...
    303   1.4  thorpej  *	...
    304   1.4  thorpej  *	...
    305   1.4  thorpej  *	126		2	CRC32 checksum
    306   1.4  thorpej  */
    307   1.4  thorpej #define	TULIP_ROM_SROM_FORMAT_VERION		18		/* B */
    308   1.4  thorpej #define	TULIP_ROM_CHIP_COUNT			19		/* B */
    309   1.4  thorpej #define	TULIP_ROM_IEEE_NETWORK_ADDRESS		20
    310   1.6  thorpej #define	TULIP_ROM_CHIPn_DEVICE_NUMBER(n)	(26 + ((n) * 3))/* B */
    311   1.4  thorpej #define	TULIP_ROM_CHIPn_INFO_LEAF_OFFSET(n)	(27 + ((n) * 3))/* W */
    312   1.4  thorpej #define	TULIP_ROM_CRC32_CHECKSUM		126		/* W */
    313  1.14  thorpej #define	TULIP_ROM_CRC32_CHECKSUM1		94		/* W */
    314   1.4  thorpej 
    315   1.4  thorpej #define	TULIP_ROM_IL_SELECT_CONN_TYPE		0		/* W */
    316   1.4  thorpej #define	TULIP_ROM_IL_MEDIA_COUNT		2		/* B */
    317   1.4  thorpej #define	TULIP_ROM_IL_MEDIAn_BLOCK_BASE		3
    318   1.4  thorpej 
    319   1.4  thorpej #define	SELECT_CONN_TYPE_TP		0x0000
    320   1.8  thorpej #define	SELECT_CONN_TYPE_BNC		0x0001
    321   1.8  thorpej #define	SELECT_CONN_TYPE_AUI		0x0002
    322   1.8  thorpej #define	SELECT_CONN_TYPE_100TX		0x0003
    323   1.8  thorpej #define	SELECT_CONN_TYPE_100T4		0x0006
    324   1.8  thorpej #define	SELECT_CONN_TYPE_100FX		0x0007
    325   1.8  thorpej #define	SELECT_CONN_TYPE MII_10T	0x0009
    326   1.8  thorpej #define	SELECT_CONN_TYPE_MII_100TX	0x000d
    327   1.8  thorpej #define	SELECT_CONN_TYPE_MII_100T4	0x000f
    328   1.8  thorpej #define	SELECT_CONN_TYPE_MII_100FX	0x0010
    329   1.4  thorpej #define	SELECT_CONN_TYPE_TP_AUTONEG	0x0100
    330   1.4  thorpej #define	SELECT_CONN_TYPE_TP_FDX		0x0204
    331   1.8  thorpej #define	SELECT_CONN_TYPE_MII_10T_FDX	0x020a
    332   1.8  thorpej #define	SELECT_CONN_TYPE_100TX_FDX	0x020e
    333   1.8  thorpej #define	SELECT_CONN_TYPE_MII_100TX_FDX	0x0211
    334   1.4  thorpej #define	SELECT_CONN_TYPE_TP_NOLINKPASS	0x0400
    335   1.4  thorpej #define	SELECT_CONN_TYPE_ASENSE		0x0800
    336   1.8  thorpej #define	SELECT_CONN_TYPE_ASENSE_POWERUP	0x8800
    337   1.4  thorpej #define	SELECT_CONN_TYPE_ASENSE_AUTONEG	0x0900
    338   1.4  thorpej 
    339   1.4  thorpej #define	TULIP_ROM_MB_MEDIA_CODE		0x3f
    340   1.4  thorpej #define	TULIP_ROM_MB_MEDIA_TP		0x00
    341   1.4  thorpej #define	TULIP_ROM_MB_MEDIA_BNC		0x01
    342   1.4  thorpej #define	TULIP_ROM_MB_MEDIA_AUI		0x02
    343   1.8  thorpej #define	TULIP_ROM_MB_MEDIA_100TX	0x03
    344   1.4  thorpej #define	TULIP_ROM_MB_MEDIA_TP_FDX	0x04
    345   1.8  thorpej #define	TULIP_ROM_MB_MEDIA_100TX_FDX	0x05
    346   1.8  thorpej #define	TULIP_ROM_MB_MEDIA_100T4	0x06
    347   1.8  thorpej #define	TULIP_ROM_MB_MEDIA_100FX	0x07
    348   1.8  thorpej #define	TULIP_ROM_MB_MEDIA_100FX_FDX	0x08
    349   1.4  thorpej 
    350   1.4  thorpej #define	TULIP_ROM_MB_EXT		0x40
    351   1.4  thorpej 
    352   1.4  thorpej #define	TULIP_ROM_MB_CSR13		1			/* W */
    353   1.4  thorpej #define	TULIP_ROM_MB_CSR14		3			/* W */
    354   1.4  thorpej #define	TULIP_ROM_MB_CSR15		5			/* W */
    355   1.4  thorpej 
    356   1.4  thorpej #define	TULIP_ROM_MB_SIZE(mc)		(((mc) & TULIP_ROM_MB_EXT) ? 7 : 1)
    357   1.7  thorpej 
    358   1.8  thorpej #define	TULIP_ROM_MB_NOINDICATOR	0x8000
    359   1.8  thorpej #define	TULIP_ROM_MB_DEFAULT		0x4000
    360   1.8  thorpej #define	TULIP_ROM_MB_POLARITY		0x0080
    361   1.8  thorpej #define	TULIP_ROM_MB_OPMODE(x)		(((x) & 0x71) << 18)
    362   1.8  thorpej #define	TULIP_ROM_MB_BITPOS(x)		(1 << (((x) & 0x0e) >> 1))
    363   1.8  thorpej 
    364   1.7  thorpej #define	TULIP_ROM_MB_21140_GPR		0	/* 21140[A] GPR block */
    365   1.7  thorpej #define	TULIP_ROM_MB_21140_MII		1	/* 21140[A] MII block */
    366   1.7  thorpej #define	TULIP_ROM_MB_21142_SIA		2	/* 2114[23] SIA block */
    367   1.7  thorpej #define	TULIP_ROM_MB_21142_MII		3	/* 2114[23] MII block */
    368   1.7  thorpej #define	TULIP_ROM_MB_21143_SYM		4	/* 21143 SYM block */
    369   1.7  thorpej #define	TULIP_ROM_MB_21143_RESET	5	/* 21143 reset block */
    370   1.4  thorpej 
    371   1.4  thorpej #define	TULIP_ROM_GETW(data, off) ((data)[(off)] | ((data)[(off) + 1]) << 8)
    372   1.4  thorpej 
    373   1.4  thorpej /*
    374   1.1  thorpej  * Tulip control registers.
    375   1.1  thorpej  */
    376   1.1  thorpej 
    377   1.1  thorpej #define	TULIP_CSR0	0x00
    378   1.1  thorpej #define	TULIP_CSR1	0x08
    379   1.1  thorpej #define	TULIP_CSR2	0x10
    380   1.1  thorpej #define	TULIP_CSR3	0x18
    381   1.1  thorpej #define	TULIP_CSR4	0x20
    382   1.1  thorpej #define	TULIP_CSR5	0x28
    383   1.1  thorpej #define	TULIP_CSR6	0x30
    384   1.1  thorpej #define	TULIP_CSR7	0x38
    385   1.1  thorpej #define	TULIP_CSR8	0x40
    386   1.1  thorpej #define	TULIP_CSR9	0x48
    387   1.1  thorpej #define	TULIP_CSR10	0x50
    388   1.1  thorpej #define	TULIP_CSR11	0x58
    389   1.1  thorpej #define	TULIP_CSR12	0x60
    390   1.1  thorpej #define	TULIP_CSR13	0x68
    391   1.1  thorpej #define	TULIP_CSR14	0x70
    392   1.1  thorpej #define	TULIP_CSR15	0x78
    393   1.1  thorpej #define	TULIP_CSR16	0x80
    394   1.1  thorpej #define	TULIP_CSR17	0x88
    395   1.1  thorpej #define	TULIP_CSR18	0x90
    396   1.1  thorpej #define	TULIP_CSR19	0x98
    397   1.1  thorpej #define	TULIP_CSR20	0xa0
    398  1.11  thorpej #define	TULIP_CSR21	0xa8
    399  1.11  thorpej #define	TULIP_CSR22	0xb0
    400  1.11  thorpej #define	TULIP_CSR23	0xb8
    401  1.11  thorpej #define	TULIP_CSR24	0xc0
    402  1.11  thorpej #define	TULIP_CSR25	0xc8
    403  1.11  thorpej #define	TULIP_CSR26	0xd0
    404  1.11  thorpej #define	TULIP_CSR27	0xd8
    405  1.11  thorpej #define	TULIP_CSR28	0xe0
    406  1.11  thorpej #define	TULIP_CSR29	0xe8
    407  1.11  thorpej #define	TULIP_CSR30	0xf0
    408  1.11  thorpej #define	TULIP_CSR31	0xf8
    409   1.5  thorpej 
    410   1.5  thorpej #define	TULIP_CSR_INDEX(csr)	((csr) >> 3)
    411   1.1  thorpej 
    412   1.1  thorpej /* CSR0 - Bus Mode */
    413   1.1  thorpej #define	CSR_BUSMODE		TULIP_CSR0
    414   1.1  thorpej #define	BUSMODE_SWR		0x00000001	/* software reset */
    415   1.1  thorpej #define	BUSMODE_BAR		0x00000002	/* bus arbitration */
    416   1.1  thorpej #define	BUSMODE_DSL		0x0000007c	/* descriptor skip length */
    417   1.1  thorpej #define	BUSMODE_BLE		0x00000080	/* big endian */
    418   1.1  thorpej 						/* programmable burst length */
    419   1.1  thorpej #define	BUSMODE_PBL_DEFAULT	0x00000000	/*     default value */
    420   1.1  thorpej #define	BUSMODE_PBL_1LW		0x00000100	/*     1 longword */
    421   1.1  thorpej #define	BUSMODE_PBL_2LW		0x00000200	/*     2 longwords */
    422   1.1  thorpej #define	BUSMODE_PBL_4LW		0x00000400	/*     4 longwords */
    423   1.1  thorpej #define	BUSMODE_PBL_8LW		0x00000800	/*     8 longwords */
    424   1.1  thorpej #define	BUSMODE_PBL_16LW	0x00001000	/*    16 longwords */
    425   1.1  thorpej #define	BUSMODE_PBL_32LW	0x00002000	/*    32 longwords */
    426   1.1  thorpej 						/* cache alignment */
    427   1.1  thorpej #define	BUSMODE_CAL_NONE	0x00000000	/*     no alignment */
    428   1.1  thorpej #define	BUSMODE_CAL_8LW		0x00004000	/*     8 longwords */
    429   1.1  thorpej #define	BUSMODE_CAL_16LW	0x00008000	/*    16 longwords */
    430   1.1  thorpej #define	BUSMODE_CAL_32LW	0x0000c000	/*    32 longwords */
    431   1.1  thorpej #define	BUSMODE_DAS		0x00010000	/* diagnostic address space */
    432   1.1  thorpej 						/*   must be zero on most */
    433   1.1  thorpej 						/* transmit auto-poll */
    434   1.2  thorpej 		/*
    435   1.2  thorpej 		 * Transmit auto-polling not supported on:
    436   1.2  thorpej 		 *	Winbond 89C040F
    437  1.18  thorpej 		 *	Xircom X3201-3
    438  1.20  thorpej 		 *	Davicom DM9102 (buggy BUSMODE register)
    439   1.2  thorpej 		 */
    440   1.1  thorpej #define	BUSMODE_TAP_NONE	0x00000000	/*     no auto-polling */
    441   1.1  thorpej #define	BUSMODE_TAP_200us	0x00020000	/*   200 uS */
    442   1.1  thorpej #define	BUSMODE_TAP_800us	0x00040000	/*   400 uS */
    443   1.1  thorpej #define	BUSMODE_TAP_1_6ms	0x00060000	/*   1.6 mS */
    444   1.1  thorpej #define	BUSMODE_TAP_12_8us	0x00080000	/*  12.8 uS (21041+) */
    445   1.1  thorpej #define	BUSMODE_TAP_25_6us	0x000a0000	/*  25.6 uS (21041+) */
    446   1.1  thorpej #define	BUSMODE_TAP_51_2us	0x000c0000	/*  51.2 uS (21041+) */
    447   1.1  thorpej #define	BUSMODE_TAP_102_4us	0x000e0000	/* 102.4 uS (21041+) */
    448   1.1  thorpej #define	BUSMODE_DBO		0x00100000	/* desc-only b/e (21041+) */
    449   1.1  thorpej #define	BUSMODE_RME		0x00200000	/* rd/mult enab (21140+) */
    450   1.2  thorpej #define	BUSMODE_WINB_WAIT	0x00200000	/* wait state insertion */
    451   1.1  thorpej #define	BUSMODE_RLE		0x00800000	/* rd/line enab (21140+) */
    452   1.1  thorpej #define	BUSMODE_WLE		0x01000000	/* wt/line enab (21140+) */
    453   1.1  thorpej #define	BUSMODE_PNIC_MBO	0x04000000	/* magic `must be one' bit */
    454   1.1  thorpej 						/*    on Lite-On PNIC */
    455   1.1  thorpej 
    456   1.1  thorpej 
    457   1.1  thorpej /* CSR1 - Transmit Poll Demand */
    458   1.1  thorpej #define	CSR_TXPOLL		TULIP_CSR1
    459   1.1  thorpej #define	TXPOLL_TPD		0x00000001	/* transmit poll demand */
    460   1.1  thorpej 
    461   1.1  thorpej 
    462   1.1  thorpej /* CSR2 - Receive Poll Demand */
    463   1.1  thorpej #define	CSR_RXPOLL		TULIP_CSR2
    464   1.1  thorpej #define	RXPOLL_RPD		0x00000001	/* receive poll demand */
    465   1.1  thorpej 
    466   1.1  thorpej 
    467   1.1  thorpej /* CSR3 - Receive List Base Address */
    468   1.1  thorpej #define	CSR_RXLIST		TULIP_CSR3
    469   1.1  thorpej 
    470   1.1  thorpej /* CSR4 - Transmit List Base Address */
    471   1.1  thorpej #define	CSR_TXLIST		TULIP_CSR4
    472   1.1  thorpej 
    473   1.1  thorpej /* CSR5 - Status */
    474   1.1  thorpej #define	CSR_STATUS		TULIP_CSR5
    475   1.1  thorpej #define	STATUS_TI		0x00000001	/* transmit interrupt */
    476   1.1  thorpej #define	STATUS_TPS		0x00000002	/* transmit process stopped */
    477   1.1  thorpej #define	STATUS_TU		0x00000004	/* transmit buffer unavail */
    478   1.1  thorpej #define	STATUS_TJT		0x00000008	/* transmit jabber timeout */
    479   1.2  thorpej #define	STATUS_WINB_REI		0x00000008	/* receive early interrupt */
    480   1.1  thorpej #define	STATUS_LNPANC		0x00000010	/* link pass (21041) */
    481   1.2  thorpej #define	STATUS_WINB_RERR	0x00000010	/* receive error */
    482   1.1  thorpej #define	STATUS_UNF		0x00000020	/* transmit underflow */
    483   1.1  thorpej #define	STATUS_RI		0x00000040	/* receive interrupt */
    484   1.1  thorpej #define	STATUS_RU		0x00000080	/* receive buffer unavail */
    485   1.1  thorpej #define	STATUS_RPS		0x00000100	/* receive process stopped */
    486   1.1  thorpej #define	STATUS_RWT		0x00000200	/* receive watchdog timeout */
    487   1.1  thorpej #define	STATUS_AT		0x00000400	/* SIA AUI/TP pin changed
    488   1.1  thorpej 						   (21040) */
    489  1.12  thorpej #define	STATUS_ETI		0x00000400	/* early transmit interrupt
    490  1.12  thorpej 						   (21142/PMAC/Winbond) */
    491   1.1  thorpej #define	STATUS_FD		0x00000800	/* full duplex short frame
    492   1.1  thorpej 						   received (21040) */
    493   1.1  thorpej #define	STATUS_TM		0x00000800	/* timer expired (21041) */
    494   1.1  thorpej #define	STATUS_LNF		0x00001000	/* link fail (21040) */
    495   1.1  thorpej #define	STATUS_SE		0x00002000	/* system error */
    496   1.1  thorpej #define	STATUS_ER		0x00004000	/* early receive (21041) */
    497   1.1  thorpej #define	STATUS_AIS		0x00008000	/* abnormal interrupt summary */
    498   1.1  thorpej #define	STATUS_NIS		0x00010000	/* normal interrupt summary */
    499   1.1  thorpej #define	STATUS_RS		0x000e0000	/* receive process state */
    500   1.1  thorpej #define	STATUS_RS_STOPPED	0x00000000	/* Stopped */
    501   1.1  thorpej #define	STATUS_RS_FETCH		0x00020000	/* Running - fetch receive
    502   1.1  thorpej 						   descriptor */
    503   1.1  thorpej #define	STATUS_RS_CHECK		0x00040000	/* Running - check for end
    504   1.1  thorpej 						   of receive */
    505   1.1  thorpej #define	STATUS_RS_WAIT		0x00060000	/* Running - wait for packet */
    506   1.1  thorpej #define	STATUS_RS_SUSPENDED	0x00080000	/* Suspended */
    507   1.1  thorpej #define	STATUS_RS_CLOSE		0x000a0000	/* Running - close receive
    508   1.1  thorpej 						   descriptor */
    509   1.1  thorpej #define	STATUS_RS_FLUSH		0x000c0000	/* Running - flush current
    510   1.1  thorpej 						   frame from FIFO */
    511   1.1  thorpej #define	STATUS_RS_QUEUE		0x000e0000	/* Running - queue current
    512   1.1  thorpej 						   frame from FIFO into
    513   1.1  thorpej 						   buffer */
    514  1.20  thorpej #define	STATUS_DM_RS_STOPPED	0x00000000	/* Stopped */
    515  1.20  thorpej #define	STATUS_DM_RS_FETCH	0x00020000	/* Running - fetch receive
    516  1.20  thorpej 						   descriptor */
    517  1.20  thorpej #define	STATUS_DM_RS_WAIT	0x00040000	/* Running - wait for packet */
    518  1.20  thorpej #define	STATUS_DM_RS_QUEUE	0x00060000	/* Running - queue current
    519  1.20  thorpej 						   frame from FIFO into
    520  1.20  thorpej 						   buffer */
    521  1.20  thorpej #define	STATUS_DM_RS_CLOSE_OWN	0x00080000	/* Running - close receive
    522  1.20  thorpej 						   descriptor, clear own */
    523  1.20  thorpej #define	STATUS_DM_RS_CLOSE_ST	0x000a0000	/* Running - close receive
    524  1.20  thorpej 						   descriptor, write status */
    525  1.20  thorpej #define	STATUS_DM_RS_SUSPENDED	0x000c0000	/* Suspended */
    526  1.20  thorpej #define	STATUS_DM_RS_FLUSH	0x000e0000	/* Running - flush current
    527  1.20  thorpej 						   frame from FIFO */
    528   1.1  thorpej #define	STATUS_TS		0x00700000	/* transmit process state */
    529   1.1  thorpej #define	STATUS_TS_STOPPED	0x00000000	/* Stopped */
    530   1.1  thorpej #define	STATUS_TS_FETCH		0x00100000	/* Running - fetch transmit
    531   1.1  thorpej 						   descriptor */
    532   1.1  thorpej #define	STATUS_TS_WAIT		0x00200000	/* Running - wait for end
    533   1.1  thorpej 						   of transmission */
    534   1.1  thorpej #define	STATUS_TS_READING	0x00300000	/* Running - read buffer from
    535   1.1  thorpej 						   memory and queue into
    536   1.1  thorpej 						   FIFO */
    537   1.1  thorpej #define	STATUS_TS_RESERVED	0x00400000	/* RESERVED */
    538   1.1  thorpej #define	STATUS_TS_SETUP		0x00500000	/* Running - Setup packet */
    539   1.1  thorpej #define	STATUS_TS_SUSPENDED	0x00600000	/* Suspended */
    540   1.1  thorpej #define	STATUS_TS_CLOSE		0x00700000	/* Running - close transmit
    541   1.1  thorpej 						   descriptor */
    542  1.20  thorpej #define	STATUS_DM_TS_STOPPED	0x00000000	/* Stopped */
    543  1.20  thorpej #define	STATUS_DM_TS_FETCH	0x00100000	/* Running - fetch transmit
    544  1.20  thorpej 						   descriptor */
    545  1.20  thorpej #define	STATUS_DM_TS_SETUP	0x00200000	/* Running - Setup packet */
    546  1.20  thorpej #define	STATUS_DM_TS_READING	0x00300000	/* Running - read buffer from
    547  1.20  thorpej 						   memory and queue into
    548  1.20  thorpej 						   FIFO */
    549  1.20  thorpej #define	STATUS_DM_TS_CLOSE_OWN	0x00400000	/* Running - close transmit
    550  1.20  thorpej 						   descriptor, clear own */
    551  1.20  thorpej #define	STATUS_DM_TS_WAIT	0x00500000	/* Running - wait for end
    552  1.20  thorpej 						   of transmission */
    553  1.20  thorpej #define	STATUS_DM_TS_CLOSE_ST	0x00600000	/* Running - close transmit
    554  1.20  thorpej 						   descriptor, write status */
    555  1.20  thorpej #define	STATUS_DM_TS_SUSPENDED	0x00700000	/* Suspended */
    556   1.1  thorpej #define	STATUS_EB		0x03800000	/* error bits */
    557   1.1  thorpej #define	STATUS_EB_PARITY	0x00000000	/* parity errror */
    558   1.1  thorpej #define	STATUS_EB_MABT		0x00800000	/* master abort */
    559   1.1  thorpej #define	STATUS_EB_TABT		0x01000000	/* target abort */
    560  1.12  thorpej #define	STATUS_GPPI		0x04000000	/* GPIO interrupt (21142) */
    561   1.3  thorpej #define	STATUS_PNIC_TXABORT	0x04000000	/* transmit aborted */
    562  1.12  thorpej #define	STATUS_LC		0x08000000	/* 100baseTX link change
    563  1.12  thorpej 						   (21142/PMAC) */
    564  1.11  thorpej #define	STATUS_PMAC_WKUPI	0x10000000	/* wake up event */
    565  1.18  thorpej #define	STATUS_X3201_PMEIS	0x10000000	/* power management event
    566  1.18  thorpej 						   interrupt summary */
    567  1.18  thorpej #define	STATUS_X3201_SFIS	0x80000000	/* second function (Modem)
    568  1.18  thorpej 						   interrupt status */
    569   1.1  thorpej 
    570   1.1  thorpej 
    571   1.1  thorpej /* CSR6 - Operation Mode */
    572   1.1  thorpej #define	CSR_OPMODE		TULIP_CSR6
    573   1.1  thorpej #define	OPMODE_HP		0x00000001	/* hash/perfect mode (ro) */
    574   1.1  thorpej #define	OPMODE_SR		0x00000002	/* start receive */
    575   1.1  thorpej #define	OPMODE_HO		0x00000004	/* hash only mode (ro) */
    576   1.1  thorpej #define	OPMODE_PB		0x00000008	/* pass bad frames */
    577   1.2  thorpej #define	OPMODE_WINB_APP		0x00000008	/* accept all physcal packet */
    578   1.1  thorpej #define	OPMODE_IF		0x00000010	/* inverse filter mode (ro) */
    579   1.2  thorpej #define	OPMODE_WINB_AMP		0x00000010	/* accept multicast packet */
    580   1.1  thorpej #define	OPMODE_SB		0x00000020	/* start backoff counter */
    581   1.2  thorpej #define	OPMODE_WINB_ABP		0x00000020	/* accept broadcast packet */
    582   1.1  thorpej #define	OPMODE_PR		0x00000040	/* promiscuous mode */
    583   1.2  thorpej #define	OPMODE_WINB_ARP		0x00000040	/* accept runt packet */
    584   1.1  thorpej #define	OPMODE_PM		0x00000080	/* pass all multicast */
    585   1.2  thorpej #define	OPMODE_WINB_AEP		0x00000080	/* accept error packet */
    586   1.1  thorpej #define	OPMODE_FKD		0x00000100	/* flaky oscillator disable */
    587   1.1  thorpej #define	OPMODE_FD		0x00000200	/* full-duplex mode */
    588   1.1  thorpej #define	OPMODE_OM		0x00000c00	/* operating mode */
    589   1.1  thorpej #define	OPMODE_OM_NORMAL	0x00000000	/*     normal mode */
    590   1.1  thorpej #define	OPMODE_OM_INTLOOP	0x00000400	/*     internal loopback */
    591   1.1  thorpej #define	OPMODE_OM_EXTLOOP	0x00000800	/*     external loopback */
    592   1.1  thorpej #define	OPMODE_FC		0x00001000	/* force collision */
    593   1.1  thorpej #define	OPMODE_ST		0x00002000	/* start transmitter */
    594   1.1  thorpej #define	OPMODE_TR		0x0000c000	/* threshold control */
    595   1.1  thorpej #define	OPMODE_TR_72		0x00000000	/*     72 bytes */
    596   1.1  thorpej #define	OPMODE_TR_96		0x00004000	/*     96 bytes */
    597   1.1  thorpej #define	OPMODE_TR_128		0x00008000	/*    128 bytes */
    598   1.1  thorpej #define	OPMODE_TR_160		0x0000c000	/*    160 bytes */
    599   1.2  thorpej #define	OPMODE_WINB_TTH		0x001fc000	/* transmit threshold */
    600   1.2  thorpej #define	OPMODE_WINB_TTH_SHIFT	14
    601   1.1  thorpej #define	OPMODE_BP		0x00010000	/* backpressure enable */
    602   1.1  thorpej #define	OPMODE_CA		0x00020000	/* capture effect enable */
    603   1.4  thorpej #define	OPMODE_PNIC_TBEN	0x00020000	/* Tx backoff offset enable */
    604  1.16  thorpej 	/*
    605  1.16  thorpej 	 * On Davicom DM9102, OPMODE_PS and OPMODE_HBD must
    606  1.16  thorpej 	 * always be set.
    607  1.16  thorpej 	 */
    608   1.1  thorpej #define	OPMODE_PS		0x00040000	/* port select:
    609   1.1  thorpej 						   1 = MII/SYM, 0 = SRL
    610   1.1  thorpej 						   (21140) */
    611   1.1  thorpej #define	OPMODE_HBD		0x00080000	/* heartbeat disable:
    612   1.1  thorpej 						   set in MII/SYM 100mbps,
    613   1.1  thorpej 						   set according to PHY
    614   1.1  thorpej 						   in MII 10mbps mode
    615   1.1  thorpej 						   (21140) */
    616   1.3  thorpej #define	OPMODE_PNIC_IT		0x00100000	/* immediate transmit */
    617   1.1  thorpej #define	OPMODE_SF		0x00200000	/* store and forward mode
    618   1.1  thorpej 						   (21140) */
    619   1.2  thorpej #define	OPMODE_WINB_REIT	0x1fe00000	/* receive eartly intr thresh */
    620   1.2  thorpej #define	OPMODE_WINB_REIT_SHIFT	21
    621   1.1  thorpej #define	OPMODE_TTM		0x00400000	/* Transmit Threshold Mode:
    622   1.1  thorpej 						   1 = 10mbps, 0 = 100mbps
    623   1.1  thorpej 						   (21140) */
    624   1.1  thorpej #define	OPMODE_PCS		0x00800000	/* PCS function (21140) */
    625   1.1  thorpej #define	OPMODE_SCR		0x01000000	/* scrambler mode (21140) */
    626  1.16  thorpej #define	OPMODE_MBO		0x02000000	/* must be one (21140,
    627  1.16  thorpej 						   DM9102) */
    628  1.12  thorpej #define	OPMODE_IDAMSB		0x04000000	/* ignore dest addr MSB
    629  1.12  thorpej 						   (21142) */
    630   1.3  thorpej #define	OPMODE_PNIC_DRC		0x20000000	/* don't include CRC in Rx
    631   1.1  thorpej 						   frames (PNIC) */
    632   1.2  thorpej #define	OPMODE_WINB_FES		0x20000000	/* fast ethernet select */
    633   1.1  thorpej #define	OPMODE_RA		0x40000000	/* receive all (21140) */
    634   1.3  thorpej #define	OPMODE_PNIC_EED		0x40000000	/* 1 == ext, 0 == int ENDEC
    635   1.1  thorpej 						   (PNIC) */
    636   1.2  thorpej #define	OPMODE_WINB_TEIO	0x40000000	/* transmit early intr on */
    637   1.1  thorpej #define	OPMODE_SC		0x80000000	/* special capture effect
    638   1.1  thorpej 						   enable (21041+) */
    639   1.2  thorpej #define	OPMODE_WINB_REIO	0x80000000	/* receive early intr on */
    640   1.8  thorpej 
    641   1.8  thorpej /* Shorthand for media-related OPMODE bits */
    642  1.15  thorpej #define	OPMODE_MEDIA_BITS	(OPMODE_FD|OPMODE_PS|OPMODE_PCS|OPMODE_SCR)
    643   1.1  thorpej 
    644   1.1  thorpej /* CSR7 - Interrupt Enable */
    645   1.1  thorpej #define	CSR_INTEN		TULIP_CSR7
    646   1.1  thorpej 	/* See bits for CSR5 -- Status */
    647   1.1  thorpej 
    648   1.1  thorpej 
    649   1.1  thorpej /* CSR8 - Missed Frames */
    650   1.1  thorpej #define	CSR_MISSED		TULIP_CSR8
    651   1.1  thorpej #define	MISSED_MFC		0x0000ffff	/* missed packet count */
    652   1.1  thorpej #define	MISSED_MFO		0x00010000	/* missed packet count
    653   1.1  thorpej 						   overflowed */
    654   1.1  thorpej #define	MISSED_FOC		0x0ffe0000	/* fifo overflow counter
    655   1.1  thorpej 						   (21140) */
    656   1.1  thorpej #define	MISSED_OCO		0x10000000	/* overflow counter overflowed
    657   1.1  thorpej 						   (21140) */
    658   1.1  thorpej 
    659   1.1  thorpej #define	MISSED_GETMFC(x)	((x) & MISSED_MFC)
    660   1.1  thorpej #define	MISSED_GETFOC(x)	(((x) & MISSED_FOC) >> 17)
    661   1.1  thorpej 
    662   1.1  thorpej 
    663   1.1  thorpej /* CSR9 - MII, SROM, Boot ROM, Ethernet Address ROM register. */
    664   1.1  thorpej #define	CSR_MIIROM		TULIP_CSR9
    665   1.1  thorpej #define	MIIROM_DATA		0x000000ff	/* byte of data from
    666   1.1  thorpej 						   Ethernet Address ROM
    667   1.1  thorpej 						   (21040), byte of data
    668   1.1  thorpej 						   to/from Boot ROM (21041+) */
    669   1.1  thorpej #define	MIIROM_SROMCS		0x00000001	/* SROM chip select */
    670   1.1  thorpej #define	MIIROM_SROMSK		0x00000002	/* SROM clock */
    671   1.1  thorpej #define	MIIROM_SROMDI		0x00000004	/* SROM data in (to) */
    672   1.1  thorpej #define	MIIROM_SROMDO		0x00000008	/* SROM data out (from) */
    673   1.1  thorpej #define	MIIROM_REG		0x00000400	/* external register select */
    674   1.1  thorpej #define	MIIROM_SR		0x00000800	/* SROM select */
    675   1.1  thorpej #define	MIIROM_BR		0x00001000	/* boot ROM select */
    676   1.1  thorpej #define	MIIROM_WR		0x00002000	/* write to boot ROM */
    677   1.1  thorpej #define	MIIROM_RD		0x00004000	/* read from boot ROM */
    678   1.1  thorpej #define	MIIROM_MOD		0x00008000	/* mode select (ro) (21041) */
    679   1.1  thorpej #define	MIIROM_MDC		0x00010000	/* MII clock */
    680   1.1  thorpej #define	MIIROM_MDO		0x00020000	/* MII data out */
    681   1.1  thorpej #define	MIIROM_MIIDIR		0x00040000	/* MII direction mode
    682   1.1  thorpej 						   1 = PHY in read,
    683   1.1  thorpej 						   0 = PHY in write */
    684   1.1  thorpej #define	MIIROM_MDI		0x00080000	/* MII data in */
    685   1.1  thorpej #define	MIIROM_DN		0x80000000	/* data not valid (21040) */
    686   1.1  thorpej 
    687  1.11  thorpej #define	MIIROM_PMAC_LED0SEL	0x10000000	/* 0 == LED0 activity (def)
    688  1.11  thorpej 						   1 == LED0 speed */
    689  1.11  thorpej #define	MIIROM_PMAC_LED1SEL	0x20000000	/* 0 == LED1 link (def)
    690  1.11  thorpej 						   1 == LED1 link/act */
    691  1.11  thorpej #define	MIIROM_PMAC_LED2SEL	0x40000000	/* 0 == LED2 speed (def)
    692  1.11  thorpej 						   1 == LED2 collision */
    693  1.11  thorpej #define	MIIROM_PMAC_LED3SEL	0x80000000	/* 0 == LED3 receive (def)
    694  1.11  thorpej 						   1 == LED3 full duplex */
    695  1.11  thorpej 
    696   1.1  thorpej 	/* SROM opcodes */
    697   1.1  thorpej #define	TULIP_SROM_OPC_ERASE	0x04
    698   1.1  thorpej #define	TULIP_SROM_OPC_WRITE	0x05
    699   1.1  thorpej #define	TULIP_SROM_OPC_READ	0x06
    700   1.1  thorpej 
    701   1.1  thorpej 	/* The Lite-On PNIC does this completely differently */
    702   1.1  thorpej #define	PNIC_MIIROM_DATA	0x0000ffff	/* mask of data bits ??? */
    703   1.1  thorpej #define	PNIC_MIIROM_BUSY	0x80000000	/* EEPROM is busy */
    704   1.1  thorpej 
    705   1.1  thorpej 
    706   1.1  thorpej /* CSR10 - Boot ROM address register (21041+). */
    707   1.1  thorpej #define	CSR_ROMADDR		TULIP_CSR10
    708   1.1  thorpej #define	ROMADDR_MASK		0x000003ff	/* boot rom address */
    709   1.1  thorpej 
    710   1.1  thorpej 
    711   1.1  thorpej /* CSR11 - General Purpose Timer (21041+). */
    712   1.1  thorpej #define	CSR_GPT			TULIP_CSR11
    713   1.1  thorpej #define	GPT_VALUE		0x0000ffff	/* timer value */
    714   1.1  thorpej #define	GPT_CON			0x00010000	/* continuous mode */
    715  1.12  thorpej 	/* 21143-PD and 21143-TD Interrupt Mitigation bits */
    716  1.12  thorpej #define	GPT_NRX			0x000e0000	/* number of Rx packets */
    717  1.12  thorpej #define	GPT_RXT			0x00f00000	/* Rx timer */
    718  1.12  thorpej #define	GPT_NTX			0x07000000	/* number of Tx packets */
    719  1.12  thorpej #define	GPT_TXT			0x78000000	/* Tx timer */
    720  1.12  thorpej #define	GPT_CYCLE		0x80000000	/* cycle size */
    721   1.1  thorpej 
    722   1.1  thorpej 
    723  1.12  thorpej /* CSR12 - SIA Status Register. */
    724   1.1  thorpej #define	CSR_SIASTAT		TULIP_CSR12
    725   1.1  thorpej #define	SIASTAT_PAUI		0x00000001	/* pin AUI/TP indication
    726   1.1  thorpej 						   (21040) */
    727  1.12  thorpej #define	SIASTAT_MRA		0x00000001	/* MII receive activity
    728  1.12  thorpej 						   (21142) */
    729   1.1  thorpej #define	SIASTAT_NCR		0x00000002	/* network connection error */
    730  1.12  thorpej #define	SIASTAT_LS100		0x00000002	/* 100baseT link status
    731  1.12  thorpej 						   0 == pass (21142) */
    732   1.1  thorpej #define	SIASTAT_LKF		0x00000004	/* link fail status */
    733  1.12  thorpej #define	SIASTAT_LS10		0x00000004	/* 10baseT link status
    734  1.12  thorpej 						   0 == pass (21142) */
    735   1.1  thorpej #define	SIASTAT_APS		0x00000008	/* auto polarity status */
    736   1.1  thorpej #define	SIASTAT_DSD		0x00000010	/* PLL self test done */
    737   1.1  thorpej #define	SIASTAT_DSP		0x00000020	/* PLL self test pass */
    738   1.1  thorpej #define	SIASTAT_DAZ		0x00000040	/* PLL all zero */
    739   1.1  thorpej #define	SIASTAT_DAO		0x00000080	/* PLL all one */
    740   1.1  thorpej #define	SIASTAT_SRA		0x00000100	/* selected port receive
    741   1.1  thorpej 						   activity (21041) */
    742  1.12  thorpej #define	SIASTAT_ARA		0x00000100	/* AUI receive activity
    743  1.12  thorpej 						   (21142) */
    744   1.1  thorpej #define	SIASTAT_NRA		0x00000200	/* non-selected port
    745   1.1  thorpej 						   receive activity (21041) */
    746  1.12  thorpej #define	SIASTAT_TRA		0x00000200	/* 10base-T receive activity
    747  1.12  thorpej 						   (21142) */
    748   1.1  thorpej #define	SIASTAT_NSN		0x00000400	/* non-stable NLPs detected
    749   1.1  thorpej 						   (21041) */
    750   1.1  thorpej #define	SIASTAT_TRF		0x00000800	/* transmit remote fault
    751   1.1  thorpej 						   (21041) */
    752   1.1  thorpej #define	SIASTAT_ANS		0x00007000	/* autonegotiation state
    753   1.1  thorpej 						   (21041) */
    754   1.1  thorpej #define	SIASTAT_ANS_DIS		0x00000000	/*     disabled */
    755   1.1  thorpej #define	SIASTAT_ANS_TXDIS	0x00001000	/*     transmit disabled */
    756  1.21   castor #define	SIASTAT_ANS_START	0x00001000	/*     (MX98715AEC) */
    757   1.1  thorpej #define	SIASTAT_ANS_ABD		0x00002000	/*     ability detect */
    758   1.1  thorpej #define	SIASTAT_ANS_ACKD	0x00003000	/*     acknowledge detect */
    759   1.1  thorpej #define	SIASTAT_ANS_ACKC	0x00004000	/*     complete acknowledge */
    760  1.12  thorpej #define	SIASTAT_ANS_FLPGOOD	0x00005000	/*     FLP link good */
    761   1.1  thorpej #define	SIASTAT_ANS_LINKCHECK	0x00006000	/*     link check */
    762   1.1  thorpej #define	SIASTAT_LPN		0x00008000	/* link partner negotiable
    763   1.1  thorpej 						   (21041) */
    764   1.1  thorpej #define	SIASTAT_LPC		0xffff0000	/* link partner code word */
    765   1.1  thorpej 
    766   1.1  thorpej #define	SIASTAT_GETLPC(x)	(((x) & SIASTAT_LPC) >> 16)
    767   1.1  thorpej 
    768   1.1  thorpej 
    769  1.12  thorpej /* CSR13 - SIA Connectivity Register. */
    770   1.1  thorpej #define	CSR_SIACONN		TULIP_CSR13
    771  1.12  thorpej #define	SIACONN_SRL		0x00000001	/* SIA reset
    772  1.12  thorpej 						   (0 == reset) */
    773   1.1  thorpej #define	SIACONN_PS		0x00000002	/* pin AUI/TP selection
    774   1.1  thorpej 						   (21040) */
    775   1.1  thorpej #define	SIACONN_CAC		0x00000004	/* CSR autoconfiguration */
    776   1.1  thorpej #define	SIACONN_AUI		0x00000008	/* select AUI (0 = TP) */
    777   1.1  thorpej #define	SIACONN_EDP		0x00000010	/* SIA PLL external input
    778   1.1  thorpej 						   enable (21040) */
    779   1.1  thorpej #define	SIACONN_ENI		0x00000020	/* encoder input multiplexer
    780   1.1  thorpej 						   (21040) */
    781   1.1  thorpej #define	SIACONN_SIM		0x00000040	/* serial interface input
    782   1.1  thorpej 						   multiplexer (21040) */
    783   1.1  thorpej #define	SIACONN_ASE		0x00000080	/* APLL start enable
    784   1.1  thorpej 						   (21040) */
    785   1.1  thorpej #define	SIACONN_SEL		0x00000f00	/* external port output
    786   1.1  thorpej 						   multiplexer select
    787   1.1  thorpej 						   (21040) */
    788   1.1  thorpej #define	SIACONN_IE		0x00001000	/* input enable (21040) */
    789   1.1  thorpej #define	SIACONN_OE1_3		0x00002000	/* output enable 1, 3
    790   1.1  thorpej 						   (21040) */
    791   1.1  thorpej #define	SIACONN_OE2_4		0x00004000	/* output enable 2, 4
    792   1.1  thorpej 						   (21040) */
    793   1.1  thorpej #define	SIACONN_OE5_6_7		0x00008000	/* output enable 5, 6, 7
    794   1.1  thorpej 						   (21040) */
    795   1.1  thorpej #define	SIACONN_SDM		0x0000ef00	/* SIA diagnostic mode;
    796   1.1  thorpej 						   always set to this value
    797   1.1  thorpej 						   for normal operation
    798   1.1  thorpej 						   (21041) */
    799   1.1  thorpej 
    800   1.1  thorpej 
    801  1.12  thorpej /* CSR14 - SIA Transmit Receive Register. */
    802   1.1  thorpej #define	CSR_SIATXRX		TULIP_CSR14
    803   1.1  thorpej #define	SIATXRX_ECEN		0x00000001	/* encoder enable */
    804   1.1  thorpej #define	SIATXRX_LBK		0x00000002	/* loopback enable */
    805   1.1  thorpej #define	SIATXRX_DREN		0x00000004	/* driver enable */
    806   1.1  thorpej #define	SIATXRX_LSE		0x00000008	/* link pulse send enable */
    807   1.1  thorpej #define	SIATXRX_CPEN		0x00000030	/* compensation enable */
    808   1.1  thorpej #define	SIATXRX_CPEN_DIS0	0x00000000	/*     disabled */
    809   1.1  thorpej #define	SIATXRX_CPEN_DIS1	0x00000010	/*     disabled */
    810   1.1  thorpej #define	SIATXRX_CPEN_HIGHPWR	0x00000020	/*     high power */
    811   1.1  thorpej #define	SIATXRX_CPEN_NORMAL	0x00000030	/*     normal */
    812   1.1  thorpej #define	SIATXRX_MBO		0x00000040	/* must be one (21041 pass 2) */
    813  1.12  thorpej #define	SIATXRX_TH		0x00000040	/* 10baseT HDX enable (21142) */
    814   1.1  thorpej #define	SIATXRX_ANE		0x00000080	/* autonegotiation enable
    815  1.12  thorpej 						   (21041/21142) */
    816   1.1  thorpej #define	SIATXRX_RSQ		0x00000100	/* receive squelch enable */
    817   1.1  thorpej #define	SIATXRX_CSQ		0x00000200	/* collision squelch enable */
    818   1.1  thorpej #define	SIATXRX_CLD		0x00000400	/* collision detect enable */
    819   1.1  thorpej #define	SIATXRX_SQE		0x00000800	/* signal quality generation
    820   1.1  thorpej 						   enable */
    821   1.1  thorpej #define	SIATXRX_LTE		0x00001000	/* link test enable */
    822   1.1  thorpej #define	SIATXRX_APE		0x00002000	/* auto-polarity enable */
    823  1.22    jeffs #define	SIATXRX_SPP		0x00004000	/* set polarity plus */
    824   1.1  thorpej #define	SIATXRX_TAS		0x00008000	/* 10base-T/AUI autosensing
    825  1.12  thorpej 						   enable (21041/21142) */
    826  1.12  thorpej #define	SIATXRX_THX		0x00010000	/* 100baseTX-HDX (21142) */
    827  1.12  thorpej #define	SIATXRX_TXF		0x00020000	/* 100baseTX-FDX (21142) */
    828  1.12  thorpej #define	SIATXRX_T4		0x00040000	/* 100baseT4 (21142) */
    829   1.1  thorpej 
    830   1.1  thorpej 
    831  1.12  thorpej /* CSR15 - SIA General Register. */
    832   1.1  thorpej #define	CSR_SIAGEN		TULIP_CSR15
    833   1.1  thorpej #define	SIAGEN_JBD		0x00000001	/* jabber disable */
    834   1.1  thorpej #define	SIAGEN_HUJ		0x00000002	/* host unjab */
    835   1.1  thorpej #define	SIAGEN_JCK		0x00000004	/* jabber clock */
    836   1.1  thorpej #define	SIAGEN_ABM		0x00000008	/* BNC select (21041) */
    837   1.1  thorpej #define	SIAGEN_RWD		0x00000010	/* receive watchdog disable */
    838   1.1  thorpej #define	SIAGEN_RWR		0x00000020	/* receive watchdog release */
    839   1.1  thorpej #define	SIAGEN_LE1		0x00000040	/* LED 1 enable (21041) */
    840   1.1  thorpej #define	SIAGEN_LV1		0x00000080	/* LED 1 value (21041) */
    841   1.1  thorpej #define	SIAGEN_TSCK		0x00000100	/* test clock */
    842   1.1  thorpej #define	SIAGEN_FUSQ		0x00000200	/* force unsquelch */
    843   1.1  thorpej #define	SIAGEN_FLF		0x00000400	/* force link fail */
    844   1.1  thorpej #define	SIAGEN_LSD		0x00000800	/* LED stretch disable
    845   1.1  thorpej 						   (21041) */
    846  1.12  thorpej #define	SIAGEN_LEE		0x00000800	/* Link extend enable (21142) */
    847   1.1  thorpej #define	SIAGEN_DPST		0x00001000	/* PLL self-test start */
    848   1.1  thorpej #define	SIAGEN_FRL		0x00002000	/* force receiver low */
    849   1.1  thorpej #define	SIAGEN_LE2		0x00004000	/* LED 2 enable (21041) */
    850  1.12  thorpej #define	SIAGEN_RMP		0x00004000	/* received magic packet
    851  1.12  thorpej 						   (21143) */
    852   1.1  thorpej #define	SIAGEN_LV2		0x00008000	/* LED 2 value (21041) */
    853  1.12  thorpej #define	SIAGEN_HCKR		0x00008000	/* hacker (21143) */
    854  1.12  thorpej #define	SIAGEN_MD		0x000f0000	/* general purpose mode/data */
    855  1.17    soren #define	SIAGEN_LGS0		0x00100000	/* LED/GEP 0 select */
    856  1.17    soren #define	SIAGEN_LGS1		0x00200000	/* LED/GEP 1 select */
    857  1.17    soren #define	SIAGEN_LGS2		0x00400000	/* LED/GEP 2 select */
    858  1.17    soren #define	SIAGEN_LGS3		0x00800000	/* LED/GEP 3 select */
    859  1.12  thorpej #define	SIAGEN_GEI0		0x01000000	/* GEP pin 0 intr enable */
    860  1.12  thorpej #define	SIAGEN_GEI1		0x02000000	/* GEP pin 1 intr enable */
    861  1.12  thorpej #define	SIAGEN_RME		0x04000000	/* receive match enable */
    862  1.12  thorpej #define	SIAGEN_CWE		0x08000000	/* control write enable */
    863  1.12  thorpej #define	SIAGEN_GI0		0x10000000	/* GEP pin 0 interrupt */
    864  1.12  thorpej #define	SIAGEN_GI1		0x20000000	/* GEP pin 1 interrupt */
    865  1.12  thorpej #define	SIAGEN_RMI		0x40000000	/* receive match interrupt */
    866   1.1  thorpej 
    867   1.1  thorpej 
    868   1.1  thorpej /* CSR12 - General Purpose Port (21140+). */
    869   1.1  thorpej #define	CSR_GPP			TULIP_CSR12
    870   1.1  thorpej #define	GPP_MD			0x000000ff	/* general purpose mode/data */
    871   1.1  thorpej #define	GPP_GPC			0x00000100	/* general purpose control */
    872   1.3  thorpej #define	GPP_PNIC_GPD		0x0000000f	/* general purpose data */
    873   1.3  thorpej #define	GPP_PNIC_GPC		0x000000f0	/* general purpose control */
    874   1.3  thorpej 
    875   1.3  thorpej #define	GPP_PNIC_IN(x)		(1 << (x))
    876   1.4  thorpej #define	GPP_PNIC_OUT(x, on)	(((on) << (x)) | (1 << ((x) + 4)))
    877   1.3  thorpej 
    878   1.3  thorpej /*
    879   1.3  thorpej  * The Lite-On PNIC manual recommends the following for the General Purpose
    880   1.3  thorpej  * I/O pins:
    881   1.3  thorpej  *
    882   1.3  thorpej  *	0	Speed Relay		1 == 100mbps
    883   1.3  thorpej  *	1	100mbps loopback	1 == loopback
    884   1.3  thorpej  *	2	BNC DC-DC converter	1 == select BNC
    885   1.3  thorpej  *	3	Link 100		1 == 100baseTX link status
    886   1.3  thorpej  */
    887   1.3  thorpej #define	GPP_PNIC_PIN_SPEED_RLY	0
    888   1.3  thorpej #define	GPP_PNIC_PIN_100M_LPKB	1
    889   1.3  thorpej #define	GPP_PNIC_PIN_BNC_XMER	2
    890   1.3  thorpej #define	GPP_PNIC_PIN_LNK100X	3
    891   1.3  thorpej 
    892   1.1  thorpej 
    893   1.1  thorpej /*
    894   1.1  thorpej  * Digital Semiconductor 21040 registers.
    895   1.1  thorpej  */
    896   1.1  thorpej 
    897   1.1  thorpej /* CSR11 - Full Duplex Register */
    898   1.1  thorpej #define	CSR_21040_FDX		TULIP_CSR11
    899   1.1  thorpej #define	FDX21040_FDXACV		0x0000ffff	/* full duplex
    900   1.1  thorpej 						   autoconfiguration value */
    901   1.1  thorpej 
    902   1.1  thorpej 
    903   1.1  thorpej /* SIA configuration for 10base-T (from the 21040 manual) */
    904   1.1  thorpej #define	SIACONN_21040_10BASET	0x0000ef01
    905   1.1  thorpej #define	SIATXRX_21040_10BASET	0x0000ffff
    906   1.1  thorpej #define	SIAGEN_21040_10BASET	0x00000000
    907   1.1  thorpej 
    908   1.1  thorpej 
    909   1.1  thorpej /* SIA configuration for 10base-T full-duplex (from the 21040 manual) */
    910   1.9    enami #define	SIACONN_21040_10BASET_FDX 0x0000ef01
    911   1.1  thorpej #define	SIATXRX_21040_10BASET_FDX 0x0000fffd
    912   1.1  thorpej #define	SIAGEN_21040_10BASET_FDX  0x00000000
    913   1.1  thorpej 
    914   1.1  thorpej 
    915   1.1  thorpej /* SIA configuration for 10base-5 (from the 21040 manual) */
    916   1.1  thorpej #define	SIACONN_21040_AUI	0x0000ef09
    917   1.1  thorpej #define	SIATXRX_21040_AUI	0x00000705
    918   1.1  thorpej #define	SIAGEN_21040_AUI	0x00000006
    919   1.1  thorpej 
    920   1.1  thorpej 
    921   1.1  thorpej /* SIA configuration for External SIA (from the 21040 manual) */
    922   1.1  thorpej #define	SIACONN_21040_EXTSIA	0x00003041
    923   1.1  thorpej #define	SIATXRX_21040_EXTSIA	0x00000000
    924   1.1  thorpej #define	SIAGEN_21040_EXTSIA	0x00000006
    925   1.1  thorpej 
    926   1.1  thorpej 
    927   1.1  thorpej /*
    928   1.1  thorpej  * Digital Semiconductor 21041 registers.
    929   1.1  thorpej  */
    930   1.1  thorpej 
    931   1.1  thorpej /* SIA configuration for 10base-T (from the 21041 manual) */
    932   1.1  thorpej #define	SIACONN_21041_10BASET	0x0000ef01
    933   1.1  thorpej #define	SIATXRX_21041_10BASET	0x0000ff3f
    934   1.1  thorpej #define	SIAGEN_21041_10BASET	0x00000000
    935   1.1  thorpej 
    936   1.1  thorpej #define	SIACONN_21041P2_10BASET	SIACONN_21041_10BASET
    937   1.1  thorpej #define	SIATXRX_21041P2_10BASET	0x0000ffff
    938   1.1  thorpej #define	SIAGEN_21041P2_10BASET	SIAGEN_21041_10BASET
    939   1.1  thorpej 
    940   1.1  thorpej 
    941   1.1  thorpej /* SIA configuration for 10base-T full-duplex (from the 21041 manual) */
    942   1.1  thorpej #define	SIACONN_21041_10BASET_FDX   0x0000ef01
    943   1.1  thorpej #define	SIATXRX_21041_10BASET_FDX   0x0000ff3d
    944   1.1  thorpej #define	SIAGEN_21041_10BASET_FDX    0x00000000
    945   1.1  thorpej 
    946   1.1  thorpej #define	SIACONN_21041P2_10BASET_FDX SIACONN_21041_10BASET_FDX
    947   1.1  thorpej #define	SIATXRX_21041P2_10BASET_FDX 0x0000ffff
    948   1.1  thorpej #define	SIAGEN_21041P2_10BASET_FDX  SIAGEN_21041_10BASET_FDX
    949   1.1  thorpej 
    950   1.1  thorpej 
    951   1.1  thorpej /* SIA configuration for 10base-5 (from the 21041 manual) */
    952   1.1  thorpej #define	SIACONN_21041_AUI	0x0000ef09
    953   1.1  thorpej #define	SIATXRX_21041_AUI	0x0000f73d
    954   1.1  thorpej #define	SIAGEN_21041_AUI	0x0000000e
    955   1.1  thorpej 
    956   1.1  thorpej #define	SIACONN_21041P2_AUI	SIACONN_21041_AUI
    957   1.1  thorpej #define	SIATXRX_21041P2_AUI	0x0000f7fd
    958   1.1  thorpej #define	SIAGEN_21041P2_AUI	SIAGEN_21041_AUI
    959   1.1  thorpej 
    960   1.1  thorpej 
    961   1.1  thorpej /* SIA configuration for 10base-2 (from the 21041 manual) */
    962   1.1  thorpej #define	SIACONN_21041_BNC	0x0000ef09
    963   1.1  thorpej #define	SIATXRX_21041_BNC	0x0000f73d
    964   1.1  thorpej #define	SIAGEN_21041_BNC	0x00000006
    965   1.1  thorpej 
    966   1.1  thorpej #define	SIACONN_21041P2_BNC	SIACONN_21041_BNC
    967   1.1  thorpej #define	SIATXRX_21041P2_BNC	0x0000f7fd
    968   1.1  thorpej #define	SIAGEN_21041P2_BNC	SIAGEN_21041_BNC
    969   1.1  thorpej 
    970   1.1  thorpej 
    971   1.1  thorpej /*
    972   1.1  thorpej  * Digital Semiconductor 21142/21143 registers.
    973   1.1  thorpej  */
    974   1.1  thorpej 
    975  1.12  thorpej /* SIA configuration for 10baseT (from the 21143 manual) */
    976  1.12  thorpej #define	SIACONN_21142_10BASET	0x00000001
    977  1.12  thorpej #define	SIATXRX_21142_10BASET	0x00007f3f
    978  1.12  thorpej #define	SIAGEN_21142_10BASET	0x00000008
    979  1.12  thorpej 
    980  1.12  thorpej 
    981  1.12  thorpej /* SIA configuration for 10baseT full-duplex (from the 21143 manual) */
    982  1.12  thorpej #define	SIACONN_21142_10BASET_FDX   0x00000001
    983  1.12  thorpej #define	SIATXRX_21142_10BASET_FDX   0x00007f3d
    984  1.12  thorpej #define	SIAGEN_21142_10BASET_FDX    0x00000008
    985  1.12  thorpej 
    986  1.12  thorpej 
    987  1.12  thorpej /* SIA configuration for 10base5 (from the 21143 manual) */
    988  1.12  thorpej #define	SIACONN_21142_AUI	0x00000009
    989  1.12  thorpej #define	SIATXRX_21142_AUI	0x00004705
    990  1.12  thorpej #define	SIAGEN_21142_AUI	0x0000000e
    991  1.12  thorpej 
    992  1.12  thorpej 
    993  1.12  thorpej /* SIA configuration for 10base2 (from the 21143 manual) */
    994  1.12  thorpej #define	SIACONN_21142_BNC	0x00000009
    995  1.12  thorpej #define	SIATXRX_21142_BNC	0x00004705
    996  1.12  thorpej #define	SIAGEN_21142_BNC	0x00000006
    997  1.12  thorpej 
    998   1.1  thorpej 
    999   1.1  thorpej /*
   1000   1.1  thorpej  * Lite-On 82C168/82C169 registers.
   1001   1.1  thorpej  */
   1002   1.1  thorpej 
   1003   1.1  thorpej /* ENDEC General Register */
   1004   1.1  thorpej #define	CSR_PNIC_ENDEC		0x78
   1005   1.3  thorpej #define	PNIC_ENDEC_JDIS		0x00000001	/* jabber disable */
   1006   1.1  thorpej 
   1007   1.1  thorpej /* SROM Power Register */
   1008   1.1  thorpej #define	CSR_PNIC_SROMPWR	0x90
   1009   1.3  thorpej #define	PNIC_SROMPWR_MRLE	0x00000001	/* Memory-Read-Line enable */
   1010   1.3  thorpej #define	PNIC_SROMPWR_CB		0x00000002	/* cache boundary alignment
   1011   1.3  thorpej 						   burst type; 1 == burst to
   1012   1.3  thorpej 						   boundary, 0 == single-cycle
   1013   1.3  thorpej 						   to boundary */
   1014   1.1  thorpej 
   1015   1.1  thorpej /* SROM Control Register */
   1016   1.1  thorpej #define	CSR_PNIC_SROMCTL	0x98
   1017   1.3  thorpej #define	PNIC_SROMCTL_addr	0x0000003f	/* mask of address bits */
   1018   1.3  thorpej /* XXX THESE ARE WRONG ACCORDING TO THE MANUAL! */
   1019   1.1  thorpej #define	PNIC_SROMCTL_READ	0x00000600	/* read command */
   1020   1.1  thorpej 
   1021   1.1  thorpej /* MII Access Register */
   1022   1.1  thorpej #define	CSR_PNIC_MII		0xa0
   1023   1.1  thorpej #define	PNIC_MII_DATA		0x0000ffff	/* mask of data bits */
   1024   1.1  thorpej #define	PNIC_MII_REG		0x007c0000	/* register mask */
   1025   1.1  thorpej #define	PNIC_MII_REGSHIFT	18
   1026   1.1  thorpej #define	PNIC_MII_PHY		0x0f800000	/* phy mask */
   1027   1.1  thorpej #define	PNIC_MII_PHYSHIFT	23
   1028   1.1  thorpej #define	PNIC_MII_OPCODE		0x30000000	/* opcode mask */
   1029   1.3  thorpej #define	PNIC_MII_RESERVED	0x00020000	/* must be one/must be zero;
   1030   1.3  thorpej 						   2 bits are described here */
   1031   1.3  thorpej #define	PNIC_MII_MBO		0x40000000	/* must be one */
   1032   1.1  thorpej #define	PNIC_MII_BUSY		0x80000000	/* MII is busy */
   1033   1.1  thorpej 
   1034   1.3  thorpej #define	PNIC_MII_WRITE		0x10000000	/* write PHY command */
   1035   1.3  thorpej #define	PNIC_MII_READ		0x20000000	/* read PHY command */
   1036   1.1  thorpej 
   1037   1.1  thorpej /* NWAY Register */
   1038   1.1  thorpej #define	CSR_PNIC_NWAY		0xb8
   1039   1.3  thorpej #define	PNIC_NWAY_RS		0x00000001	/* reset NWay block */
   1040   1.3  thorpej #define	PNIC_NWAY_PD		0x00000002	/* power down NWay block */
   1041  1.24      wiz #define	PNIC_NWAY_BX		0x00000004	/* bypass transceiver */
   1042   1.3  thorpej #define	PNIC_NWAY_LC		0x00000008	/* AUI low current mode */
   1043   1.3  thorpej #define	PNIC_NWAY_UV		0x00000010	/* low squelch voltage */
   1044   1.3  thorpej #define	PNIC_NWAY_DX		0x00000020	/* disable TP pol. correction */
   1045   1.3  thorpej #define	PNIC_NWAY_TW		0x00000040	/* select TP (0 == AUI) */
   1046   1.3  thorpej #define	PNIC_NWAY_AF		0x00000080	/* AUI full/half step input
   1047   1.3  thorpej 						   voltage */
   1048   1.3  thorpej #define	PNIC_NWAY_FD		0x00000100	/* full duplex mode */
   1049   1.3  thorpej #define	PNIC_NWAY_DL		0x00000200	/* disable link integrity
   1050   1.3  thorpej 						   test */
   1051   1.3  thorpej #define	PNIC_NWAY_DM		0x00000400	/* disable AUI/TP autodetect */
   1052   1.3  thorpej #define	PNIC_NWAY_100		0x00000800	/* 1 == 100mbps, 0 == 10mbps */
   1053   1.3  thorpej #define	PNIC_NWAY_NW		0x00001000	/* enable NWay block */
   1054   1.1  thorpej #define	PNIC_NWAY_CAP10T	0x00002000	/* adv. 10baseT */
   1055   1.1  thorpej #define	PNIC_NWAY_CAP10TFDX	0x00004000	/* adv. 10baseT-FDX */
   1056   1.1  thorpej #define	PNIC_NWAY_CAP100TXFDX	0x00008000	/* adv. 100baseTX-FDX */
   1057   1.1  thorpej #define	PNIC_NWAY_CAP100TX	0x00010000	/* adv. 100baseTX */
   1058   1.1  thorpej #define	PNIC_NWAY_CAP100T4	0x00020000	/* adv. 100base-T4 */
   1059   1.3  thorpej #define	PNIC_NWAY_RN		0x02000000	/* re-negotiate enable */
   1060   1.3  thorpej #define	PNIC_NWAY_RF		0x04000000	/* remote fault detected */
   1061   1.1  thorpej #define	PNIC_NWAY_LPAR10T	0x08000000	/* link part. 10baseT */
   1062   1.1  thorpej #define	PNIC_NWAY_LPAR10TFDX	0x10000000	/* link part. 10baseT-FDX */
   1063   1.1  thorpej #define	PNIC_NWAY_LPAR100TXFDX	0x20000000	/* link part. 100baseTX-FDX */
   1064   1.1  thorpej #define	PNIC_NWAY_LPAR100TX	0x40000000	/* link part. 100baseTX */
   1065   1.1  thorpej #define	PNIC_NWAY_LPAR100T4	0x80000000	/* link part. 100base-T4 */
   1066   1.3  thorpej #define	PNIC_NWAY_LPAR_MASK	0xf8000000
   1067   1.1  thorpej 
   1068   1.1  thorpej 
   1069   1.1  thorpej /*
   1070  1.21   castor  * Macronix 98713, 98713A, 98715, 98715A, 98715AEC, 98725 and
   1071  1.11  thorpej  * Lite-On 82C115 registers.
   1072   1.1  thorpej  */
   1073   1.1  thorpej 
   1074  1.10  thorpej 	/*
   1075  1.10  thorpej 	 * Note, the MX98713 is very Tulip-like:
   1076  1.10  thorpej 	 *
   1077  1.10  thorpej 	 *	CSR12		General Purpose Port (like 21140)
   1078  1.10  thorpej 	 *	CSR13		reserved
   1079  1.10  thorpej 	 *	CSR14		reserved
   1080  1.10  thorpej 	 *	CSR15		Watchdog Timer (like 21140)
   1081  1.10  thorpej 	 *
   1082  1.10  thorpej 	 * The Macronix CSR12, CSR13, CSR14, and CSR15 exist only
   1083  1.10  thorpej 	 * on the MX98713A and higher.
   1084  1.10  thorpej 	 */
   1085  1.10  thorpej 
   1086   1.1  thorpej /* CSR12 - 10base-T Status Port (similar to SIASTAT) */
   1087  1.12  thorpej 	/* See SIASTAT 21142/21143 bits */
   1088   1.1  thorpej #define	CSR_PMAC_10TSTAT	   TULIP_CSR12
   1089  1.12  thorpej #define	PMAC_SIASTAT_MASK	(SIASTAT_LS100|SIASTAT_LS10|		\
   1090  1.12  thorpej 				 SIASTAT_APS|SIASTAT_TRF|SIASTAT_ANS|	\
   1091  1.12  thorpej 				 SIASTAT_LPN|SIASTAT_LPC)
   1092   1.1  thorpej 
   1093   1.1  thorpej 
   1094   1.1  thorpej /* CSR13 - NWAY Reset Register */
   1095   1.1  thorpej #define	CSR_PMAC_NWAYRESET	TULIP_CSR13
   1096  1.12  thorpej 	/* See SIACONN 21142/21143 bits */
   1097  1.12  thorpej #define	PMAC_SIACONN_MASK	(SIACONN_SRL)
   1098  1.11  thorpej #define	PMAC_NWAYRESET_100TXRESET 0x00000002	/* 100base PMD reset */
   1099   1.1  thorpej 
   1100   1.1  thorpej 
   1101   1.1  thorpej /* CSR14 - 10base-T Control Port */
   1102   1.1  thorpej #define	CSR_PMAC_10TCTL		TULIP_CSR14
   1103  1.12  thorpej 	/* See SIATXRX 21142/21143 bits */
   1104  1.12  thorpej #define	PMAC_SIATXRX_MASK	(SIATXRX_LBK|SIATXRX_DREN|SIATXRX_TH|	\
   1105  1.12  thorpej 				 SIATXRX_ANE|SIATXRX_RSQ|SIATXRX_LTE|	\
   1106  1.12  thorpej 				 SIATXRX_THX|SIATXRX_TXF|SIATXRX_T4)
   1107   1.1  thorpej 
   1108   1.1  thorpej 
   1109  1.11  thorpej /* CSR15 - Watchdog Timer Register */
   1110  1.12  thorpej 	/* MX98713: see 21140 CSR15 */
   1111  1.12  thorpej 	/* others: see SIAGEN 21142/21143 bits */
   1112  1.12  thorpej #define	PMAC_SIAGEN_MASK	(SIAGEN_JBD|SIAGEN_HUJ|SIAGEN_JCK|	\
   1113  1.12  thorpej 				 SIAGEN_RWD|SIAGEN_RWR)
   1114  1.11  thorpej 
   1115  1.11  thorpej 
   1116   1.1  thorpej /* CSR16 - Test Operation Register (a.k.a. Magic Packet Register) */
   1117   1.1  thorpej #define	CSR_PMAC_TOR		TULIP_CSR16
   1118   1.1  thorpej #define	PMAC_TOR_98713		0x0F370000
   1119   1.1  thorpej #define	PMAC_TOR_98715		0x0B3C0000
   1120   1.1  thorpej 
   1121   1.1  thorpej 
   1122   1.1  thorpej /* CSR20 - NWAY Status */
   1123   1.1  thorpej #define	CSR_PMAC_NWAYSTAT	TULIP_CSR20
   1124  1.11  thorpej 	/*
   1125  1.11  thorpej 	 * Note: the MX98715A manual claims that EQTEST and PCITEST
   1126  1.11  thorpej 	 * must be set to 1 by software for normal operation, but
   1127  1.11  thorpej 	 * this does not appear to be necessary.  This is probably
   1128  1.11  thorpej 	 * one of the things that frobbing the Test Operation Register
   1129  1.11  thorpej 	 * does.
   1130  1.21   castor 	 *
   1131  1.21   castor 	 * MX98715AEC uses this register for Auto Compensation.
   1132  1.21   castor 	 * CSR20<14> and CSR20<9> are called DS130 and DS120
   1133  1.11  thorpej 	 */
   1134  1.21   castor #define	PMAC_NWAYSTAT_DS120	0x00000200	/* Auto-compensation circ */
   1135  1.21   castor #define	PMAC_NWAYSTAT_DS130	0x00004000	/* Auto-compensation circ */
   1136  1.11  thorpej #define	PMAC_NWAYSTAT_EQTEST	0x00001000	/* EQ test */
   1137  1.11  thorpej #define	PMAC_NWAYSTAT_PCITEST	0x00010000	/* PCI test */
   1138   1.1  thorpej #define	PMAC_NWAYSTAT_10TXH	0x08000000	/* 10t accepted */
   1139   1.1  thorpej #define	PMAC_NWAYSTAT_10TXF	0x10000000	/* 10t-fdx accepted */
   1140   1.1  thorpej #define	PMAC_NWAYSTAT_100TXH	0x20000000	/* 100tx accepted */
   1141   1.1  thorpej #define	PMAC_NWAYSTAT_100TXF	0x40000000	/* 100tx-fdx accepted */
   1142   1.1  thorpej #define	PMAC_NWAYSTAT_T4	0x80000000	/* 100t4 accepted */
   1143   1.1  thorpej 
   1144   1.1  thorpej 
   1145  1.11  thorpej /* CSR21 - Flow Control Register */
   1146  1.11  thorpej #define	CSR_PNICII_FLOWCTL	TULIP_CSR21
   1147  1.11  thorpej #define	PNICII_FLOWCTL_WKFCATEN	0x00000010	/* enable wake-up frame
   1148  1.11  thorpej 						   catenation feature */
   1149  1.11  thorpej #define	PNICII_FLOWCTL_NFCE	0x00000020	/* accept flow control result
   1150  1.11  thorpej 						   from NWay */
   1151  1.11  thorpej #define	PNICII_FLOWCTL_FCTH0	0x00000040	/* rx flow control thresh 0 */
   1152  1.11  thorpej #define	PNICII_FLOWCTL_FCTH1	0x00000080	/* rx flow control thresh 1 */
   1153  1.11  thorpej #define	PNICII_FLOWCTL_REJECTFC	0x00000100	/* abort rx flow control */
   1154  1.11  thorpej #define	PNICII_FLOWCTL_STOPTX	0x00000200	/* tx flow stopped */
   1155  1.11  thorpej #define	PNICII_FLOWCTL_RUFCEN	0x00000400	/* send flow control when
   1156  1.11  thorpej 						   RU interrupt occurs */
   1157  1.11  thorpej #define	PNICII_FLOWCTL_RXFCEN	0x00000800	/* rx flow control enable */
   1158  1.11  thorpej #define	PNICII_FLOWCTL_TXFCEN	0x00001000	/* tx flow control enable */
   1159  1.11  thorpej #define	PNICII_FLOWCTL_RESTOP	0x00002000	/* restop mode */
   1160  1.11  thorpej #define	PNICII_FLOWCTL_RESTART	0x00004000	/* restart mode */
   1161  1.11  thorpej #define	PNICII_FLOWCTL_TEST	0x00008000	/* test flow control timer */
   1162  1.11  thorpej #define	PNICII_FLOWCTL_TMVAL	0xffff0000	/* timer value in flow
   1163  1.11  thorpej 						   control frame */
   1164  1.11  thorpej 
   1165  1.11  thorpej #define	PNICII_FLOWCTL_TH_512	(PNICII_FLOWCTL_FCTH0|PNICII_FLOWCTL_FCTH1)
   1166  1.11  thorpej #define	PNICII_FLOWCTL_TH_256	(PNICII_FLOWCTL_FCTH1)
   1167  1.11  thorpej #define	PNICII_FLOWCTL_TH_128	(PNICII_FLOWCTL_FCTH0)
   1168  1.11  thorpej #define	PNICII_FLOWCTL_TH_OVFLW	(0)
   1169  1.11  thorpej 
   1170  1.11  thorpej 
   1171  1.11  thorpej /* CSR22 - MAC ID Byte 3-0 Register */
   1172  1.11  thorpej #define	CSR_PNICII_MACID0	TULIP_CSR22
   1173  1.11  thorpej #define	PNICII_MACID_1		0	/* shift */
   1174  1.11  thorpej #define	PNICII_MACID_0		8	/* shift */
   1175  1.11  thorpej #define	PNICII_MACID_3		16	/* shift */
   1176  1.11  thorpej #define	PNICII_MACID_2		24	/* shift */
   1177  1.11  thorpej 
   1178  1.11  thorpej 
   1179  1.11  thorpej /* CSR23 - Magic ID Byte 5,4/MACID Byte 5,4 Register */
   1180  1.11  thorpej #define	PNICII_MACID_5		0	/* shift */
   1181  1.11  thorpej #define	PNICII_MACID_4		8	/* shift */
   1182  1.11  thorpej #define	PNICII_MAGID_5		16	/* shift */
   1183  1.11  thorpej #define	PNICII_MAGIC_4		24	/* shift */
   1184  1.11  thorpej 
   1185  1.11  thorpej 
   1186  1.11  thorpej /* CSR24 - Magic ID Byte 3-0 Register */
   1187  1.11  thorpej #define	PNICII_MAGID_1		0	/* shift */
   1188  1.11  thorpej #define	PNICII_MAGID_0		8	/* shift */
   1189  1.11  thorpej #define	PNICII_MAGID_3		16	/* shift */
   1190  1.11  thorpej #define	PNICII_MAGID_2		24	/* shift */
   1191  1.11  thorpej 
   1192  1.11  thorpej 
   1193  1.11  thorpej /* CSR25 - CSR28 - Filter Byte Mask Registers */
   1194  1.11  thorpej #define	CSR_PNICII_MASK0	TULIP_CSR25
   1195  1.11  thorpej 
   1196  1.11  thorpej #define	CSR_PNICII_MASK1	TULIP_CSR26
   1197  1.11  thorpej 
   1198  1.11  thorpej #define	CSR_PNICII_MASK2	TULIP_CSR27
   1199  1.11  thorpej 
   1200  1.11  thorpej #define	CSR_PNICII_MASK3	TULIP_CSR28
   1201  1.11  thorpej 
   1202  1.11  thorpej 
   1203  1.11  thorpej /* CSR29 - Filter Offset Register */
   1204  1.11  thorpej #define	CSR_PNICII_FILOFF	TULIP_CSR29
   1205  1.11  thorpej #define	PNICII_FILOFF_PAT0	0x0000007f	/* pattern 0 offset */
   1206  1.11  thorpej #define	PNICII_FILOFF_EN0	0x00000080	/* enable pattern 0 */
   1207  1.11  thorpej #define	PNICII_FILOFF_PAT1	0x00007f00	/* pattern 1 offset */
   1208  1.11  thorpej #define	PNICII_FILOFF_EN1	0x00008000	/* enable pattern 1 */
   1209  1.11  thorpej #define	PNICII_FILOFF_PAT2	0x007f0000	/* pattern 2 offset */
   1210  1.11  thorpej #define	PNICII_FILOFF_EN2	0x00800000	/* enable pattern 2 */
   1211  1.11  thorpej #define	PNICII_FILOFF_PAT3	0x7f000000	/* pattern 3 offset */
   1212  1.11  thorpej #define	PNICII_FILOFF_EN3	0x80000000	/* enable pattern 3 */
   1213  1.11  thorpej 
   1214  1.11  thorpej 
   1215  1.11  thorpej /* CSR30 - Filter 1 and 0 CRC-16 Register */
   1216  1.11  thorpej #define	CSR_PNICII_FIL01	TULIP_CSR30
   1217  1.11  thorpej #define	PNICII_FIL01_CRC0	0x0000ffff	/* CRC-16 of pattern 0 */
   1218  1.11  thorpej #define	PNICII_FIL01_CRC1	0xffff0000	/* CRC-16 of pattern 1 */
   1219  1.11  thorpej 
   1220  1.11  thorpej 
   1221  1.11  thorpej /* CSR31 = Filter 3 and 2 CRC-16 Register */
   1222  1.11  thorpej #define	CSR_PNICII_FIL23	TULIP_CSR31
   1223  1.11  thorpej #define	PNICII_FIL23_CRC2	0x0000ffff	/* CRC-16 of pattern 2 */
   1224  1.11  thorpej #define	PNICII_FIL23_CRC3	0xffff0000	/* CRC-16 of pattern 3 */
   1225  1.11  thorpej 
   1226  1.11  thorpej 
   1227   1.1  thorpej /*
   1228   1.1  thorpej  * Winbond 89C840F registers.
   1229   1.1  thorpej  */
   1230   1.1  thorpej 
   1231   1.1  thorpej /* CSR12 - Current Receive Descriptor Register */
   1232   1.2  thorpej #define	CSR_WINB_CRDAR		TULIP_CSR12
   1233   1.1  thorpej 
   1234   1.1  thorpej 
   1235   1.1  thorpej /* CSR13 - Current Receive Buffer Register */
   1236   1.2  thorpej #define	CSR_WINB_CCRBAR		TULIP_CSR13
   1237   1.1  thorpej 
   1238   1.1  thorpej 
   1239   1.1  thorpej /* CSR14 - Multicast Address Register 0 */
   1240   1.2  thorpej #define	CSR_WINB_CMA0		TULIP_CSR14
   1241   1.1  thorpej 
   1242   1.1  thorpej 
   1243   1.1  thorpej /* CSR15 - Multicast Address Register 1 */
   1244   1.2  thorpej #define	CSR_WINB_CMA1		TULIP_CSR15
   1245   1.1  thorpej 
   1246   1.1  thorpej 
   1247   1.2  thorpej /* CSR16 - Physical Address Register 0 */
   1248   1.2  thorpej #define	CSR_WINB_CPA0		TULIP_CSR16
   1249   1.1  thorpej 
   1250   1.1  thorpej 
   1251   1.2  thorpej /* CSR17 - Physical Address Register 1 */
   1252   1.2  thorpej #define	CSR_WINB_CPA1		TULIP_CSR17
   1253   1.1  thorpej 
   1254   1.1  thorpej 
   1255   1.1  thorpej /* CSR18 - Boot ROM Size Register */
   1256   1.2  thorpej #define	CSR_WINB_CBRCR		TULIP_CSR18
   1257   1.2  thorpej #define	WINB_CBRCR_NONE		0x00000000	/* no boot rom */
   1258   1.2  thorpej 			/*	0x00000001	   also no boot rom */
   1259   1.2  thorpej #define	WINB_CBRCR_8K		0x00000002	/* 8k */
   1260   1.2  thorpej #define	WINB_CBRCR_16K		0x00000003	/* 16k */
   1261   1.2  thorpej #define	WINB_CBRCR_32K		0x00000004	/* 32k */
   1262   1.2  thorpej #define	WINB_CBRCR_64K		0x00000005	/* 64k */
   1263   1.2  thorpej #define	WINB_CBRCR_128K		0x00000006	/* 128k */
   1264   1.2  thorpej #define	WINB_CBRCR_256K		0x00000007
   1265   1.1  thorpej 
   1266   1.1  thorpej 
   1267   1.1  thorpej /* CSR19 - Current Transmit Descriptor Register */
   1268   1.2  thorpej #define	CSR_WINB_CTDAR		TULIP_CSR19
   1269   1.1  thorpej 
   1270   1.1  thorpej 
   1271   1.1  thorpej /* CSR20 - Current Transmit Buffer Register */
   1272   1.2  thorpej #define	CSR_WINB_CTBAR		TULIP_CSR20
   1273  1.10  thorpej 
   1274  1.10  thorpej 
   1275  1.10  thorpej /*
   1276  1.10  thorpej  * ADMtek AL981 registers
   1277  1.10  thorpej  *
   1278  1.10  thorpej  * We define these as strict byte offsets into PCI space, since
   1279  1.10  thorpej  * not all of them have consistent access rules.
   1280  1.10  thorpej  */
   1281  1.10  thorpej 
   1282  1.10  thorpej /* CSR13 - Wake-up Control/Status Register */
   1283  1.10  thorpej #define	CSR_ADM_WCSR		0x68
   1284  1.10  thorpej #define	ADM_WCSR_LSC		0x00000001	/* link status changed */
   1285  1.10  thorpej #define	ADM_WCSR_MPR		0x00000002	/* magic packet received */
   1286  1.10  thorpej #define	ADM_WCSR_WFR		0x00000004	/* wake up frame received */
   1287  1.10  thorpej #define	ADM_WCSR_LSCE		0x00000100	/* link status changed en. */
   1288  1.10  thorpej #define	ADM_WCSR_MPRE		0x00000200	/* magic packet receive en. */
   1289  1.10  thorpej #define	ADM_WCSR_WFRE		0x00000400	/* wake up frame receive en. */
   1290  1.10  thorpej #define	ADM_WCSR_LINKON		0x00010000	/* link-on detect en. */
   1291  1.10  thorpej #define	ADM_WCSR_LINKOFF	0x00020000	/* link-off detect en. */
   1292  1.10  thorpej #define	ADM_WCSR_WP5E		0x02000000	/* wake up pat. 5 en. */
   1293  1.10  thorpej #define	ADM_WCSR_WP4E		0x04000000	/* wake up pat. 4 en. */
   1294  1.10  thorpej #define	ADM_WCSR_WP3E		0x08000000	/* wake up pat. 3 en. */
   1295  1.10  thorpej #define	ADM_WCSR_WP2E		0x10000000	/* wake up pat. 2 en. */
   1296  1.10  thorpej #define	ADM_WCSR_WP1E		0x20000000	/* wake up pat. 1 en. */
   1297  1.10  thorpej #define	ADM_WCSR_CRCT		0x40000000	/* CRC-16 type:
   1298  1.10  thorpej 						   0 == 0000 initial
   1299  1.10  thorpej 						   1 == ffff initial */
   1300  1.10  thorpej 
   1301  1.10  thorpej 
   1302  1.10  thorpej /* CSR14 - Wake-up Pattern Data Register */
   1303  1.10  thorpej #define	CSR_ADM_WPDR		0x70
   1304  1.10  thorpej 
   1305  1.10  thorpej 	/*
   1306  1.10  thorpej 	 * 25 consecutive longword writes are issued to WPDR to
   1307  1.10  thorpej 	 * program the wake-up pattern filter.  The data written
   1308  1.10  thorpej 	 * is as follows:
   1309  1.10  thorpej 	 *
   1310  1.10  thorpej 	 *	XXX
   1311  1.10  thorpej 	 */
   1312  1.10  thorpej 
   1313  1.10  thorpej 
   1314  1.10  thorpej /* CSR15 - see 21140 CSR15 (Watchdog Timer) */
   1315  1.10  thorpej 
   1316  1.10  thorpej 
   1317  1.10  thorpej /* CSR16 - Assistant CSR5 (Status Register 2) */
   1318  1.10  thorpej #define	CSR_ADM_ASR		0x80
   1319  1.10  thorpej 						/* 0 - 14: same as CSR5 */
   1320  1.10  thorpej #define	ADM_ASR_AAISS		0x00080000	/* added abnormal int. sum. */
   1321  1.10  thorpej #define	ADM_ASR_ANISS		0x00010000	/* added normal int. sum. */
   1322  1.10  thorpej 						/* XXX Receive state */
   1323  1.10  thorpej 						/* XXX Transmit state */
   1324  1.10  thorpej #define	ADM_ASR_BET		0x03800000	/* bus error type */
   1325  1.10  thorpej #define	ADM_ASR_BET_PERR	0x00000000	/*   parity error */
   1326  1.10  thorpej #define	ADM_ASR_BET_MABT	0x00800000	/*   master abort */
   1327  1.10  thorpej #define	ADM_ASR_BET_TABT	0x01000000	/*   target abort */
   1328  1.10  thorpej #define	ADM_ASR_PFR		0x04000000	/* PAUSE frame received */
   1329  1.10  thorpej #define	ADM_ASR_TDIS		0x10000000	/* transmit def. int. status */
   1330  1.10  thorpej #define	ADM_ASR_XIS		0x20000000	/* xcvr int. status */
   1331  1.10  thorpej #define	ADM_ASR_REIS		0x40000000	/* receive early int. status */
   1332  1.10  thorpej #define	ADM_ASR_TEIS		0x80000000	/* transmit early int. status */
   1333  1.10  thorpej 
   1334  1.10  thorpej 
   1335  1.10  thorpej /* CSR17 - Assistant CSR7 (Interrupt Enable Register 2) */
   1336  1.10  thorpej #define	CSR_ADM_AIE		0x84
   1337  1.10  thorpej 	/* See CSR16 for valid bits */
   1338  1.10  thorpej 
   1339  1.10  thorpej 
   1340  1.10  thorpej /* CSR18 - Command Register */
   1341  1.10  thorpej #define	CSR_ADM_CR		0x88
   1342  1.10  thorpej #define	ADM_CR_ATUR		0x00000001	/* auto. tx underrun recover */
   1343  1.10  thorpej #define	ADM_CR_SINT		0x00000002	/* software interrupt */
   1344  1.10  thorpej #define	ADM_CR_DRT		0x0000000c	/* drain recieve threshold */
   1345  1.10  thorpej #define	ADM_CR_DRT_8LW		0x00000000	/*   8 longwords */
   1346  1.10  thorpej #define	ADM_CR_DRT_16LW		0x00000004	/*   16 longwords */
   1347  1.10  thorpej #define	ADM_CR_DRT_SF		0x00000008	/*   store-and-forward */
   1348  1.10  thorpej #define	ADM_CR_RTE		0x00000010	/* receive threshold enable */
   1349  1.10  thorpej #define	ADM_CR_PAUSE		0x00000020	/* enable PAUSE function */
   1350  1.10  thorpej #define	ADM_CR_RWP		0x00000040	/* reset wake-up pattern
   1351  1.10  thorpej 						   data register pointer */
   1352  1.10  thorpej 	/* 16 - 31 are automatically recalled from the EEPROM */
   1353  1.10  thorpej #define	ADM_CR_WOL		0x00040000	/* wake-on-lan enable */
   1354  1.10  thorpej #define	ADM_CR_PM		0x00080000	/* power management enable */
   1355  1.10  thorpej #define	ADM_CR_RFS		0x00600000	/* Receive FIFO size */
   1356  1.10  thorpej #define	ADM_CR_RFS_1K		0x00600000	/*   1K FIFO */
   1357  1.10  thorpej #define	ADM_CR_RFS_2K		0x00400000	/*   2K FIFO */
   1358  1.10  thorpej #define	ADM_CR_LEDMODE		0x00800000	/* LED mode */
   1359  1.10  thorpej #define	ADM_CR_AUXCL		0x30000000	/* aux current load */
   1360  1.10  thorpej #define	ADM_CR_D3CS		0x80000000	/* D3 cold wake up enable */
   1361  1.10  thorpej 
   1362  1.10  thorpej 
   1363  1.10  thorpej /* CSR19 - PCI bus performance counter */
   1364  1.10  thorpej #define	CSR_ADM_PCIC		0x8c
   1365  1.10  thorpej #define	ADM_PCIC_DWCNT		0x000000ff	/* double-word count of
   1366  1.10  thorpej 						   last bus-master
   1367  1.10  thorpej 						   transaction */
   1368  1.10  thorpej #define	ADM_PCIC_CLKCNT		0xffff0000	/* number of PCI clocks
   1369  1.10  thorpej 						   between read request
   1370  1.10  thorpej 						   and access completed */
   1371  1.10  thorpej 
   1372  1.10  thorpej /* CSR20 - Power Management Control/Status Register */
   1373  1.10  thorpej #define	CSR_ADM_PMCSR		0x90
   1374  1.10  thorpej 	/*
   1375  1.10  thorpej 	 * This register is also mapped into the PCI configuration
   1376  1.10  thorpej 	 * space as the PMCSR.
   1377  1.10  thorpej 	 */
   1378  1.10  thorpej 
   1379  1.10  thorpej 
   1380  1.10  thorpej /* CSR23 - Transmit Burst Count/Time Out Register */
   1381  1.10  thorpej #define	CSR_ADM_TXBR		0x9c
   1382  1.11  thorpej #define	ADM_TXBR_TTO		0x00000fff	/* transmit timeout */
   1383  1.11  thorpej #define	ADM_TXBR_TBCNT		0x001f0000	/* transmit burst count */
   1384  1.10  thorpej 
   1385  1.10  thorpej 
   1386  1.10  thorpej /* CSR24 - Flash ROM Port Register */
   1387  1.10  thorpej #define	CSR_ADM_FROM		0xa0
   1388  1.11  thorpej #define	ADM_FROM_DATA		0x000000ff	/* data to/from Flash */
   1389  1.11  thorpej #define	ADM_FROM_ADDR		0x01ffff00	/* Flash address */
   1390  1.11  thorpej #define	ADM_FROM_ADDR_SHIFT	8
   1391  1.11  thorpej #define	ADM_FROM_WEN		0x04000000	/* write enable */
   1392  1.11  thorpej #define	ADM_FROM_REN		0x08000000	/* read enable */
   1393  1.11  thorpej #define	ADM_FROM_bra16on	0x80000000	/* pin 87 is brA16, else
   1394  1.11  thorpej 						   pin 87 is fd/col LED pin */
   1395  1.10  thorpej 
   1396  1.10  thorpej 
   1397  1.10  thorpej /* CSR25 - Physical Address Register 0 */
   1398  1.10  thorpej #define	CSR_ADM_PAR0		0xa4
   1399  1.10  thorpej 
   1400  1.10  thorpej 
   1401  1.10  thorpej /* CSR26 - Physical Address Register 1 */
   1402  1.10  thorpej #define	CSR_ADM_PAR1		0xa8
   1403  1.10  thorpej 
   1404  1.10  thorpej 
   1405  1.10  thorpej /* CSR27 - Multicast Address Register 0 */
   1406  1.10  thorpej #define	CSR_ADM_MAR0		0xac
   1407  1.10  thorpej 
   1408  1.10  thorpej 
   1409  1.10  thorpej /* CSR28 - Multicast Address Register 1 */
   1410  1.10  thorpej #define	CSR_ADM_MAR1		0xb0
   1411  1.10  thorpej 
   1412  1.10  thorpej 
   1413  1.10  thorpej /* Internal PHY registers are mapped here (lower 16 bits valid) */
   1414  1.10  thorpej 
   1415  1.10  thorpej #define	CSR_ADM_BMCR		0xb4
   1416  1.10  thorpej #define	CSR_ADM_BMSR		0xb8
   1417  1.10  thorpej #define	CSR_ADM_PHYIDR1		0xbc
   1418  1.10  thorpej #define	CSR_ADM_PHYIDR2		0xc0
   1419  1.10  thorpej #define	CSR_ADM_ANAR		0xc4
   1420  1.10  thorpej #define	CSR_ADM_ANLPAR		0xc8
   1421  1.10  thorpej #define	CSR_ADM_ANER		0xcc
   1422  1.10  thorpej 
   1423  1.10  thorpej /* XCVR Mode Control Register */
   1424  1.10  thorpej #define	CSR_ADM_XMC		0xd0
   1425  1.11  thorpej #define	ADM_XMC_LD		0x00000800	/* long distance mode
   1426  1.11  thorpej 						   (low squelch enable) */
   1427  1.11  thorpej 
   1428  1.10  thorpej 
   1429  1.10  thorpej /* XCVR Configuration Information and Interrupt Status Register */
   1430  1.10  thorpej #define	CSR_ADM_XCIIS		0xd4
   1431  1.11  thorpej #define	ADM_XCIIS_REF		0x0001		/* 64 error packets received */
   1432  1.11  thorpej #define	ADM_XCIIS_ANPR		0x0002		/* autoneg page received */
   1433  1.11  thorpej #define	ADM_XCIIS_PDF		0x0004		/* parallel detection fault */
   1434  1.11  thorpej #define	ADM_XCIIS_ANAR		0x0008		/* autoneg ACK */
   1435  1.11  thorpej #define	ADM_XCIIS_LS		0x0010		/* link status (1 == fail) */
   1436  1.11  thorpej #define	ADM_XCIIS_RFD		0x0020		/* remote fault */
   1437  1.11  thorpej #define	ADM_XCIIS_ANC		0x0040		/* autoneg completed */
   1438  1.11  thorpej #define	ADM_XCIIS_PAUSE		0x0080		/* PAUSE enabled */
   1439  1.11  thorpej #define	ADM_XCIIS_DUPLEX	0x0100		/* full duplex */
   1440  1.11  thorpej #define	ADM_XCIIS_SPEED		0x0200		/* 100Mb/s */
   1441  1.11  thorpej 
   1442  1.10  thorpej 
   1443  1.10  thorpej /* XCVR Interrupt Enable Register */
   1444  1.10  thorpej #define	CSR_ADM_XIE		0xd8
   1445  1.11  thorpej 	/* Bits are as for XCIIS */
   1446  1.11  thorpej 
   1447  1.10  thorpej 
   1448  1.10  thorpej /* XCVR 100baseTX PHY Control/Status Register */
   1449  1.10  thorpej #define	CSR_ADM_100CTR		0xdc
   1450  1.11  thorpej #define	ADM_100CTR_DISCRM	0x0001		/* disable scrambler */
   1451  1.11  thorpej #define	ADM_100CTR_DISMLT	0x0002		/* disable MLT3 ENDEC */
   1452  1.11  thorpej #define	ADM_100CTR_CMODE	0x001c		/* current operating mode */
   1453  1.11  thorpej #define	ADM_100CTR_CMODE_AUTO	0x0000		/*   in autoneg */
   1454  1.11  thorpej #define	ADM_100CTR_CMODE_10	0x0004		/*   10baseT */
   1455  1.11  thorpej #define	ADM_100CTR_CMODE_100	0x0008		/*   100baseTX */
   1456  1.11  thorpej 			/*	0x000c		     reserved */
   1457  1.11  thorpej 			/*	0x0010		     reserved */
   1458  1.11  thorpej #define	ADM_100CTR_CMODE_10FD	0x0014		/*   10baseT-FDX */
   1459  1.11  thorpej #define	ADM_100CTR_CMODE_100FD	0x0018		/*   100baseTX-FDX */
   1460  1.11  thorpej #define	ADM_100CTR_CMODE_ISO	0x001c		/*   isolated */
   1461  1.11  thorpej #define	ADM_100CTR_ISOTX	0x0020		/* transmit isolation */
   1462  1.11  thorpej #define	ADM_100CTR_ENRZI	0x0080		/* enable NRZ <> NRZI conv. */
   1463  1.11  thorpej #define	ADM_100CTR_ENDCR	0x0100		/* enable DC restoration */
   1464  1.11  thorpej #define	ADM_100CTR_ENRLB	0x0200		/* enable remote loopback */
   1465  1.11  thorpej #define	ADM_100CTR_RXVPP	0x0800		/* peak Rx voltage:
   1466  1.11  thorpej 						   0 == 1.0 VPP
   1467  1.11  thorpej 						   1 == 1.4 VPP */
   1468  1.11  thorpej #define	ADM_100CTR_ANC		0x1000		/* autoneg completed */
   1469  1.11  thorpej #define	ADM_100CTR_DISRER	0x2000		/* disable Rx error counter */
   1470  1.23  thorpej 
   1471  1.23  thorpej /* Operation Mode Register (AN983) */
   1472  1.23  thorpej #define	CSR_ADM983_OPMODE	0xfc
   1473  1.23  thorpej #define	ADM983_OPMODE_SPEED	0x80000000	/* 1 == 100, 0 == 10 */
   1474  1.23  thorpej #define	ADM983_OPMODE_FD	0x40000000	/* 1 == fd, 0 == hd */
   1475  1.23  thorpej #define	ADM983_OPMODE_LINK	0x20000000	/* 1 == link, 0 == no link */
   1476  1.23  thorpej #define	ADM983_OPMODE_EERLOD	0x04000000	/* reload from EEPROM */
   1477  1.23  thorpej #define	ADM983_OPMODE_SingleChip 0x00000007	/* single-chip mode */
   1478  1.23  thorpej #define	ADM983_OPMODE_MacOnly	 0x00000004	/* MAC-only mode */
   1479  1.18  thorpej 
   1480  1.18  thorpej /*
   1481  1.18  thorpej  * Xircom X3201-3 registers
   1482  1.18  thorpej  */
   1483  1.18  thorpej 
   1484  1.18  thorpej /* Power Management Register */
   1485  1.18  thorpej #define	CSR_X3201_PMR		TULIP_CSR16
   1486  1.18  thorpej #define	X3201_PMR_EDINT		0x0000000f	/* energy detect interval */
   1487  1.18  thorpej #define	X3201_PMR_EDEN		0x00000100	/* energy detect enable */
   1488  1.18  thorpej #define	X3201_PMR_MPEN		0x00000200	/* magic packet enable */
   1489  1.18  thorpej #define	X3201_PMR_WOLEN		0x00000400	/* Wake On Lan enable */
   1490  1.18  thorpej #define	X3201_PMR_PMGP0EN	0x00001000	/* GP0 change enable */
   1491  1.18  thorpej #define	X3201_PMR_PMLCEN	0x00002000	/* link change enable */
   1492  1.18  thorpej #define	X3201_PMR_WOLTMEN	0x00008000	/* WOL template mem enable */
   1493  1.18  thorpej #define	X3201_PMR_EP		0x00010000	/* energy present */
   1494  1.18  thorpej #define	X3201_PMR_LP		0x00200000	/* link present */
   1495  1.18  thorpej #define	X3201_PMR_EDES		0x01000000	/* ED event status */
   1496  1.18  thorpej #define	X3201_PMR_MPES		0x02000000	/* MP event status */
   1497  1.18  thorpej #define	X3201_PMR_WOLES		0x04000000	/* WOL event status */
   1498  1.18  thorpej #define	X3201_PMR_WOLPS		0x08000000	/* WOL process status */
   1499  1.18  thorpej #define	X3201_PMR_GP0ES		0x10000000	/* GP0 event status */
   1500  1.18  thorpej #define	X3201_PMR_LCES		0x20000000	/* LC event status */
   1501  1.20  thorpej 
   1502  1.20  thorpej /*
   1503  1.20  thorpej  * Davicom DM9102 registers.
   1504  1.20  thorpej  */
   1505  1.20  thorpej 
   1506  1.20  thorpej /* PHY Status Register */
   1507  1.20  thorpej #define	CSR_DM_PHYSTAT		TULIP_CSR12
   1508  1.20  thorpej #define	DM_PHYSTAT_10		0x00000001	/* 10Mb/s */
   1509  1.20  thorpej #define	DM_PHYSTAT_100		0x00000002	/* 100Mb/s */
   1510  1.20  thorpej #define	DM_PHYSTAT_FDX		0x00000004	/* full-duplex */
   1511  1.20  thorpej #define	DM_PHYSTAT_LINK		0x00000008	/* link up */
   1512  1.20  thorpej #define	DM_PHYSTAT_RXLOCK	0x00000010	/* RX-lock */
   1513  1.20  thorpej #define	DM_PHYSTAT_SIGNAL	0x00000020	/* signal detection */
   1514  1.20  thorpej #define	DM_PHYSTAT_UTPSIG	0x00000040	/* UTP SIG */
   1515  1.20  thorpej #define	DM_PHYSTAT_GPED		0x00000080	/* general PHY reset control */
   1516  1.20  thorpej #define	DM_PHYSTAT_GEPC		0x00000100	/* GPED bits control */
   1517  1.20  thorpej 
   1518  1.20  thorpej 
   1519  1.20  thorpej /* Sample Frame Access Register */
   1520  1.20  thorpej #define	CSR_DM_SFAR		TULIP_CSR13
   1521  1.20  thorpej 
   1522  1.20  thorpej 
   1523  1.20  thorpej /* Sample Frame Data Register */
   1524  1.20  thorpej #define	CSR_DM_SFDR		TULIP_CSR14
   1525  1.20  thorpej 	/* See 21143 SIAGEN register */
   1526   1.1  thorpej 
   1527   1.1  thorpej #endif /* _DEV_IC_TULIPREG_H_ */
   1528