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