1 /* 2 * Copyright (c) 1999-2003 Petko Manolov - Petkan (petkan@users.sourceforge.net) 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as published 6 * by the Free Software Foundation. 7 * 8 */ 9 10 11 #ifndef PEGASUS_DEV 12 13 #define PEGASUS_II 0x80000000 14 #define HAS_HOME_PNA 0x40000000 15 16 #define PEGASUS_MTU 1500 17 #define PEGASUS_MAX_MTU 1536 18 19 #define EPROM_WRITE 0x01 20 #define EPROM_READ 0x02 21 #define EPROM_DONE 0x04 22 #define EPROM_WR_ENABLE 0x10 23 #define EPROM_LOAD 0x20 24 25 #define PHY_DONE 0x80 26 #define PHY_READ 0x40 27 #define PHY_WRITE 0x20 28 #define DEFAULT_GPIO_RESET 0x24 29 #define LINKSYS_GPIO_RESET 0x24 30 #define DEFAULT_GPIO_SET 0x26 31 32 #define PEGASUS_PRESENT 0x00000001 33 #define PEGASUS_RUNNING 0x00000002 34 #define PEGASUS_TX_BUSY 0x00000004 35 #define PEGASUS_RX_BUSY 0x00000008 36 #define CTRL_URB_RUNNING 0x00000010 37 #define CTRL_URB_SLEEP 0x00000020 38 #define PEGASUS_UNPLUG 0x00000040 39 #define ETH_REGS_CHANGE 0x40000000 40 #define ETH_REGS_CHANGED 0x80000000 41 42 #define RX_MULTICAST 2 43 #define RX_PROMISCUOUS 4 44 45 #define REG_TIMEOUT (HZ) 46 #define PEGASUS_TX_TIMEOUT (HZ*10) 47 48 #define TX_UNDERRUN 0x80 49 #define EXCESSIVE_COL 0x40 50 #define LATE_COL 0x20 51 #define NO_CARRIER 0x10 52 #define LOSS_CARRIER 0x08 53 #define JABBER_TIMEOUT 0x04 54 55 #define LINK_STATUS 0x01 56 57 #define PEGASUS_REQT_READ 0xc0 58 #define PEGASUS_REQT_WRITE 0x40 59 #define PEGASUS_REQ_GET_REGS 0xf0 60 #define PEGASUS_REQ_SET_REGS 0xf1 61 #define PEGASUS_REQ_SET_REG PEGASUS_REQ_SET_REGS 62 63 enum pegasus_registers { 64 EthCtrl0 = 0, 65 EthCtrl1 = 1, 66 EthCtrl2 = 2, 67 EthID = 0x10, 68 Reg1d = 0x1d, 69 EpromOffset = 0x20, 70 EpromData = 0x21, /* 0x21 low, 0x22 high byte */ 71 EpromCtrl = 0x23, 72 PhyAddr = 0x25, 73 PhyData = 0x26, /* 0x26 low, 0x27 high byte */ 74 PhyCtrl = 0x28, 75 UsbStst = 0x2a, 76 EthTxStat0 = 0x2b, 77 EthTxStat1 = 0x2c, 78 EthRxStat = 0x2d, 79 Reg7b = 0x7b, 80 Gpio0 = 0x7e, 81 Gpio1 = 0x7f, 82 Reg81 = 0x81, 83 }; 84 85 86 typedef struct pegasus { 87 struct usb_device *usb; 88 struct net_device *net; 89 struct net_device_stats stats; 90 struct mii_if_info mii; 91 unsigned flags; 92 unsigned features; 93 int dev_index; 94 int intr_interval; 95 struct urb *ctrl_urb, *rx_urb, *tx_urb, *intr_urb; 96 struct usb_ctrlrequest dr; 97 wait_queue_head_t ctrl_wait; 98 struct semaphore sem; 99 int chip; 100 unsigned char rx_buff[PEGASUS_MAX_MTU]; 101 unsigned char tx_buff[PEGASUS_MAX_MTU]; 102 unsigned char intr_buff[8]; 103 __u8 eth_regs[4]; 104 __u8 phy; 105 __u8 gpio_res; 106 } pegasus_t; 107 108 109 struct usb_eth_dev { 110 char *name; 111 __u16 vendor; 112 __u16 device; 113 __u32 private; /* LSB is gpio reset value */ 114 }; 115 116 #define VENDOR_3COM 0x0506 117 #define VENDOR_ABOCOM 0x07b8 118 #define VENDOR_ACCTON 0x083a 119 #define VENDOR_ADMTEK 0x07a6 120 #define VENDOR_AEILAB 0x3334 121 #define VENDOR_ALLIEDTEL 0x07c9 122 #define VENDOR_BELKIN 0x050d 123 #define VENDOR_BILLIONTON 0x08dd 124 #define VENDOR_COMPAQ 0x049f 125 #define VENDOR_COREGA 0x07aa 126 #define VENDOR_DLINK 0x2001 127 #define VENDOR_ELCON 0x0db7 128 #define VENDOR_ELSA 0x05cc 129 #define VENDOR_GIGABYTE 0x1044 130 #define VENDOR_HAWKING 0x0e66 131 #define VENDOR_HP 0x03f0 132 #define VENDOR_IODATA 0x04bb 133 #define VENDOR_KINGSTON 0x0951 134 #define VENDOR_LANEED 0x056e 135 #define VENDOR_LINKSYS 0x066b 136 #define VENDOR_MELCO 0x0411 137 #define VENDOR_MICROSOFT 0x045e 138 #define VENDOR_MOBILITY 0x1342 139 #define VENDOR_NETGEAR 0x0846 140 #define VENDOR_OCT 0x0b39 141 #define VENDOR_SMARTBRIDGES 0x08d1 142 #define VENDOR_SMC 0x0707 143 #define VENDOR_SOHOWARE 0x15e8 144 #define VENDOR_SIEMENS 0x067c 145 146 #else /* PEGASUS_DEV */ 147 148 PEGASUS_DEV( "3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601, 149 DEFAULT_GPIO_RESET | PEGASUS_II ) 150 PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c, 151 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) 152 PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104, 153 DEFAULT_GPIO_RESET | HAS_HOME_PNA ) 154 PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004, 155 DEFAULT_GPIO_RESET | HAS_HOME_PNA ) 156 PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007, 157 DEFAULT_GPIO_RESET | HAS_HOME_PNA ) 158 PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102, 159 DEFAULT_GPIO_RESET | PEGASUS_II ) 160 PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002, 161 DEFAULT_GPIO_RESET ) 162 PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b, 163 DEFAULT_GPIO_RESET | PEGASUS_II ) 164 PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c, 165 DEFAULT_GPIO_RESET | PEGASUS_II ) 166 PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1, 167 DEFAULT_GPIO_RESET ) 168 PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c, 169 DEFAULT_GPIO_RESET | PEGASUS_II ) 170 PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046, 171 DEFAULT_GPIO_RESET ) 172 PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046, 173 DEFAULT_GPIO_RESET | PEGASUS_II ) 174 PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet", 175 VENDOR_ADMTEK, 0x8511, 176 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) 177 PEGASUS_DEV( "ADMtek ADM8513 \"Pegasus II\" USB Ethernet", 178 VENDOR_ADMTEK, 0x8513, 179 DEFAULT_GPIO_RESET | PEGASUS_II ) 180 PEGASUS_DEV( "ADMtek ADM8515 \"Pegasus II\" USB Ethernet", 181 VENDOR_ADMTEK, 0x8515, 182 DEFAULT_GPIO_RESET | PEGASUS_II ) 183 PEGASUS_DEV( "ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)", 184 VENDOR_ADMTEK, 0x0986, 185 DEFAULT_GPIO_RESET | HAS_HOME_PNA ) 186 PEGASUS_DEV( "ADMtek AN986A USB MAC", VENDOR_ADMTEK, 0x1986, 187 DEFAULT_GPIO_RESET | PEGASUS_II ) 188 PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701, 189 DEFAULT_GPIO_RESET | PEGASUS_II ) 190 PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, 191 DEFAULT_GPIO_RESET | PEGASUS_II ) 192 PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 193 DEFAULT_GPIO_RESET | PEGASUS_II ) 194 PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, 195 DEFAULT_GPIO_RESET ) 196 PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, 197 DEFAULT_GPIO_RESET | HAS_HOME_PNA ) 198 PEGASUS_DEV( "iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511, 199 DEFAULT_GPIO_RESET | PEGASUS_II ) 200 PEGASUS_DEV( "Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988, 201 DEFAULT_GPIO_RESET ) 202 PEGASUS_DEV( "Billionton USBE-100", VENDOR_BILLIONTON, 0x8511, 203 DEFAULT_GPIO_RESET | PEGASUS_II ) 204 PEGASUS_DEV( "Corega FEter USB-TX", VENDOR_COREGA, 0x0004, 205 DEFAULT_GPIO_RESET ) 206 PEGASUS_DEV( "Corega FEter USB-TXS", VENDOR_COREGA, 0x000d, 207 DEFAULT_GPIO_RESET | PEGASUS_II ) 208 PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4001, 209 LINKSYS_GPIO_RESET ) 210 PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4002, 211 LINKSYS_GPIO_RESET ) 212 PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4102, 213 LINKSYS_GPIO_RESET | PEGASUS_II ) 214 PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x400b, 215 LINKSYS_GPIO_RESET | PEGASUS_II ) 216 PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x200c, 217 LINKSYS_GPIO_RESET | PEGASUS_II ) 218 PEGASUS_DEV( "D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003, 219 DEFAULT_GPIO_RESET | HAS_HOME_PNA ) 220 PEGASUS_DEV( "D-Link DSB-650", VENDOR_DLINK, 0xabc1, 221 DEFAULT_GPIO_RESET ) 222 PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002, 223 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) 224 PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304, 225 DEFAULT_GPIO_RESET ) 226 PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000, 227 DEFAULT_GPIO_RESET ) 228 PEGASUS_DEV( "GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002, 229 DEFAULT_GPIO_RESET ) 230 PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c, 231 DEFAULT_GPIO_RESET | PEGASUS_II ) 232 PEGASUS_DEV( "HP hn210c Ethernet USB", VENDOR_HP, 0x811c, 233 DEFAULT_GPIO_RESET | PEGASUS_II ) 234 PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904, 235 DEFAULT_GPIO_RESET ) 236 PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, 237 DEFAULT_GPIO_RESET | PEGASUS_II ) 238 PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, 239 DEFAULT_GPIO_RESET) 240 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, 241 DEFAULT_GPIO_RESET ) 242 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b, 243 DEFAULT_GPIO_RESET | PEGASUS_II ) 244 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1, 245 DEFAULT_GPIO_RESET ) 246 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c, 247 DEFAULT_GPIO_RESET | PEGASUS_II ) 248 PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x2202, 249 LINKSYS_GPIO_RESET ) 250 PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2203, 251 LINKSYS_GPIO_RESET ) 252 PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2204, 253 LINKSYS_GPIO_RESET | HAS_HOME_PNA ) 254 PEGASUS_DEV( "Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206, 255 LINKSYS_GPIO_RESET | PEGASUS_II) 256 PEGASUS_DEV( "Linksys USB USB10TX", VENDOR_LINKSYS, 0x400b, 257 LINKSYS_GPIO_RESET | PEGASUS_II ) 258 PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x200c, 259 LINKSYS_GPIO_RESET | PEGASUS_II ) 260 PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001, 261 DEFAULT_GPIO_RESET ) 262 PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005, 263 DEFAULT_GPIO_RESET ) 264 PEGASUS_DEV( "MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009, 265 DEFAULT_GPIO_RESET | PEGASUS_II ) 266 PEGASUS_DEV( "Microsoft MN-110", VENDOR_MICROSOFT, 0x007a, 267 DEFAULT_GPIO_RESET | PEGASUS_II ) 268 PEGASUS_DEV( "NETGEAR FA101", VENDOR_NETGEAR, 0x1020, 269 DEFAULT_GPIO_RESET | PEGASUS_II ) 270 PEGASUS_DEV( "OCT Inc.", VENDOR_OCT, 0x0109, 271 DEFAULT_GPIO_RESET | PEGASUS_II ) 272 PEGASUS_DEV( "OCT USB TO Ethernet", VENDOR_OCT, 0x0901, 273 DEFAULT_GPIO_RESET | PEGASUS_II ) 274 PEGASUS_DEV( "smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003, 275 DEFAULT_GPIO_RESET | PEGASUS_II ) 276 PEGASUS_DEV( "SMC 202 USB Ethernet", VENDOR_SMC, 0x0200, 277 DEFAULT_GPIO_RESET ) 278 PEGASUS_DEV( "SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201, 279 DEFAULT_GPIO_RESET | PEGASUS_II ) 280 PEGASUS_DEV( "SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100, 281 DEFAULT_GPIO_RESET ) 282 PEGASUS_DEV( "SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110, 283 DEFAULT_GPIO_RESET | PEGASUS_II ) 284 PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001, 285 DEFAULT_GPIO_RESET | PEGASUS_II ) 286 287 #endif /* PEGASUS_DEV */ 288