1246122Shselasky/* 2223467Shselasky * Pegasus BeOS Driver 3223467Shselasky * 4223467Shselasky * Copyright 2006, Haiku, Inc. All Rights Reserved. 5223467Shselasky * Distributed under the terms of the MIT License. 6223467Shselasky * 7223467Shselasky * Authors: 8223467Shselasky * J��r��me Duval 9223467Shselasky */ 10223467Shselasky 11223467Shselasky/*- 12223467Shselasky * Copyright (c) 1997, 1998, 1999 13223467Shselasky * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 14223467Shselasky * 15223467Shselasky * Redistribution and use in source and binary forms, with or without 16223467Shselasky * modification, are permitted provided that the following conditions 17223467Shselasky * are met: 18223467Shselasky * 1. Redistributions of source code must retain the above copyright 19223467Shselasky * notice, this list of conditions and the following disclaimer. 20223467Shselasky * 2. Redistributions in binary form must reproduce the above copyright 21223467Shselasky * notice, this list of conditions and the following disclaimer in the 22223467Shselasky * documentation and/or other materials provided with the distribution. 23223467Shselasky * 3. All advertising materials mentioning features or use of this software 24223467Shselasky * must display the following acknowledgement: 25223467Shselasky * This product includes software developed by Bill Paul. 26223467Shselasky * 4. Neither the name of the author nor the names of any co-contributors 27223467Shselasky * may be used to endorse or promote products derived from this software 28223467Shselasky * without specific prior written permission. 29223467Shselasky * 30223467Shselasky * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 31246122Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32246122Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33246122Shselasky * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 34223467Shselasky * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 35223467Shselasky * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 36223467Shselasky * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 37223467Shselasky * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 38223467Shselasky * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 39223467Shselasky * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 40223467Shselasky * THE POSSIBILITY OF SUCH DAMAGE. 41223467Shselasky * 42223467Shselasky * $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_auereg.h,v 1.22 2005/06/10 16:49:15 brooks Exp $ 43223467Shselasky */ 44223467Shselasky 45223467Shselasky/* 46223467Shselasky * Register definitions for ADMtek Pegasus AN986 USB to Ethernet 47223467Shselasky * chip. The Pegasus uses a total of four USB endpoints: the control 48223467Shselasky * endpoint (0), a bulk read endpoint for receiving packets (1), 49223467Shselasky * a bulk write endpoint for sending packets (2) and an interrupt 50223467Shselasky * endpoint for passing RX and TX status (3). Endpoint 0 is used 51223467Shselasky * to read and write the ethernet module's registers. All registers 52223467Shselasky * are 8 bits wide. 53223467Shselasky * 54223467Shselasky * Packet transfer is done in 64 byte chunks. The last chunk in a 55246123Shselasky * transfer is denoted by having a length less that 64 bytes. For 56223467Shselasky * the RX case, the data includes an optional RX status word. 57223467Shselasky */ 58223467Shselasky 59246122Shselasky#define AUE_UR_READREG 0xF0 60223467Shselasky#define AUE_UR_WRITEREG 0xF1 61223467Shselasky 62223467Shselasky#define AUE_CONFIG_NO 1 63223467Shselasky#define AUE_IFACE_IDX 0 64223467Shselasky 65223467Shselasky/* 66223467Shselasky * Note that while the ADMtek technically has four 67223467Shselasky * endpoints, the control endpoint (endpoint 0) is 68223467Shselasky * regarded as special by the USB code and drivers 69223467Shselasky * don't have direct access to it. (We access it 70223467Shselasky * using usbd_do_request() when reading/writing 71246125Shselasky * registers.) Consequently, our endpoint indexes 72223467Shselasky * don't match those in the ADMtek Pegasus manual: 73223467Shselasky * we consider the RX data endpoint to be index 0 74246125Shselasky * and work up from there. 75223467Shselasky */ 76223467Shselasky#define AUE_ENDPT_RX 0x0 77246125Shselasky#define AUE_ENDPT_TX 0x1 78223467Shselasky#define AUE_ENDPT_INTR 0x2 79223467Shselasky#define AUE_ENDPT_MAX 0x3 80246125Shselasky 81223467Shselasky#define AUE_INTR_PKTLEN 0x8 82223467Shselasky 83223467Shselasky#define AUE_CTL0 0x00 84223467Shselasky#define AUE_CTL1 0x01 85223467Shselasky#define AUE_CTL2 0x02 86223467Shselasky#define AUE_MAR0 0x08 87223467Shselasky#define AUE_MAR1 0x09 88223467Shselasky#define AUE_MAR2 0x0A 89223467Shselasky#define AUE_MAR3 0x0B 90223467Shselasky#define AUE_MAR4 0x0C 91223467Shselasky#define AUE_MAR5 0x0D 92223472Shselasky#define AUE_MAR6 0x0E 93223472Shselasky#define AUE_MAR7 0x0F 94223472Shselasky#define AUE_MAR AUE_MAR0 95223472Shselasky#define AUE_PAR0 0x10 96223472Shselasky#define AUE_PAR1 0x11 97223472Shselasky#define AUE_PAR2 0x12 98223467Shselasky#define AUE_PAR3 0x13 99223467Shselasky#define AUE_PAR4 0x14 100223467Shselasky#define AUE_PAR5 0x15 101223467Shselasky#define AUE_PAR AUE_PAR0 102223467Shselasky#define AUE_PAUSE0 0x18 103223467Shselasky#define AUE_PAUSE1 0x19 104223467Shselasky#define AUE_PAUSE AUE_PAUSE0 105223467Shselasky#define AUE_RX_FLOWCTL_CNT 0x1A 106223467Shselasky#define AUE_RX_FLOWCTL_FIFO 0x1B 107223467Shselasky#define AUE_REG_1D 0x1D 108223467Shselasky#define AUE_EE_REG 0x20 109223467Shselasky#define AUE_EE_DATA0 0x21 110223467Shselasky#define AUE_EE_DATA1 0x22 111223467Shselasky#define AUE_EE_DATA AUE_EE_DATA0 112223467Shselasky#define AUE_EE_CTL 0x23 113223467Shselasky#define AUE_PHY_ADDR 0x25 114223467Shselasky#define AUE_PHY_DATA0 0x26 115223467Shselasky#define AUE_PHY_DATA1 0x27 116223467Shselasky#define AUE_PHY_DATA AUE_PHY_DATA0 117223467Shselasky#define AUE_PHY_CTL 0x28 118223467Shselasky#define AUE_USB_STS 0x2A 119223467Shselasky#define AUE_TXSTAT0 0x2B 120223467Shselasky#define AUE_TXSTAT1 0x2C 121223467Shselasky#define AUE_TXSTAT AUE_TXSTAT0 122223467Shselasky#define AUE_RXSTAT 0x2D 123223467Shselasky#define AUE_PKTLOST0 0x2E 124223467Shselasky#define AUE_PKTLOST1 0x2F 125223467Shselasky#define AUE_PKTLOST AUE_PKTLOST0 126223467Shselasky 127223467Shselasky#define AUE_REG_7B 0x7B 128223467Shselasky#define AUE_GPIO0 0x7E 129223467Shselasky#define AUE_GPIO1 0x7F 130223467Shselasky#define AUE_REG_81 0x81 131223467Shselasky 132223467Shselasky#define AUE_CTL0_INCLUDE_RXCRC 0x01 133223467Shselasky#define AUE_CTL0_ALLMULTI 0x02 134223467Shselasky#define AUE_CTL0_STOP_BACKOFF 0x04 135223467Shselasky#define AUE_CTL0_RXSTAT_APPEND 0x08 136223467Shselasky#define AUE_CTL0_WAKEON_ENB 0x10 137223467Shselasky#define AUE_CTL0_RXPAUSE_ENB 0x20 138223467Shselasky#define AUE_CTL0_RX_ENB 0x40 139223467Shselasky#define AUE_CTL0_TX_ENB 0x80 140223467Shselasky 141223467Shselasky#define AUE_CTL1_HOMELAN 0x04 142223467Shselasky#define AUE_CTL1_RESETMAC 0x08 143223467Shselasky#define AUE_CTL1_SPEEDSEL 0x10 /* 0 = 10mbps, 1 = 100mbps */ 144223467Shselasky#define AUE_CTL1_DUPLEX 0x20 /* 0 = half, 1 = full */ 145223467Shselasky#define AUE_CTL1_DELAYHOME 0x40 146223467Shselasky 147223467Shselasky#define AUE_CTL2_EP3_CLR 0x01 /* reading EP3 clrs status regs */ 148223467Shselasky#define AUE_CTL2_RX_BADFRAMES 0x02 149223467Shselasky#define AUE_CTL2_RX_PROMISC 0x04 150223467Shselasky#define AUE_CTL2_LOOPBACK 0x08 151223467Shselasky#define AUE_CTL2_EEPROMWR_ENB 0x10 152223467Shselasky#define AUE_CTL2_EEPROM_LOAD 0x20 153223467Shselasky 154223467Shselasky#define AUE_EECTL_WRITE 0x01 155223467Shselasky#define AUE_EECTL_READ 0x02 156223467Shselasky#define AUE_EECTL_DONE 0x04 157223467Shselasky 158223467Shselasky#define AUE_PHYCTL_PHYREG 0x1F 159223467Shselasky#define AUE_PHYCTL_WRITE 0x20 160223467Shselasky#define AUE_PHYCTL_READ 0x40 161223467Shselasky#define AUE_PHYCTL_DONE 0x80 162223467Shselasky 163223467Shselasky#define AUE_USBSTS_SUSPEND 0x01 164223467Shselasky#define AUE_USBSTS_RESUME 0x02 165223467Shselasky 166223467Shselasky#define AUE_TXSTAT0_JABTIMO 0x04 167223467Shselasky#define AUE_TXSTAT0_CARLOSS 0x08 168223467Shselasky#define AUE_TXSTAT0_NOCARRIER 0x10 169223467Shselasky#define AUE_TXSTAT0_LATECOLL 0x20 170223467Shselasky#define AUE_TXSTAT0_EXCESSCOLL 0x40 171223467Shselasky#define AUE_TXSTAT0_UNDERRUN 0x80 172223467Shselasky 173223467Shselasky#define AUE_TXSTAT1_PKTCNT 0x0F 174223467Shselasky#define AUE_TXSTAT1_FIFO_EMPTY 0x40 175223467Shselasky#define AUE_TXSTAT1_FIFO_FULL 0x80 176223467Shselasky 177223467Shselasky#define AUE_RXSTAT_OVERRUN 0x01 178223467Shselasky#define AUE_RXSTAT_PAUSE 0x02 179223467Shselasky 180223467Shselasky#define AUE_GPIO_IN0 0x01 181223467Shselasky#define AUE_GPIO_OUT0 0x02 182223467Shselasky#define AUE_GPIO_SEL0 0x04 183223467Shselasky#define AUE_GPIO_IN1 0x08 184223467Shselasky#define AUE_GPIO_OUT1 0x10 185223467Shselasky#define AUE_GPIO_SEL1 0x20 186223467Shselasky 187223467Shselaskystruct aue_intrpkt { 188223467Shselasky u_int8_t aue_txstat0; 189223467Shselasky u_int8_t aue_txstat1; 190223467Shselasky u_int8_t aue_rxstat; 191223467Shselasky u_int8_t aue_rxlostpkt0; 192223467Shselasky u_int8_t aue_rxlostpkt1; 193223467Shselasky u_int8_t aue_wakeupstat; 194223467Shselasky u_int8_t aue_rsvd; 195223467Shselasky}; 196223467Shselasky 197223467Shselaskystruct aue_rxpkt { 198223467Shselasky u_int16_t aue_pktlen; 199223467Shselasky u_int8_t aue_rxstat; 200223467Shselasky}; 201223467Shselasky 202223467Shselasky#define AUE_RXSTAT_MCAST 0x01 203223467Shselasky#define AUE_RXSTAT_GIANT 0x02 204223467Shselasky#define AUE_RXSTAT_RUNT 0x04 205223467Shselasky#define AUE_RXSTAT_CRCERR 0x08 206223467Shselasky#define AUE_RXSTAT_DRIBBLE 0x10 207223467Shselasky#define AUE_RXSTAT_MASK 0x1E 208223467Shselasky 209223467Shselasky#define AUE_INC(x, y) (x) = (x + 1) % y 210223467Shselasky 211223467Shselasky#if 0 212223467Shselasky#define AUE_LOCK(_sc) mtx_lock(&(_sc)->aue_mtx) 213223467Shselasky#define AUE_UNLOCK(_sc) mtx_unlock(&(_sc)->aue_mtx) 214223467Shselasky#else 215223467Shselasky#define AUE_LOCK(_sc) 216223467Shselasky#define AUE_UNLOCK(_sc) 217223467Shselasky#endif 218223467Shselasky 219223467Shselasky#define AUE_TIMEOUT 1000 220223467Shselasky#define AUE_MIN_FRAMELEN 60 221223467Shselasky#define AUE_TX_TIMEOUT 10000 /* ms */ 222223467Shselasky#define AUE_INTR_INTERVAL 100 /* ms */ 223223467Shselasky#define AUE_BUFSZ 1536 224223467Shselasky#define ETHER_ALIGN 2 225223467Shselasky 226223467Shselasky 227223467Shselasky/***************************** Media Independent Interface *****************************/ 228223467Shselasky 229223467Shselasky 230223467Shselaskyenum MII_address { 231223467Shselasky // standard registers 232223467Shselasky MII_CONTROL = 0x00, 233223467Shselasky MII_STATUS = 0x01, 234223467Shselasky MII_PHY_ID0 = 0x02, 235223467Shselasky MII_PHY_ID1 = 0x03, 236223467Shselasky MII_AUTONEG_ADV = 0x04, 237223467Shselasky MII_AUTONEG_LINK_PARTNER = 0x05, 238223467Shselasky MII_AUTONEG_EXT = 0x06, 239223467Shselasky}; 240223467Shselasky 241223467Shselaskyenum MII_control { 242223467Shselasky MII_CONTROL_RESET = 0x8000, 243223467Shselasky MII_CONTROL_RESET_AUTONEG = 0x0200, 244223467Shselasky MII_CONTROL_AUTO = 0x1000, 245223467Shselasky MII_CONTROL_FULL_DUPLEX = 0x0100, 246223467Shselasky MII_CONTROL_ISOLATE = 0x0400 247223467Shselasky}; 248223467Shselasky 249223467Shselaskyenum SiS900_MII_commands { 250223467Shselasky MII_CMD_READ = 0x6000, 251223467Shselasky MII_CMD_WRITE = 0x5002, 252223467Shselasky 253223467Shselasky MII_PHY_SHIFT = 7, 254223467Shselasky MII_REG_SHIFT = 2, 255223467Shselasky}; 256223467Shselasky 257223467Shselaskyenum MII_status_bits { 258223467Shselasky MII_STATUS_EXT = 0x0001, 259223467Shselasky MII_STATUS_JAB = 0x0002, 260223467Shselasky MII_STATUS_LINK = 0x0004, 261223467Shselasky MII_STATUS_CAN_AUTO = 0x0008, 262223467Shselasky MII_STATUS_FAULT = 0x0010, 263223467Shselasky MII_STATUS_AUTO_DONE = 0x0020, 264223467Shselasky MII_STATUS_CAN_T = 0x0800, 265223467Shselasky MII_STATUS_CAN_T_FDX = 0x1000, 266223467Shselasky MII_STATUS_CAN_TX = 0x2000, 267223467Shselasky MII_STATUS_CAN_TX_FDX = 0x4000, 268223467Shselasky MII_STATUS_CAN_T4 = 0x8000 269223467Shselasky}; 270223467Shselasky 271223467Shselasky 272223467Shselaskyenum MII_link_status { 273223467Shselasky MII_LINK_FAIL = 0x4000, 274223467Shselasky MII_LINK_100_MBIT = 0x0080, 275223467Shselasky MII_LINK_FULL_DUPLEX = 0x0040 276223467Shselasky}; 277223467Shselasky