1*0c480523Sjason /* $OpenBSD: if_tlreg.h,v 1.3 1999/09/13 20:41:40 jason Exp $ */ 2*0c480523Sjason 370c52ebfSjason /* 470c52ebfSjason * Copyright (c) 1997, 1998 570c52ebfSjason * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 670c52ebfSjason * 770c52ebfSjason * Redistribution and use in source and binary forms, with or without 870c52ebfSjason * modification, are permitted provided that the following conditions 970c52ebfSjason * are met: 1070c52ebfSjason * 1. Redistributions of source code must retain the above copyright 1170c52ebfSjason * notice, this list of conditions and the following disclaimer. 1270c52ebfSjason * 2. Redistributions in binary form must reproduce the above copyright 1370c52ebfSjason * notice, this list of conditions and the following disclaimer in the 1470c52ebfSjason * documentation and/or other materials provided with the distribution. 1570c52ebfSjason * 3. All advertising materials mentioning features or use of this software 1670c52ebfSjason * must display the following acknowledgement: 1770c52ebfSjason * This product includes software developed by Bill Paul. 1870c52ebfSjason * 4. Neither the name of the author nor the names of any co-contributors 1970c52ebfSjason * may be used to endorse or promote products derived from this software 2070c52ebfSjason * without specific prior written permission. 2170c52ebfSjason * 2270c52ebfSjason * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 2370c52ebfSjason * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2470c52ebfSjason * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2570c52ebfSjason * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 2670c52ebfSjason * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2770c52ebfSjason * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2870c52ebfSjason * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2970c52ebfSjason * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3070c52ebfSjason * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3170c52ebfSjason * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 3270c52ebfSjason * THE POSSIBILITY OF SUCH DAMAGE. 3370c52ebfSjason * 34cfe52e88Sjason * $FreeBSD: if_tlreg.h,v 1.7 1998/10/31 17:23:48 wpaul Exp $ 3570c52ebfSjason */ 3670c52ebfSjason 3770c52ebfSjason 3870c52ebfSjason struct tl_type { 3970c52ebfSjason u_int16_t tl_vid; 4070c52ebfSjason u_int16_t tl_did; 4170c52ebfSjason char *tl_name; 4270c52ebfSjason }; 4370c52ebfSjason 4470c52ebfSjason /* 4570c52ebfSjason * ThunderLAN TX/RX list format. The TX and RX lists are pretty much 4670c52ebfSjason * identical: the list begins with a 32-bit forward pointer which points 4770c52ebfSjason * at the next list in the chain, followed by 16 bits for the total 4870c52ebfSjason * frame size, and a 16 bit status field. This is followed by a series 4970c52ebfSjason * of 10 32-bit data count/data address pairs that point to the fragments 5070c52ebfSjason * that make up the complete frame. 5170c52ebfSjason */ 5270c52ebfSjason 5370c52ebfSjason #define TL_MAXFRAGS 10 54cfe52e88Sjason #define TL_RX_LIST_CNT 20 55cfe52e88Sjason #define TL_TX_LIST_CNT 20 5670c52ebfSjason #define TL_MIN_FRAMELEN 64 5770c52ebfSjason 5870c52ebfSjason struct tl_frag { 5970c52ebfSjason u_int32_t tlist_dcnt; 6070c52ebfSjason u_int32_t tlist_dadr; 6170c52ebfSjason }; 6270c52ebfSjason 6370c52ebfSjason struct tl_list { 6470c52ebfSjason u_int32_t tlist_fptr; /* phys address of next list */ 6570c52ebfSjason u_int16_t tlist_cstat; /* status word */ 6670c52ebfSjason u_int16_t tlist_frsize; /* size of data in frame */ 6770c52ebfSjason struct tl_frag tl_frag[TL_MAXFRAGS]; 6870c52ebfSjason }; 6970c52ebfSjason 7070c52ebfSjason /* 7170c52ebfSjason * This is a special case of an RX list. By setting the One_Frag 7270c52ebfSjason * bit in the NETCONFIG register, the driver can force the ThunderLAN 7370c52ebfSjason * chip to use only one fragment when DMAing RX frames. 7470c52ebfSjason */ 7570c52ebfSjason 7670c52ebfSjason struct tl_list_onefrag { 7770c52ebfSjason u_int32_t tlist_fptr; 7870c52ebfSjason u_int16_t tlist_cstat; 7970c52ebfSjason u_int16_t tlist_frsize; 8070c52ebfSjason struct tl_frag tl_frag; 8170c52ebfSjason }; 8270c52ebfSjason 8370c52ebfSjason struct tl_list_data { 8470c52ebfSjason struct tl_list_onefrag tl_rx_list[TL_RX_LIST_CNT]; 8570c52ebfSjason struct tl_list tl_tx_list[TL_TX_LIST_CNT]; 8670c52ebfSjason unsigned char tl_pad[TL_MIN_FRAMELEN]; 8770c52ebfSjason }; 8870c52ebfSjason 8970c52ebfSjason struct tl_chain { 9070c52ebfSjason struct tl_list *tl_ptr; 9170c52ebfSjason struct mbuf *tl_mbuf; 9270c52ebfSjason struct tl_chain *tl_next; 9370c52ebfSjason }; 9470c52ebfSjason 9570c52ebfSjason struct tl_chain_onefrag { 9670c52ebfSjason struct tl_list_onefrag *tl_ptr; 9770c52ebfSjason struct mbuf *tl_mbuf; 9870c52ebfSjason struct tl_chain_onefrag *tl_next; 9970c52ebfSjason }; 10070c52ebfSjason 10170c52ebfSjason struct tl_chain_data { 10270c52ebfSjason struct tl_chain_onefrag tl_rx_chain[TL_RX_LIST_CNT]; 10370c52ebfSjason struct tl_chain tl_tx_chain[TL_TX_LIST_CNT]; 10470c52ebfSjason 10570c52ebfSjason struct tl_chain_onefrag *tl_rx_head; 10670c52ebfSjason struct tl_chain_onefrag *tl_rx_tail; 10770c52ebfSjason 10870c52ebfSjason struct tl_chain *tl_tx_head; 10970c52ebfSjason struct tl_chain *tl_tx_tail; 11070c52ebfSjason struct tl_chain *tl_tx_free; 11170c52ebfSjason }; 11270c52ebfSjason 11370c52ebfSjason struct tl_softc { 11470c52ebfSjason #ifdef __OpenBSD__ 11570c52ebfSjason struct device sc_dev; /* generic device structure */ 11670c52ebfSjason void * sc_ih; /* interrupt handler cookie */ 11770c52ebfSjason #endif 11870c52ebfSjason struct arpcom arpcom; /* interface info */ 11970c52ebfSjason struct ifmedia ifmedia; /* media info */ 120*0c480523Sjason bus_space_handle_t tl_bhandle; 121*0c480523Sjason bus_space_tag_t tl_btag; 12270c52ebfSjason struct tl_type *tl_dinfo; /* ThunderLAN adapter info */ 12370c52ebfSjason struct tl_type *tl_pinfo; /* PHY info struct */ 12470c52ebfSjason u_int8_t tl_ctlr; /* chip number */ 12570c52ebfSjason u_int8_t tl_unit; /* interface number */ 12670c52ebfSjason u_int8_t tl_eeaddr; 12770c52ebfSjason u_int8_t tl_empty_intr; /* expecting empty interrupt */ 12870c52ebfSjason u_int8_t tl_phy_addr; /* PHY address */ 12970c52ebfSjason u_int8_t tl_tx_pend; /* TX pending */ 13070c52ebfSjason u_int8_t tl_want_auto; /* autoneg scheduled */ 13170c52ebfSjason u_int8_t tl_autoneg; /* autoneg in progress */ 13270c52ebfSjason u_int16_t tl_phy_sts; /* PHY status */ 13370c52ebfSjason u_int16_t tl_phy_vid; /* PHY vendor ID */ 13470c52ebfSjason u_int16_t tl_phy_did; /* PHY device ID */ 13570c52ebfSjason caddr_t tl_ldata_ptr; 13670c52ebfSjason struct tl_list_data *tl_ldata; /* TX/RX lists and mbufs */ 13770c52ebfSjason struct tl_chain_data tl_cdata; 138*0c480523Sjason u_int8_t tl_txeoc; 139*0c480523Sjason u_int8_t tl_bitrate; 14070c52ebfSjason #ifdef __FreeBSD__ 14170c52ebfSjason struct callout_handle tl_stat_ch; 14270c52ebfSjason #endif 14370c52ebfSjason }; 14470c52ebfSjason 14570c52ebfSjason /* 14670c52ebfSjason * Transmit interrupt threshold. 14770c52ebfSjason */ 148cfe52e88Sjason #define TX_THR 0x00000004 14970c52ebfSjason 15070c52ebfSjason #define TL_FLAG_FORCEDELAY 1 15170c52ebfSjason #define TL_FLAG_SCHEDDELAY 2 15270c52ebfSjason #define TL_FLAG_DELAYTIMEO 3 15370c52ebfSjason 15470c52ebfSjason /* 15570c52ebfSjason * The ThunderLAN supports up to 32 PHYs. 15670c52ebfSjason */ 15770c52ebfSjason #define TL_PHYADDR_MIN 0x00 15870c52ebfSjason #define TL_PHYADDR_MAX 0x1F 15970c52ebfSjason 16070c52ebfSjason #define PHY_UNKNOWN 6 16170c52ebfSjason 16270c52ebfSjason #define TL_PHYS_IDLE -1 16370c52ebfSjason 16470c52ebfSjason /* 16570c52ebfSjason * General constants that are fun to know. 16670c52ebfSjason * 16770c52ebfSjason * The ThunderLAN controller is made by Texas Instruments. The 16870c52ebfSjason * manual indicates that if the EEPROM checksum fails, the PCI 16970c52ebfSjason * vendor and device ID registers will be loaded with TI-specific 17070c52ebfSjason * values. 17170c52ebfSjason */ 17270c52ebfSjason #define TI_VENDORID 0x104C 17370c52ebfSjason #define TI_DEVICEID_THUNDERLAN 0x0500 17470c52ebfSjason 17570c52ebfSjason /* 17670c52ebfSjason * Known PHY Ids. According to the Level 1 documentation (which is 17770c52ebfSjason * very nice, incidentally), here's how they work: 17870c52ebfSjason * 17970c52ebfSjason * The PHY identifier register #1 is composed of bits 3 through 18 18070c52ebfSjason * of the OUI. (First 16-bit word.) 18170c52ebfSjason * The PHY identifier register #2 is composed of bits 19 through 24 18270c52ebfSjason * if the OUI. 18370c52ebfSjason * This is followed by 6 bits containing the manufacturer's model 18470c52ebfSjason * number. 18570c52ebfSjason * Lastly, there are 4 bits for the manufacturer's revision number. 18670c52ebfSjason * 18770c52ebfSjason * Honestly, there are a lot of these that don't make any sense; the 18870c52ebfSjason * only way to be really sure is to look at the data sheets. 18970c52ebfSjason */ 19070c52ebfSjason 19170c52ebfSjason /* 19270c52ebfSjason * Texas Instruments PHY identifiers 19370c52ebfSjason * 19470c52ebfSjason * The ThunderLAN manual has a curious and confusing error in it. 19570c52ebfSjason * In chapter 7, which describes PHYs, it says that TI PHYs have 19670c52ebfSjason * the following ID codes, where xx denotes a revision: 19770c52ebfSjason * 19870c52ebfSjason * 0x4000501xx internal 10baseT PHY 19970c52ebfSjason * 0x4000502xx TNETE211 100VG-AnyLan PMI 20070c52ebfSjason * 20170c52ebfSjason * The problem here is that these are not valid 32-bit hex numbers: 20270c52ebfSjason * there's one digit too many. My guess is that they mean the internal 20370c52ebfSjason * 10baseT PHY is 0x4000501x and the TNETE211 is 0x4000502x since these 20470c52ebfSjason * are the only numbers that make sense. 20570c52ebfSjason */ 20670c52ebfSjason #define TI_PHY_VENDORID 0x4000 20770c52ebfSjason #define TI_PHY_10BT 0x501F 20870c52ebfSjason #define TI_PHY_100VGPMI 0x502F 20970c52ebfSjason 21070c52ebfSjason /* 21170c52ebfSjason * These ID values are for the NS DP83840A 10/100 PHY 21270c52ebfSjason */ 21370c52ebfSjason #define NS_PHY_VENDORID 0x2000 21470c52ebfSjason #define NS_PHY_83840A 0x5C0F 21570c52ebfSjason 21670c52ebfSjason /* 21770c52ebfSjason * Level 1 10/100 PHY 21870c52ebfSjason */ 21970c52ebfSjason #define LEVEL1_PHY_VENDORID 0x7810 22070c52ebfSjason #define LEVEL1_PHY_LXT970 0x000F 22170c52ebfSjason 22270c52ebfSjason /* 22370c52ebfSjason * Intel 82555 10/100 PHY 22470c52ebfSjason */ 22570c52ebfSjason #define INTEL_PHY_VENDORID 0x0A28 22670c52ebfSjason #define INTEL_PHY_82555 0x015F 22770c52ebfSjason 22870c52ebfSjason /* 22970c52ebfSjason * SEEQ 80220 10/100 PHY 23070c52ebfSjason */ 23170c52ebfSjason #define SEEQ_PHY_VENDORID 0x0016 23270c52ebfSjason #define SEEQ_PHY_80220 0xF83F 23370c52ebfSjason 23470c52ebfSjason /* 23570c52ebfSjason * These are the PCI vendor and device IDs for Compaq ethernet 23670c52ebfSjason * adapters based on the ThunderLAN controller. 23770c52ebfSjason */ 23870c52ebfSjason #define COMPAQ_VENDORID 0x0E11 23970c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10_100 0xAE32 24070c52ebfSjason #define COMPAQ_DEVICEID_NETEL_UNKNOWN 0xAE33 24170c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10 0xAE34 24270c52ebfSjason #define COMPAQ_DEVICEID_NETFLEX_3P_INTEGRATED 0xAE35 24370c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10_100_DUAL 0xAE40 24470c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10_100_PROLIANT 0xAE43 24570c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10_100_EMBEDDED 0xB011 24670c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10_T2_UTP_COAX 0xB012 24770c52ebfSjason #define COMPAQ_DEVICEID_NETEL_10_100_TX_UTP 0xB030 24870c52ebfSjason #define COMPAQ_DEVICEID_NETFLEX_3P 0xF130 24970c52ebfSjason #define COMPAQ_DEVICEID_NETFLEX_3P_BNC 0xF150 25070c52ebfSjason 25170c52ebfSjason /* 25270c52ebfSjason * These are the PCI vendor and device IDs for Olicom 25370c52ebfSjason * adapters based on the ThunderLAN controller. 25470c52ebfSjason */ 25570c52ebfSjason #define OLICOM_VENDORID 0x108D 25670c52ebfSjason #define OLICOM_DEVICEID_OC2183 0x0013 25770c52ebfSjason #define OLICOM_DEVICEID_OC2325 0x0012 25870c52ebfSjason #define OLICOM_DEVICEID_OC2326 0x0014 25970c52ebfSjason 26070c52ebfSjason /* 26170c52ebfSjason * PCI low memory base and low I/O base 26270c52ebfSjason */ 26370c52ebfSjason #define TL_PCI_LOIO 0x10 26470c52ebfSjason #define TL_PCI_LOMEM 0x14 26570c52ebfSjason 26670c52ebfSjason /* 26770c52ebfSjason * PCI latency timer (it's actually 0x0D, but we want a value 26870c52ebfSjason * that's longword aligned). 26970c52ebfSjason */ 27070c52ebfSjason #define TL_PCI_LATENCY_TIMER 0x0C 27170c52ebfSjason 27270c52ebfSjason #define TL_DIO_ADDR_INC 0x8000 /* Increment addr on each read */ 27370c52ebfSjason #define TL_DIO_RAM_SEL 0x4000 /* RAM address select */ 27470c52ebfSjason #define TL_DIO_ADDR_MASK 0x3FFF /* address bits mask */ 27570c52ebfSjason 27670c52ebfSjason /* 27770c52ebfSjason * Interrupt types 27870c52ebfSjason */ 27970c52ebfSjason #define TL_INTR_INVALID 0x0 28070c52ebfSjason #define TL_INTR_TXEOF 0x1 28170c52ebfSjason #define TL_INTR_STATOFLOW 0x2 28270c52ebfSjason #define TL_INTR_RXEOF 0x3 28370c52ebfSjason #define TL_INTR_DUMMY 0x4 28470c52ebfSjason #define TL_INTR_TXEOC 0x5 28570c52ebfSjason #define TL_INTR_ADCHK 0x6 28670c52ebfSjason #define TL_INTR_RXEOC 0x7 28770c52ebfSjason 28870c52ebfSjason #define TL_INT_MASK 0x001C 28970c52ebfSjason #define TL_VEC_MASK 0x1FE0 29070c52ebfSjason /* 29170c52ebfSjason * Host command register bits 29270c52ebfSjason */ 29370c52ebfSjason #define TL_CMD_GO 0x80000000 29470c52ebfSjason #define TL_CMD_STOP 0x40000000 29570c52ebfSjason #define TL_CMD_ACK 0x20000000 29670c52ebfSjason #define TL_CMD_CHSEL7 0x10000000 29770c52ebfSjason #define TL_CMD_CHSEL6 0x08000000 29870c52ebfSjason #define TL_CMD_CHSEL5 0x04000000 29970c52ebfSjason #define TL_CMD_CHSEL4 0x02000000 30070c52ebfSjason #define TL_CMD_CHSEL3 0x01000000 30170c52ebfSjason #define TL_CMD_CHSEL2 0x00800000 30270c52ebfSjason #define TL_CMD_CHSEL1 0x00400000 30370c52ebfSjason #define TL_CMD_CHSEL0 0x00200000 30470c52ebfSjason #define TL_CMD_EOC 0x00100000 30570c52ebfSjason #define TL_CMD_RT 0x00080000 30670c52ebfSjason #define TL_CMD_NES 0x00040000 30770c52ebfSjason #define TL_CMD_ZERO0 0x00020000 30870c52ebfSjason #define TL_CMD_ZERO1 0x00010000 30970c52ebfSjason #define TL_CMD_ADRST 0x00008000 31070c52ebfSjason #define TL_CMD_LDTMR 0x00004000 31170c52ebfSjason #define TL_CMD_LDTHR 0x00002000 31270c52ebfSjason #define TL_CMD_REQINT 0x00001000 31370c52ebfSjason #define TL_CMD_INTSOFF 0x00000800 31470c52ebfSjason #define TL_CMD_INTSON 0x00000400 31570c52ebfSjason #define TL_CMD_RSVD0 0x00000200 31670c52ebfSjason #define TL_CMD_RSVD1 0x00000100 31770c52ebfSjason #define TL_CMD_ACK7 0x00000080 31870c52ebfSjason #define TL_CMD_ACK6 0x00000040 31970c52ebfSjason #define TL_CMD_ACK5 0x00000020 32070c52ebfSjason #define TL_CMD_ACK4 0x00000010 32170c52ebfSjason #define TL_CMD_ACK3 0x00000008 32270c52ebfSjason #define TL_CMD_ACK2 0x00000004 32370c52ebfSjason #define TL_CMD_ACK1 0x00000002 32470c52ebfSjason #define TL_CMD_ACK0 0x00000001 32570c52ebfSjason 32670c52ebfSjason #define TL_CMD_CHSEL_MASK 0x01FE0000 32770c52ebfSjason #define TL_CMD_ACK_MASK 0xFF 32870c52ebfSjason 32970c52ebfSjason /* 33070c52ebfSjason * EEPROM address where station address resides. 33170c52ebfSjason */ 33270c52ebfSjason #define TL_EEPROM_EADDR 0x83 33370c52ebfSjason #define TL_EEPROM_EADDR2 0x99 33470c52ebfSjason #define TL_EEPROM_EADDR3 0xAF 33570c52ebfSjason #define TL_EEPROM_EADDR_OC 0xF8 /* Olicom cards use a different 33670c52ebfSjason address than Compaqs. */ 33770c52ebfSjason /* 33870c52ebfSjason * ThunderLAN host command register offsets. 33970c52ebfSjason * (Can be accessed either by IO ports or memory map.) 34070c52ebfSjason */ 34170c52ebfSjason #define TL_HOSTCMD 0x00 34270c52ebfSjason #define TL_CH_PARM 0x04 34370c52ebfSjason #define TL_DIO_ADDR 0x08 34470c52ebfSjason #define TL_HOST_INT 0x0A 34570c52ebfSjason #define TL_DIO_DATA 0x0C 34670c52ebfSjason 34770c52ebfSjason /* 34870c52ebfSjason * ThunderLAN internal registers 34970c52ebfSjason */ 35070c52ebfSjason #define TL_NETCMD 0x00 35170c52ebfSjason #define TL_NETSIO 0x01 35270c52ebfSjason #define TL_NETSTS 0x02 35370c52ebfSjason #define TL_NETMASK 0x03 35470c52ebfSjason 35570c52ebfSjason #define TL_NETCONFIG 0x04 35670c52ebfSjason #define TL_MANTEST 0x06 35770c52ebfSjason 35870c52ebfSjason #define TL_VENID_LSB 0x08 35970c52ebfSjason #define TL_VENID_MSB 0x09 36070c52ebfSjason #define TL_DEVID_LSB 0x0A 36170c52ebfSjason #define TL_DEVID_MSB 0x0B 36270c52ebfSjason 36370c52ebfSjason #define TL_REVISION 0x0C 36470c52ebfSjason #define TL_SUBCLASS 0x0D 36570c52ebfSjason #define TL_MINLAT 0x0E 36670c52ebfSjason #define TL_MAXLAT 0x0F 36770c52ebfSjason 36870c52ebfSjason #define TL_AREG0_B5 0x10 36970c52ebfSjason #define TL_AREG0_B4 0x11 37070c52ebfSjason #define TL_AREG0_B3 0x12 37170c52ebfSjason #define TL_AREG0_B2 0x13 37270c52ebfSjason 37370c52ebfSjason #define TL_AREG0_B1 0x14 37470c52ebfSjason #define TL_AREG0_B0 0x15 37570c52ebfSjason #define TL_AREG1_B5 0x16 37670c52ebfSjason #define TL_AREG1_B4 0x17 37770c52ebfSjason 37870c52ebfSjason #define TL_AREG1_B3 0x18 37970c52ebfSjason #define TL_AREG1_B2 0x19 38070c52ebfSjason #define TL_AREG1_B1 0x1A 38170c52ebfSjason #define TL_AREG1_B0 0x1B 38270c52ebfSjason 38370c52ebfSjason #define TL_AREG2_B5 0x1C 38470c52ebfSjason #define TL_AREG2_B4 0x1D 38570c52ebfSjason #define TL_AREG2_B3 0x1E 38670c52ebfSjason #define TL_AREG2_B2 0x1F 38770c52ebfSjason 38870c52ebfSjason #define TL_AREG2_B1 0x20 38970c52ebfSjason #define TL_AREG2_B0 0x21 39070c52ebfSjason #define TL_AREG3_B5 0x22 39170c52ebfSjason #define TL_AREG3_B4 0x23 39270c52ebfSjason 39370c52ebfSjason #define TL_AREG3_B3 0x24 39470c52ebfSjason #define TL_AREG3_B2 0x25 39570c52ebfSjason #define TL_AREG3_B1 0x26 39670c52ebfSjason #define TL_AREG3_B0 0x27 39770c52ebfSjason 39870c52ebfSjason #define TL_HASH1 0x28 39970c52ebfSjason #define TL_HASH2 0x2C 40070c52ebfSjason #define TL_TXGOODFRAMES 0x30 40170c52ebfSjason #define TL_TXUNDERRUN 0x33 40270c52ebfSjason #define TL_RXGOODFRAMES 0x34 40370c52ebfSjason #define TL_RXOVERRUN 0x37 40470c52ebfSjason #define TL_DEFEREDTX 0x38 40570c52ebfSjason #define TL_CRCERROR 0x3A 40670c52ebfSjason #define TL_CODEERROR 0x3B 40770c52ebfSjason #define TL_MULTICOLTX 0x3C 40870c52ebfSjason #define TL_SINGLECOLTX 0x3E 40970c52ebfSjason #define TL_EXCESSIVECOL 0x40 41070c52ebfSjason #define TL_LATECOL 0x41 41170c52ebfSjason #define TL_CARRIERLOSS 0x42 41270c52ebfSjason #define TL_ACOMMIT 0x43 41370c52ebfSjason #define TL_LDREG 0x44 41470c52ebfSjason #define TL_BSIZEREG 0x45 41570c52ebfSjason #define TL_MAXRX 0x46 41670c52ebfSjason 41770c52ebfSjason /* 41870c52ebfSjason * ThunderLAN SIO register bits 41970c52ebfSjason */ 42070c52ebfSjason #define TL_SIO_MINTEN 0x80 42170c52ebfSjason #define TL_SIO_ECLOK 0x40 42270c52ebfSjason #define TL_SIO_ETXEN 0x20 42370c52ebfSjason #define TL_SIO_EDATA 0x10 42470c52ebfSjason #define TL_SIO_NMRST 0x08 42570c52ebfSjason #define TL_SIO_MCLK 0x04 42670c52ebfSjason #define TL_SIO_MTXEN 0x02 42770c52ebfSjason #define TL_SIO_MDATA 0x01 42870c52ebfSjason 42970c52ebfSjason /* 43070c52ebfSjason * Thunderlan NETCONFIG bits 43170c52ebfSjason */ 43270c52ebfSjason #define TL_CFG_RCLKTEST 0x8000 43370c52ebfSjason #define TL_CFG_TCLKTEST 0x4000 43470c52ebfSjason #define TL_CFG_BITRATE 0x2000 43570c52ebfSjason #define TL_CFG_RXCRC 0x1000 43670c52ebfSjason #define TL_CFG_PEF 0x0800 43770c52ebfSjason #define TL_CFG_ONEFRAG 0x0400 43870c52ebfSjason #define TL_CFG_ONECHAN 0x0200 43970c52ebfSjason #define TL_CFG_MTEST 0x0100 44070c52ebfSjason #define TL_CFG_PHYEN 0x0080 44170c52ebfSjason #define TL_CFG_MACSEL6 0x0040 44270c52ebfSjason #define TL_CFG_MACSEL5 0x0020 44370c52ebfSjason #define TL_CFG_MACSEL4 0x0010 44470c52ebfSjason #define TL_CFG_MACSEL3 0x0008 44570c52ebfSjason #define TL_CFG_MACSEL2 0x0004 44670c52ebfSjason #define TL_CFG_MACSEL1 0x0002 44770c52ebfSjason #define TL_CFG_MACSEL0 0x0001 44870c52ebfSjason 44970c52ebfSjason /* 45070c52ebfSjason * ThunderLAN NETSTS bits 45170c52ebfSjason */ 45270c52ebfSjason #define TL_STS_MIRQ 0x80 45370c52ebfSjason #define TL_STS_HBEAT 0x40 45470c52ebfSjason #define TL_STS_TXSTOP 0x20 45570c52ebfSjason #define TL_STS_RXSTOP 0x10 45670c52ebfSjason 45770c52ebfSjason /* 45870c52ebfSjason * ThunderLAN NETCMD bits 45970c52ebfSjason */ 46070c52ebfSjason #define TL_CMD_NRESET 0x80 46170c52ebfSjason #define TL_CMD_NWRAP 0x40 46270c52ebfSjason #define TL_CMD_CSF 0x20 46370c52ebfSjason #define TL_CMD_CAF 0x10 46470c52ebfSjason #define TL_CMD_NOBRX 0x08 46570c52ebfSjason #define TL_CMD_DUPLEX 0x04 46670c52ebfSjason #define TL_CMD_TRFRAM 0x02 46770c52ebfSjason #define TL_CMD_TXPACE 0x01 46870c52ebfSjason 46970c52ebfSjason /* 47070c52ebfSjason * ThunderLAN NETMASK bits 47170c52ebfSjason */ 47270c52ebfSjason #define TL_MASK_MASK7 0x80 47370c52ebfSjason #define TL_MASK_MASK6 0x40 47470c52ebfSjason #define TL_MASK_MASK5 0x20 47570c52ebfSjason #define TL_MASK_MASK4 0x10 47670c52ebfSjason 47770c52ebfSjason /* 47870c52ebfSjason * MII frame format 47970c52ebfSjason */ 48070c52ebfSjason #ifdef ANSI_DOESNT_ALLOW_BITFIELDS 48170c52ebfSjason struct tl_mii_frame { 48270c52ebfSjason u_int16_t mii_stdelim:2, 48370c52ebfSjason mii_opcode:2, 48470c52ebfSjason mii_phyaddr:5, 48570c52ebfSjason mii_regaddr:5, 48670c52ebfSjason mii_turnaround:2; 48770c52ebfSjason u_int16_t mii_data; 48870c52ebfSjason }; 48970c52ebfSjason #else 49070c52ebfSjason struct tl_mii_frame { 49170c52ebfSjason u_int8_t mii_stdelim; 49270c52ebfSjason u_int8_t mii_opcode; 49370c52ebfSjason u_int8_t mii_phyaddr; 49470c52ebfSjason u_int8_t mii_regaddr; 49570c52ebfSjason u_int8_t mii_turnaround; 49670c52ebfSjason u_int16_t mii_data; 49770c52ebfSjason }; 49870c52ebfSjason #endif 49970c52ebfSjason /* 50070c52ebfSjason * MII constants 50170c52ebfSjason */ 50270c52ebfSjason #define TL_MII_STARTDELIM 0x01 50370c52ebfSjason #define TL_MII_READOP 0x02 50470c52ebfSjason #define TL_MII_WRITEOP 0x01 50570c52ebfSjason #define TL_MII_TURNAROUND 0x02 50670c52ebfSjason 50770c52ebfSjason #define TL_LAST_FRAG 0x80000000 50870c52ebfSjason #define TL_CSTAT_UNUSED 0x8000 50970c52ebfSjason #define TL_CSTAT_FRAMECMP 0x4000 51070c52ebfSjason #define TL_CSTAT_READY 0x3000 51170c52ebfSjason #define TL_CSTAT_UNUSED13 0x2000 51270c52ebfSjason #define TL_CSTAT_UNUSED12 0x1000 51370c52ebfSjason #define TL_CSTAT_EOC 0x0800 51470c52ebfSjason #define TL_CSTAT_RXERROR 0x0400 51570c52ebfSjason #define TL_CSTAT_PASSCRC 0x0200 51670c52ebfSjason #define TL_CSTAT_DPRIO 0x0100 51770c52ebfSjason 51870c52ebfSjason #define TL_FRAME_MASK 0x00FFFFFF 51970c52ebfSjason #define tl_tx_goodframes(x) (x.tl_txstat & TL_FRAME_MASK) 52070c52ebfSjason #define tl_tx_underrun(x) ((x.tl_txstat & ~TL_FRAME_MASK) >> 24) 52170c52ebfSjason #define tl_rx_goodframes(x) (x.tl_rxstat & TL_FRAME_MASK) 52270c52ebfSjason #define tl_rx_overrun(x) ((x.tl_rxstat & ~TL_FRAME_MASK) >> 24) 52370c52ebfSjason 52470c52ebfSjason struct tl_stats { 52570c52ebfSjason u_int32_t tl_txstat; 52670c52ebfSjason u_int32_t tl_rxstat; 52770c52ebfSjason u_int16_t tl_deferred; 52870c52ebfSjason u_int8_t tl_crc_errors; 52970c52ebfSjason u_int8_t tl_code_errors; 53070c52ebfSjason u_int16_t tl_tx_multi_collision; 53170c52ebfSjason u_int16_t tl_tx_single_collision; 53270c52ebfSjason u_int8_t tl_excessive_collision; 53370c52ebfSjason u_int8_t tl_late_collision; 53470c52ebfSjason u_int8_t tl_carrier_loss; 53570c52ebfSjason u_int8_t acommit; 53670c52ebfSjason }; 53770c52ebfSjason 53870c52ebfSjason /* 539*0c480523Sjason * ACOMMIT register bits. These are used only when a bitrate 540*0c480523Sjason * PHY is selected ('bitrate' bit in netconfig register is set). 541*0c480523Sjason */ 542*0c480523Sjason #define TL_AC_MTXER 0x01 /* reserved */ 543*0c480523Sjason #define TL_AC_MTXD1 0x02 /* 0 == 10baseT 1 == AUI */ 544*0c480523Sjason #define TL_AC_MTXD2 0x04 /* loopback disable */ 545*0c480523Sjason #define TL_AC_MTXD3 0x08 /* full duplex disable */ 546*0c480523Sjason 547*0c480523Sjason /* 54870c52ebfSjason * register space access macros 54970c52ebfSjason */ 55070c52ebfSjason #define CSR_WRITE_4(sc, reg, val) \ 551*0c480523Sjason bus_space_write_4(sc->tl_btag, sc->tl_bhandle, reg, val) 55270c52ebfSjason #define CSR_WRITE_2(sc, reg, val) \ 553*0c480523Sjason bus_space_write_2(sc->tl_btag, sc->tl_bhandle, reg, val) 55470c52ebfSjason #define CSR_WRITE_1(sc, reg, val) \ 555*0c480523Sjason bus_space_write_1(sc->tl_btag, sc->tl_bhandle, reg, val) 55670c52ebfSjason 55770c52ebfSjason #define CSR_READ_4(sc, reg) \ 558*0c480523Sjason bus_space_read_4(sc->tl_btag, sc->tl_bhandle, reg) 55970c52ebfSjason #define CSR_READ_2(sc, reg) \ 560*0c480523Sjason bus_space_read_2(sc->tl_btag, sc->tl_bhandle, reg) 56170c52ebfSjason #define CSR_READ_1(sc, reg) \ 562*0c480523Sjason bus_space_read_1(sc->tl_btag, sc->tl_bhandle, reg) 56370c52ebfSjason 56470c52ebfSjason #define CMD_PUT(sc, x) CSR_WRITE_4(sc, TL_HOSTCMD, x) 56570c52ebfSjason #define CMD_SET(sc, x) \ 56670c52ebfSjason CSR_WRITE_4(sc, TL_HOSTCMD, CSR_READ_4(sc, TL_HOSTCMD) | (x)) 56770c52ebfSjason #define CMD_CLR(sc, x) \ 56870c52ebfSjason CSR_WRITE_4(sc, TL_HOSTCMD, CSR_READ_4(sc, TL_HOSTCMD) & ~(x)) 56970c52ebfSjason 57070c52ebfSjason /* 57170c52ebfSjason * ThunderLAN adapters typically have a serial EEPROM containing 57270c52ebfSjason * configuration information. The main reason we're interested in 57370c52ebfSjason * it is because it also contains the adapters's station address. 57470c52ebfSjason * 57570c52ebfSjason * Access to the EEPROM is a bit goofy since it is a serial device: 57670c52ebfSjason * you have to do reads and writes one bit at a time. The state of 57770c52ebfSjason * the DATA bit can only change while the CLOCK line is held low. 57870c52ebfSjason * Transactions work basically like this: 57970c52ebfSjason * 58070c52ebfSjason * 1) Send the EEPROM_START sequence to prepare the EEPROM for 58170c52ebfSjason * accepting commands. This pulls the clock high, sets 58270c52ebfSjason * the data bit to 0, enables transmission to the EEPROM, 58370c52ebfSjason * pulls the data bit up to 1, then pulls the clock low. 58470c52ebfSjason * The idea is to do a 0 to 1 transition of the data bit 58570c52ebfSjason * while the clock pin is held high. 58670c52ebfSjason * 58770c52ebfSjason * 2) To write a bit to the EEPROM, set the TXENABLE bit, then 58870c52ebfSjason * set the EDATA bit to send a 1 or clear it to send a 0. 58970c52ebfSjason * Finally, set and then clear ECLOK. Strobing the clock 59070c52ebfSjason * transmits the bit. After 8 bits have been written, the 59170c52ebfSjason * EEPROM should respond with an ACK, which should be read. 59270c52ebfSjason * 59370c52ebfSjason * 3) To read a bit from the EEPROM, clear the TXENABLE bit, 59470c52ebfSjason * then set ECLOK. The bit can then be read by reading EDATA. 59570c52ebfSjason * ECLOCK should then be cleared again. This can be repeated 59670c52ebfSjason * 8 times to read a whole byte, after which the 59770c52ebfSjason * 59870c52ebfSjason * 4) We need to send the address byte to the EEPROM. For this 59970c52ebfSjason * we have to send the write control byte to the EEPROM to 60070c52ebfSjason * tell it to accept data. The byte is 0xA0. The EEPROM should 60170c52ebfSjason * ack this. The address byte can be send after that. 60270c52ebfSjason * 60370c52ebfSjason * 5) Now we have to tell the EEPROM to send us data. For that we 60470c52ebfSjason * have to transmit the read control byte, which is 0xA1. This 60570c52ebfSjason * byte should also be acked. We can then read the data bits 60670c52ebfSjason * from the EEPROM. 60770c52ebfSjason * 60870c52ebfSjason * 6) When we're all finished, send the EEPROM_STOP sequence. 60970c52ebfSjason * 61070c52ebfSjason * Note that we use the ThunderLAN's NetSio register to access the 61170c52ebfSjason * EEPROM, however there is an alternate method. There is a PCI NVRAM 61270c52ebfSjason * register at PCI offset 0xB4 which can also be used with minor changes. 61370c52ebfSjason * The difference is that access to PCI registers via pci_conf_read() 61470c52ebfSjason * and pci_conf_write() is done using programmed I/O, which we want to 61570c52ebfSjason * avoid. 61670c52ebfSjason */ 61770c52ebfSjason 61870c52ebfSjason /* 61970c52ebfSjason * Note that EEPROM_START leaves transmission enabled. 62070c52ebfSjason */ 62170c52ebfSjason #define EEPROM_START \ 62270c52ebfSjason tl_dio_setbit(sc, TL_NETSIO, TL_SIO_ECLOK); /* Pull clock pin high */\ 62370c52ebfSjason tl_dio_setbit(sc, TL_NETSIO, TL_SIO_EDATA); /* Set DATA bit to 1 */ \ 62470c52ebfSjason tl_dio_setbit(sc, TL_NETSIO, TL_SIO_ETXEN); /* Enable xmit to write bit */\ 62570c52ebfSjason tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_EDATA); /* Pull DATA bit to 0 again */\ 62670c52ebfSjason tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_ECLOK); /* Pull clock low again */ 62770c52ebfSjason 62870c52ebfSjason /* 62970c52ebfSjason * EEPROM_STOP ends access to the EEPROM and clears the ETXEN bit so 63070c52ebfSjason * that no further data can be written to the EEPROM I/O pin. 63170c52ebfSjason */ 63270c52ebfSjason #define EEPROM_STOP \ 63370c52ebfSjason tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_ETXEN); /* Disable xmit */ \ 63470c52ebfSjason tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_EDATA); /* Pull DATA to 0 */ \ 63570c52ebfSjason tl_dio_setbit(sc, TL_NETSIO, TL_SIO_ECLOK); /* Pull clock high */ \ 63670c52ebfSjason tl_dio_setbit(sc, TL_NETSIO, TL_SIO_ETXEN); /* Enable xmit */ \ 63770c52ebfSjason tl_dio_setbit(sc, TL_NETSIO, TL_SIO_EDATA); /* Toggle DATA to 1 */ \ 63870c52ebfSjason tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_ETXEN); /* Disable xmit. */ \ 63970c52ebfSjason tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_ECLOK); /* Pull clock low again */ 64070c52ebfSjason 64170c52ebfSjason 64270c52ebfSjason /* 64370c52ebfSjason * These are the register definitions for the PHY (physical layer 64470c52ebfSjason * interface chip). 64570c52ebfSjason * The ThunderLAN chip has a built-in 10Mb/sec PHY which may be used 64670c52ebfSjason * in some configurations. The Compaq 10/100 cards based on the ThunderLAN 64770c52ebfSjason * use a National Semiconductor DP83840A PHY. The generic BMCR and BMSR 64870c52ebfSjason * layouts for both PHYs are identical, however some of the bits are not 64970c52ebfSjason * used by the ThunderLAN's internal PHY (most notably those dealing with 65070c52ebfSjason * switching between 10 and 100Mb/sec speeds). Since Both PHYs use the 65170c52ebfSjason * same bits, we #define them with generic names here. 65270c52ebfSjason */ 65370c52ebfSjason /* 65470c52ebfSjason * PHY BMCR Basic Mode Control Register 65570c52ebfSjason */ 65670c52ebfSjason #define PHY_BMCR 0x00 65770c52ebfSjason #define PHY_BMCR_RESET 0x8000 65870c52ebfSjason #define PHY_BMCR_LOOPBK 0x4000 65970c52ebfSjason #define PHY_BMCR_SPEEDSEL 0x2000 66070c52ebfSjason #define PHY_BMCR_AUTONEGENBL 0x1000 66170c52ebfSjason #define PHY_BMCR_RSVD0 0x0800 /* write as zero */ 66270c52ebfSjason #define PHY_BMCR_PWRDOWN 0x0800 /* tlan internal PHY only */ 66370c52ebfSjason #define PHY_BMCR_ISOLATE 0x0400 66470c52ebfSjason #define PHY_BMCR_AUTONEGRSTR 0x0200 66570c52ebfSjason #define PHY_BMCR_DUPLEX 0x0100 66670c52ebfSjason #define PHY_BMCR_COLLTEST 0x0080 66770c52ebfSjason #define PHY_BMCR_RSVD1 0x0040 /* write as zero, don't care */ 66870c52ebfSjason #define PHY_BMCR_RSVD2 0x0020 /* write as zero, don't care */ 66970c52ebfSjason #define PHY_BMCR_RSVD3 0x0010 /* write as zero, don't care */ 67070c52ebfSjason #define PHY_BMCR_RSVD4 0x0008 /* write as zero, don't care */ 67170c52ebfSjason #define PHY_BMCR_RSVD5 0x0004 /* write as zero, don't care */ 67270c52ebfSjason #define PHY_BMCR_RSVD6 0x0002 /* write as zero, don't care */ 67370c52ebfSjason #define PHY_BMCR_RSVD7 0x0001 /* write as zero, don't care */ 67470c52ebfSjason /* 67570c52ebfSjason * RESET: 1 == software reset, 0 == normal operation 67670c52ebfSjason * Resets status and control registers to default values. 67770c52ebfSjason * Relatches all hardware config values. 67870c52ebfSjason * 67970c52ebfSjason * LOOPBK: 1 == loopback operation enabled, 0 == normal operation 68070c52ebfSjason * 68170c52ebfSjason * SPEEDSEL: 1 == 100Mb/s, 0 == 10Mb/s 68270c52ebfSjason * Link speed is selected byt his bit or if auto-negotiation if bit 68370c52ebfSjason * 12 (AUTONEGENBL) is set (in which case the value of this register 68470c52ebfSjason * is ignored). 68570c52ebfSjason * 68670c52ebfSjason * AUTONEGENBL: 1 == Autonegotiation enabled, 0 == Autonegotiation disabled 68770c52ebfSjason * Bits 8 and 13 are ignored when autoneg is set, otherwise bits 8 and 13 68870c52ebfSjason * determine speed and mode. Should be cleared and then set if PHY configured 68970c52ebfSjason * for no autoneg on startup. 69070c52ebfSjason * 69170c52ebfSjason * ISOLATE: 1 == isolate PHY from MII, 0 == normal operation 69270c52ebfSjason * 69370c52ebfSjason * AUTONEGRSTR: 1 == restart autonegotiation, 0 = normal operation 69470c52ebfSjason * 69570c52ebfSjason * DUPLEX: 1 == full duplex mode, 0 == half duplex mode 69670c52ebfSjason * 69770c52ebfSjason * COLLTEST: 1 == collision test enabled, 0 == normal operation 69870c52ebfSjason */ 69970c52ebfSjason 70070c52ebfSjason /* 70170c52ebfSjason * PHY, BMSR Basic Mode Status Register 70270c52ebfSjason */ 70370c52ebfSjason #define PHY_BMSR 0x01 70470c52ebfSjason #define PHY_BMSR_100BT4 0x8000 70570c52ebfSjason #define PHY_BMSR_100BTXFULL 0x4000 70670c52ebfSjason #define PHY_BMSR_100BTXHALF 0x2000 70770c52ebfSjason #define PHY_BMSR_10BTFULL 0x1000 70870c52ebfSjason #define PHY_BMSR_10BTHALF 0x0800 70970c52ebfSjason #define PHY_BMSR_RSVD1 0x0400 /* write as zero, don't care */ 71070c52ebfSjason #define PHY_BMSR_RSVD2 0x0200 /* write as zero, don't care */ 71170c52ebfSjason #define PHY_BMSR_RSVD3 0x0100 /* write as zero, don't care */ 71270c52ebfSjason #define PHY_BMSR_RSVD4 0x0080 /* write as zero, don't care */ 71370c52ebfSjason #define PHY_BMSR_MFPRESUP 0x0040 71470c52ebfSjason #define PHY_BMSR_AUTONEGCOMP 0x0020 71570c52ebfSjason #define PHY_BMSR_REMFAULT 0x0010 71670c52ebfSjason #define PHY_BMSR_CANAUTONEG 0x0008 71770c52ebfSjason #define PHY_BMSR_LINKSTAT 0x0004 71870c52ebfSjason #define PHY_BMSR_JABBER 0x0002 71970c52ebfSjason #define PHY_BMSR_EXTENDED 0x0001 72070c52ebfSjason 72170c52ebfSjason #define PHY_CTL_IGLINK 0x8000 72270c52ebfSjason #define PHY_CTL_SWAPOL 0x4000 72370c52ebfSjason #define PHY_CTL_AUISEL 0x2000 72470c52ebfSjason #define PHY_CTL_SQEEN 0x1000 72570c52ebfSjason #define PHY_CTL_MTEST 0x0800 72670c52ebfSjason #define PHY_CTL_NFEW 0x0004 72770c52ebfSjason #define PHY_CTL_INTEN 0x0002 72870c52ebfSjason #define PHY_CTL_TINT 0x0001 72970c52ebfSjason 73070c52ebfSjason #define TL_PHY_GENCTL 0x00 73170c52ebfSjason #define TL_PHY_GENSTS 0x01 73270c52ebfSjason 73370c52ebfSjason /* 73470c52ebfSjason * PHY Generic Identifier Register, hi bits 73570c52ebfSjason */ 73670c52ebfSjason #define TL_PHY_VENID 0x02 73770c52ebfSjason 73870c52ebfSjason /* 73970c52ebfSjason * PHY Generic Identifier Register, lo bits 74070c52ebfSjason */ 74170c52ebfSjason #define TL_PHY_DEVID 0x03 74270c52ebfSjason 74370c52ebfSjason #define TL_PHY_ANAR 0x04 74470c52ebfSjason #define TL_PHY_LPAR 0x05 74570c52ebfSjason #define TL_PHY_ANEXP 0x06 74670c52ebfSjason 74770c52ebfSjason #define TL_PHY_PHYID 0x10 74870c52ebfSjason #define TL_PHY_CTL 0x11 74970c52ebfSjason #define TL_PHY_STS 0x12 75070c52ebfSjason 75170c52ebfSjason #define TL_LPAR_RMFLT 0x2000 75270c52ebfSjason #define TL_LPAR_RSVD0 0x1000 75370c52ebfSjason #define TL_LPAR_RSVD1 0x0800 75470c52ebfSjason #define TL_LPAR_100BT4 0x0400 75570c52ebfSjason #define TL_LPAR_100BTXFULL 0x0200 75670c52ebfSjason #define TL_LPAR_100BTXHALF 0x0100 75770c52ebfSjason #define TL_LPAR_10BTFULL 0x0080 75870c52ebfSjason #define TL_LPAR_10BTHALF 0x0040 75970c52ebfSjason 76070c52ebfSjason /* 76170c52ebfSjason * PHY Antoneg advertisement register. 76270c52ebfSjason */ 76370c52ebfSjason #define PHY_ANAR TL_PHY_ANAR 76470c52ebfSjason #define PHY_ANAR_NEXTPAGE 0x8000 76570c52ebfSjason #define PHY_ANAR_RSVD0 0x4000 76670c52ebfSjason #define PHY_ANAR_TLRFLT 0x2000 76770c52ebfSjason #define PHY_ANAR_RSVD1 0x1000 76870c52ebfSjason #define PHY_RSVD_RSDV2 0x0800 76970c52ebfSjason #define PHY_RSVD_RSVD3 0x0400 77070c52ebfSjason #define PHY_ANAR_100BT4 0x0200 77170c52ebfSjason #define PHY_ANAR_100BTXFULL 0x0100 77270c52ebfSjason #define PHY_ANAR_100BTXHALF 0x0080 77370c52ebfSjason #define PHY_ANAR_10BTFULL 0x0040 77470c52ebfSjason #define PHY_ANAR_10BTHALF 0x0020 77570c52ebfSjason #define PHY_ANAR_PROTO4 0x0010 77670c52ebfSjason #define PHY_ANAR_PROTO3 0x0008 77770c52ebfSjason #define PHY_ANAR_PROTO2 0x0004 77870c52ebfSjason #define PHY_AHAR_PROTO1 0x0002 77970c52ebfSjason #define PHY_AHAR_PROTO0 0x0001 78070c52ebfSjason 78170c52ebfSjason /* 78270c52ebfSjason * DP83840 PHY, PCS Confifguration Register 78370c52ebfSjason */ 78470c52ebfSjason #define TL_DP83840_PCS 0x17 78570c52ebfSjason #define TL_DP83840_PCS_LED4_MODE 0x0002 78670c52ebfSjason #define TL_DP83840_PCS_F_CONNECT 0x0020 78770c52ebfSjason #define TL_DP83840_PCS_BIT8 0x0100 78870c52ebfSjason #define TL_DP83840_PCS_BIT10 0x0400 78970c52ebfSjason 79070c52ebfSjason /* 79170c52ebfSjason * DP83840 PHY, PAR register 79270c52ebfSjason */ 79370c52ebfSjason #define TL_DP83840_PAR 0x19 79470c52ebfSjason 79570c52ebfSjason #define PAR_RSVD0 0x8000 79670c52ebfSjason #define PAR_RSVD1 0x4000 79770c52ebfSjason #define PAR_RSVD2 0x2000 79870c52ebfSjason #define PAR_RSVD3 0x1000 79970c52ebfSjason #define PAR_DIS_CRS_JAB 0x0800 80070c52ebfSjason #define PAR_AN_EN_STAT 0x0400 80170c52ebfSjason #define PAR_RSVD4 0x0200 80270c52ebfSjason #define PAR_FEFI_EN 0x0100 80370c52ebfSjason #define PAR_DUPLEX_STAT 0x0080 80470c52ebfSjason #define PAR_SPEED_10 0x0040 80570c52ebfSjason #define PAR_CIM_STATUS 0x0020 80670c52ebfSjason #define PAR_PHYADDR4 0x0010 80770c52ebfSjason #define PAR_PHYADDR3 0x0008 80870c52ebfSjason #define PAR_PHYADDR2 0x0004 80970c52ebfSjason #define PAR_PHYADDR1 0x0002 81070c52ebfSjason #define PAR_PHYADDR0 0x0001 81170c52ebfSjason 81270c52ebfSjason 81370c52ebfSjason /* 81470c52ebfSjason * Microchip Technology 24Cxx EEPROM control bytes 81570c52ebfSjason */ 81670c52ebfSjason #define EEPROM_CTL_READ 0xA1 /* 0101 0001 */ 81770c52ebfSjason #define EEPROM_CTL_WRITE 0xA0 /* 0101 0000 */ 818*0c480523Sjason 819*0c480523Sjason #ifdef __alpha__ 820*0c480523Sjason #undef vtophys 821*0c480523Sjason #define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va) 822*0c480523Sjason #endif 823