blob: d15646244fdf06b7b474bff96922696e79caf230 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Petko Manolov323b3492013-04-25 22:41:50 +00002 * Copyright (c) 1999-2013 Petko Manolov (petkan@nucleusys.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#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
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
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
58enum 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,
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +000068 PhyData = 0x26, /* 0x26 low, 0x27 high byte */
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 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
82typedef struct pegasus {
83 struct usb_device *usb;
84 struct usb_interface *intf;
85 struct net_device *net;
86 struct net_device_stats stats;
87 struct mii_if_info mii;
88 unsigned flags;
89 unsigned features;
90 u32 msg_enable;
91 u32 wolopts;
92 int dev_index;
93 int intr_interval;
94 struct tasklet_struct rx_tl;
David Howellsc4028952006-11-22 14:57:56 +000095 struct delayed_work carrier_check;
Petko Manolov323b3492013-04-25 22:41:50 +000096 struct urb *rx_urb, *tx_urb, *intr_urb;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 struct sk_buff *rx_skb;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 int chip;
99 unsigned char intr_buff[8];
100 __u8 tx_buff[PEGASUS_MTU];
101 __u8 eth_regs[4];
102 __u8 phy;
103 __u8 gpio_res;
104} pegasus_t;
105
106
107struct usb_eth_dev {
108 char *name;
109 __u16 vendor;
110 __u16 device;
111 __u32 private; /* LSB is gpio reset value */
112};
113
114#define VENDOR_3COM 0x0506
115#define VENDOR_ABOCOM 0x07b8
116#define VENDOR_ACCTON 0x083a
117#define VENDOR_ADMTEK 0x07a6
118#define VENDOR_AEILAB 0x3334
119#define VENDOR_ALLIEDTEL 0x07c9
120#define VENDOR_ATEN 0x0557
121#define VENDOR_BELKIN 0x050d
122#define VENDOR_BILLIONTON 0x08dd
123#define VENDOR_COMPAQ 0x049f
124#define VENDOR_COREGA 0x07aa
125#define VENDOR_DLINK 0x2001
126#define VENDOR_ELCON 0x0db7
Nobuhiro Iwamatsu5df3d8b2006-08-29 10:47:41 +0300127#define VENDOR_ELECOM 0x056e
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128#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
Malte Doersamefafe6f2006-01-28 17:48:33 +0100136#define VENDOR_LINKSYS2 0x077b
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137#define VENDOR_MELCO 0x0411
138#define VENDOR_MICROSOFT 0x045e
139#define VENDOR_MOBILITY 0x1342
140#define VENDOR_NETGEAR 0x0846
141#define VENDOR_OCT 0x0b39
142#define VENDOR_SMARTBRIDGES 0x08d1
143#define VENDOR_SMC 0x0707
144#define VENDOR_SOHOWARE 0x15e8
145#define VENDOR_SIEMENS 0x067c
146
147
148#else /* PEGASUS_DEV */
149
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000150PEGASUS_DEV("3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
151 DEFAULT_GPIO_RESET | PEGASUS_II)
152PEGASUS_DEV("ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
153 DEFAULT_GPIO_RESET | PEGASUS_II)
154PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
155 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
156PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104,
157 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
158PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004,
159 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
160PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007,
161 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
162PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102,
163 DEFAULT_GPIO_RESET | PEGASUS_II)
164PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002,
165 DEFAULT_GPIO_RESET)
166PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b,
167 DEFAULT_GPIO_RESET | PEGASUS_II)
168PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
169 DEFAULT_GPIO_RESET | PEGASUS_II)
170PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
171 DEFAULT_GPIO_RESET)
172PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
173 DEFAULT_GPIO_RESET | PEGASUS_II)
174PEGASUS_DEV("Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
175 DEFAULT_GPIO_RESET)
176PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
177 DEFAULT_GPIO_RESET | PEGASUS_II)
178PEGASUS_DEV("Philips USB 10/100 Ethernet", VENDOR_ACCTON, 0xb004,
179 DEFAULT_GPIO_RESET | PEGASUS_II)
180PEGASUS_DEV("ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 VENDOR_ADMTEK, 0x8511,
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000182 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
183PEGASUS_DEV("ADMtek ADM8513 \"Pegasus II\" USB Ethernet",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 VENDOR_ADMTEK, 0x8513,
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000185 DEFAULT_GPIO_RESET | PEGASUS_II)
186PEGASUS_DEV("ADMtek ADM8515 \"Pegasus II\" USB-2.0 Ethernet",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 VENDOR_ADMTEK, 0x8515,
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000188 DEFAULT_GPIO_RESET | PEGASUS_II)
189PEGASUS_DEV("ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 VENDOR_ADMTEK, 0x0986,
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000191 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
192PEGASUS_DEV("AN986A USB MAC", VENDOR_ADMTEK, 1986,
193 DEFAULT_GPIO_RESET | PEGASUS_II)
194PEGASUS_DEV("AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
195 DEFAULT_GPIO_RESET | PEGASUS_II)
196PEGASUS_DEV("Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
197 DEFAULT_GPIO_RESET | PEGASUS_II)
Chris Rankinab854b22009-10-13 00:32:02 -0700198/*
199 * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors
200 * with the same product IDs by checking the device class too.
201 */
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000202PEGASUS_DEV_CLASS("Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
203 DEFAULT_GPIO_RESET | PEGASUS_II)
204PEGASUS_DEV("Belkin F5U122 10/100 USB Ethernet", VENDOR_BELKIN, 0x0122,
205 DEFAULT_GPIO_RESET | PEGASUS_II)
206PEGASUS_DEV("Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 DEFAULT_GPIO_RESET)
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000208PEGASUS_DEV("Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
209 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
210PEGASUS_DEV("iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
YOSHIFUJI Hideakie8d99792005-05-25 16:06:59 +0900211 DEFAULT_GPIO_RESET | PEGASUS_II)
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000212PEGASUS_DEV("Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
213 DEFAULT_GPIO_RESET)
214PEGASUS_DEV("Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
Malte Doersamefafe6f2006-01-28 17:48:33 +0100215 DEFAULT_GPIO_RESET | PEGASUS_II)
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000216PEGASUS_DEV("Corega FEther USB-TX", VENDOR_COREGA, 0x0004,
217 DEFAULT_GPIO_RESET)
218PEGASUS_DEV("Corega FEther USB-TXS", VENDOR_COREGA, 0x000d,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 DEFAULT_GPIO_RESET | PEGASUS_II)
Nicolas Kaiser5a9dbfe2010-06-26 06:58:54 +0000220PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
221 DEFAULT_GPIO_RESET)
222PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4002,
223 DEFAULT_GPIO_RESET)
224PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4102,
225 DEFAULT_GPIO_RESET | PEGASUS_II)
226PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x400b,
227 DEFAULT_GPIO_RESET | PEGASUS_II)
228PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x200c,
229 DEFAULT_GPIO_RESET | PEGASUS_II)
230PEGASUS_DEV("D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003,
231 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
232PEGASUS_DEV("D-Link DSB-650", VENDOR_DLINK, 0xabc1,
233 DEFAULT_GPIO_RESET)
234PEGASUS_DEV("GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
235 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
236PEGASUS_DEV("ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM, 0x4010,
237 DEFAULT_GPIO_RESET | PEGASUS_II)
238PEGASUS_DEV("EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
239 DEFAULT_GPIO_RESET)
240PEGASUS_DEV("Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
241 DEFAULT_GPIO_RESET)
242PEGASUS_DEV("GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
243 DEFAULT_GPIO_RESET)
244PEGASUS_DEV("Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
245 DEFAULT_GPIO_RESET | PEGASUS_II)
246PEGASUS_DEV("HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
247 DEFAULT_GPIO_RESET | PEGASUS_II)
248PEGASUS_DEV("IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
249 DEFAULT_GPIO_RESET)
250PEGASUS_DEV("IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
251 DEFAULT_GPIO_RESET | PEGASUS_II)
252PEGASUS_DEV("IO DATA USB ETX-US2", VENDOR_IODATA, 0x093a,
253 DEFAULT_GPIO_RESET | PEGASUS_II)
254PEGASUS_DEV("Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
255 DEFAULT_GPIO_RESET)
256PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
257 DEFAULT_GPIO_RESET)
258PEGASUS_DEV("LANEED USB Ethernet LD-USBL/TX", VENDOR_LANEED, 0x4005,
259 DEFAULT_GPIO_RESET | PEGASUS_II)
260PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
261 DEFAULT_GPIO_RESET | PEGASUS_II)
262PEGASUS_DEV("LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,
263 DEFAULT_GPIO_RESET)
264PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c,
265 DEFAULT_GPIO_RESET | PEGASUS_II)
266PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x2202,
267 DEFAULT_GPIO_RESET)
268PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
269 DEFAULT_GPIO_RESET)
270PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
271 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
272PEGASUS_DEV("Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
273 DEFAULT_GPIO_RESET | PEGASUS_II)
274PEGASUS_DEV("Linksys USBVPN1", VENDOR_LINKSYS2, 0x08b4,
275 DEFAULT_GPIO_RESET)
276PEGASUS_DEV("Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
277 DEFAULT_GPIO_RESET | PEGASUS_II)
278PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
279 DEFAULT_GPIO_RESET | PEGASUS_II)
280PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001,
281 DEFAULT_GPIO_RESET)
282PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
283 DEFAULT_GPIO_RESET)
284PEGASUS_DEV("MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
285 DEFAULT_GPIO_RESET | PEGASUS_II)
286PEGASUS_DEV("Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
287 DEFAULT_GPIO_RESET | PEGASUS_II)
288PEGASUS_DEV("NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
289 DEFAULT_GPIO_RESET | PEGASUS_II)
290PEGASUS_DEV("OCT Inc.", VENDOR_OCT, 0x0109,
291 DEFAULT_GPIO_RESET | PEGASUS_II)
292PEGASUS_DEV("OCT USB TO Ethernet", VENDOR_OCT, 0x0901,
293 DEFAULT_GPIO_RESET | PEGASUS_II)
294PEGASUS_DEV("smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003,
295 DEFAULT_GPIO_RESET | PEGASUS_II)
296PEGASUS_DEV("SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
297 DEFAULT_GPIO_RESET)
298PEGASUS_DEV("SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201,
299 DEFAULT_GPIO_RESET | PEGASUS_II)
300PEGASUS_DEV("SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
301 DEFAULT_GPIO_RESET)
302PEGASUS_DEV("SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110,
303 DEFAULT_GPIO_RESET | PEGASUS_II)
304PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
305 DEFAULT_GPIO_RESET | PEGASUS_II)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306
307
308#endif /* PEGASUS_DEV */