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