1/* ********************************************************************* 2 * Broadcom Common Firmware Environment (CFE) 3 * 4 * USB Ethernet File: usbeth.h 5 * 6 * Driver for USB Ethernet devices. 7 * 8 ********************************************************************* 9 * 10 * Copyright 2000,2001,2002,2003,2005 11 * Broadcom Corporation. All rights reserved. 12 * 13 * This software is furnished under license and may be used and 14 * copied only in accordance with the following terms and 15 * conditions. Subject to these conditions, you may download, 16 * copy, install, use, modify and distribute modified or unmodified 17 * copies of this software in source and/or binary form. No title 18 * or ownership is transferred hereby. 19 * 20 * 1) Any source code used, modified or distributed must reproduce 21 * and retain this copyright notice and list of conditions 22 * as they appear in the source file. 23 * 24 * 2) No right is granted to use any trade name, trademark, or 25 * logo of Broadcom Corporation. The "Broadcom Corporation" 26 * name may not be used to endorse or promote products derived 27 * from this software without the prior written permission of 28 * Broadcom Corporation. 29 * 30 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR 31 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED 32 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 33 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT 34 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN 35 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT, 36 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 37 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 39 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 40 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 41 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF 42 * THE POSSIBILITY OF SUCH DAMAGE. 43 ********************************************************************* */ 44 45#ifndef _USBETH_H__ 46#define _USBETH_H__ 47 48/* ********************************************************************* 49 * USB-Ethernet adapter driver includes 50 ********************************************************************* */ 51 52/* ************************************** 53 * CATC Netmate adapter 54 ************************************** */ 55 56#define CATC_MCAST_TBL_ADDR 0xFA80 //in Netmate's SRAM 57 58#define CATC_GET_MAC_ADDR 0xF2 59#define CATC_SET_REG 0xFA 60#define CATC_GET_REG 0xFB 61#define CATC_SET_MEM 0xFC 62 63#define CATC_TX_BUF_CNT_REG 0x20 64#define CATC_RX_BUF_CNT_REG 0x21 65#define CATC_ADV_OP_MODES_REG 0x22 66#define CATC_RX_FRAME_CNT_REG 0x24 67 68#define CATC_ETH_CTRL_REG 0x60 69#define CATC_ENET_STATUS_REG 0x61 70#define CATC_ETH_ADDR_0_REG 0x67 // Byte #0 (leftmost) 71#define CATC_LED_CTRL_REG 0x81 72 73 74/* ******************************************************************* 75 * Admtek ADM8511 (Pegasus II) register and bit definitions. 76 * 77 * Reference: 78 * ADM 8511 Pegasus II USB / Fast Ethernet with MII Interface, 79 * Version 2.04 80 * ADMtek Incorporated, Hsinchu, Taiwan 81 ******************************************************************* */ 82 83#define PEG_SET_REG 0xF1 84#define PEG_GET_REG 0xF0 85 86#define R_PEG_ETH_CTL0 0x00 87#define R_PEG_ETH_CTL1 0x01 88#define R_PEG_ETH_CTL2 0x02 89#define R_PEG_MCAST_TBL 0x08 90#define R_PEG_MAC_ADDR_0 0x10 91#define R_PEG_EEPROM_OFS 0x20 92#define R_PEG_EEPROM_DATA 0x21 93#define R_PEG_EEPROM_CTL 0x23 94#define R_PEG_PHY_ADDR 0x25 95#define R_PEG_PHY_DATA 0x26 //& 0x27 for 2 bytes 96#define R_PEG_PHY_CTRL 0x28 97#define R_PEG_INT_PHY 0x7b 98#define R_PEG_GPIO0 0x7e 99#define R_PEG_GPIO1 0x7f 100 101/* PHY Access Control Register (0x28) */ 102#define PEG_PHY_WRITE 0x20 103#define PEG_PHY_READ 0x40 104 105 106/* ******************************************************************* 107 * Realtek RTL8150 register and bit definitions. 108 * 109 * Reference: 110 * Realtek Single-Chip USB to Fast Ethernet Controller with 111 * MII Interface RTL8150L(M), Version 1.40 112 * Realtek Semiconductor Corporation, Hsinchu, Taiwan, 2002/2/18. 113 ******************************************************************* */ 114 115#define RTEK_REG_ACCESS 0x05 116 117#define R_RTEK_MAC 0x0120 118#define R_RTEK_CMD 0x012E 119#define R_RTEK_TXCFG 0x012F 120#define R_RTEK_RXCFG 0x0130 121#define R_RTEK_TXSTAT 0x0132 122#define R_RTEK_RXSTAT 0x0133 123 124/* Command Register (0x012E) */ 125#define RTEK_AUTOLOAD 0x01 126#define RTEK_TXENABLE 0x04 127#define RTEK_RXENABLE 0x08 128#define RTEK_RESET 0x10 129 130/* Receive Configuration Register (0x0130) */ 131#define RTEK_MACADDR 0x04 132#define RTEK_BCASTADDR 0x08 133 134 135/* ******************************************************************* 136 * Kawasaki LSI KL5KUSB101B register and bit definitions. 137 * 138 * Reference: inferred from *BSD kue drivers. 139 ******************************************************************* */ 140 141/* Generic commands */ 142#define KLSI_SEND_SCAN 0xFF 143 144/* MAC-specific commands */ 145#define KLSI_GET_ETH_DESC 0x00 146#define KLSI_SET_MCAST_FILTER 0x01 147#define KLSI_SET_PKT_FILTER 0x02 148#define KLSI_SET_MAC 0x06 149#define KLSI_GET_MAC 0x07 150#define KLSI_SET_URB_SIZE 0x08 151#define KLSI_SET_SOFS 0x09 152 153/* Structure returned by GET_ETH_DESC */ 154typedef struct klsi_ether_desc_s { 155 uint8_t klsi_len; 156 uint8_t klsi_rsvd0; 157 uint8_t klsi_rsvd1; 158 uint8_t klsi_macaddr[6]; 159 uint8_t klsi_etherstats[4]; 160 uint8_t klsi_maxseg[2]; 161 uint8_t klsi_mcastfilt[2]; 162 uint8_t klsi_rsvd2; 163} klsi_ether_desc_t; 164 165/* Bit masks for SET_PKT_FILTER */ 166#define KLSI_RX_PROMISC 0x0001 167#define KLSI_RX_ALLMULTI 0x0002 168#define KLSI_RX_UNICAST 0x0004 169#define KLSI_RX_BROADCAST 0x0008 170#define KLSI_RX_MULTICAST 0x0010 171 172 173/* ********************************************************************* 174 * Device register/unregister 175 ********************************************************************* */ 176 177typedef struct usbeth_disp_s { 178 int (*read)(void *,hsaddr_t buf); 179 int (*inpstat)(void *); 180 int (*write)(void *,hsaddr_t buf,int len); 181 int (*getaddr)(void *,hsaddr_t addr); 182} usbeth_disp_t; 183 184int usbeth_register(usbeth_disp_t *disp,void *softc); 185void usbeth_unregister(void *softc); 186 187#endif /*__USBETH_H_ */ 188