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