fix a kmap leak in virtio_console
[linux/fpc-iii.git] / drivers / net / usb / pegasus.h
blobd15646244fdf06b7b474bff96922696e79caf230
1 /*
2 * Copyright (c) 1999-2013 Petko Manolov (petkan@nucleusys.com)
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 */
10 #ifndef PEGASUS_DEV
12 #define PEGASUS_II 0x80000000
13 #define HAS_HOME_PNA 0x40000000
15 #define PEGASUS_MTU 1536
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
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
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
37 #define RX_MULTICAST 2
38 #define RX_PROMISCUOUS 4
40 #define REG_TIMEOUT (HZ)
41 #define PEGASUS_TX_TIMEOUT (HZ*10)
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
50 #define LINK_STATUS 0x01
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
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,
82 typedef 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;
95 struct delayed_work carrier_check;
96 struct urb *rx_urb, *tx_urb, *intr_urb;
97 struct sk_buff *rx_skb;
98 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;
107 struct usb_eth_dev {
108 char *name;
109 __u16 vendor;
110 __u16 device;
111 __u32 private; /* LSB is gpio reset value */
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
127 #define VENDOR_ELECOM 0x056e
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_LINKSYS2 0x077b
137 #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
148 #else /* PEGASUS_DEV */
150 PEGASUS_DEV("3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
151 DEFAULT_GPIO_RESET | PEGASUS_II)
152 PEGASUS_DEV("ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
153 DEFAULT_GPIO_RESET | PEGASUS_II)
154 PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
155 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
156 PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104,
157 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
158 PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004,
159 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
160 PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007,
161 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
162 PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102,
163 DEFAULT_GPIO_RESET | PEGASUS_II)
164 PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002,
165 DEFAULT_GPIO_RESET)
166 PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b,
167 DEFAULT_GPIO_RESET | PEGASUS_II)
168 PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
169 DEFAULT_GPIO_RESET | PEGASUS_II)
170 PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
171 DEFAULT_GPIO_RESET)
172 PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
173 DEFAULT_GPIO_RESET | PEGASUS_II)
174 PEGASUS_DEV("Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
175 DEFAULT_GPIO_RESET)
176 PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
177 DEFAULT_GPIO_RESET | PEGASUS_II)
178 PEGASUS_DEV("Philips USB 10/100 Ethernet", VENDOR_ACCTON, 0xb004,
179 DEFAULT_GPIO_RESET | PEGASUS_II)
180 PEGASUS_DEV("ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
181 VENDOR_ADMTEK, 0x8511,
182 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
183 PEGASUS_DEV("ADMtek ADM8513 \"Pegasus II\" USB Ethernet",
184 VENDOR_ADMTEK, 0x8513,
185 DEFAULT_GPIO_RESET | PEGASUS_II)
186 PEGASUS_DEV("ADMtek ADM8515 \"Pegasus II\" USB-2.0 Ethernet",
187 VENDOR_ADMTEK, 0x8515,
188 DEFAULT_GPIO_RESET | PEGASUS_II)
189 PEGASUS_DEV("ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)",
190 VENDOR_ADMTEK, 0x0986,
191 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
192 PEGASUS_DEV("AN986A USB MAC", VENDOR_ADMTEK, 1986,
193 DEFAULT_GPIO_RESET | PEGASUS_II)
194 PEGASUS_DEV("AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
195 DEFAULT_GPIO_RESET | PEGASUS_II)
196 PEGASUS_DEV("Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
197 DEFAULT_GPIO_RESET | PEGASUS_II)
199 * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors
200 * with the same product IDs by checking the device class too.
202 PEGASUS_DEV_CLASS("Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
203 DEFAULT_GPIO_RESET | PEGASUS_II)
204 PEGASUS_DEV("Belkin F5U122 10/100 USB Ethernet", VENDOR_BELKIN, 0x0122,
205 DEFAULT_GPIO_RESET | PEGASUS_II)
206 PEGASUS_DEV("Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
207 DEFAULT_GPIO_RESET)
208 PEGASUS_DEV("Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
209 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
210 PEGASUS_DEV("iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
211 DEFAULT_GPIO_RESET | PEGASUS_II)
212 PEGASUS_DEV("Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
213 DEFAULT_GPIO_RESET)
214 PEGASUS_DEV("Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
215 DEFAULT_GPIO_RESET | PEGASUS_II)
216 PEGASUS_DEV("Corega FEther USB-TX", VENDOR_COREGA, 0x0004,
217 DEFAULT_GPIO_RESET)
218 PEGASUS_DEV("Corega FEther USB-TXS", VENDOR_COREGA, 0x000d,
219 DEFAULT_GPIO_RESET | PEGASUS_II)
220 PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
221 DEFAULT_GPIO_RESET)
222 PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4002,
223 DEFAULT_GPIO_RESET)
224 PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4102,
225 DEFAULT_GPIO_RESET | PEGASUS_II)
226 PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x400b,
227 DEFAULT_GPIO_RESET | PEGASUS_II)
228 PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x200c,
229 DEFAULT_GPIO_RESET | PEGASUS_II)
230 PEGASUS_DEV("D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003,
231 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
232 PEGASUS_DEV("D-Link DSB-650", VENDOR_DLINK, 0xabc1,
233 DEFAULT_GPIO_RESET)
234 PEGASUS_DEV("GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
235 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
236 PEGASUS_DEV("ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM, 0x4010,
237 DEFAULT_GPIO_RESET | PEGASUS_II)
238 PEGASUS_DEV("EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
239 DEFAULT_GPIO_RESET)
240 PEGASUS_DEV("Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
241 DEFAULT_GPIO_RESET)
242 PEGASUS_DEV("GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
243 DEFAULT_GPIO_RESET)
244 PEGASUS_DEV("Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
245 DEFAULT_GPIO_RESET | PEGASUS_II)
246 PEGASUS_DEV("HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
247 DEFAULT_GPIO_RESET | PEGASUS_II)
248 PEGASUS_DEV("IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
249 DEFAULT_GPIO_RESET)
250 PEGASUS_DEV("IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
251 DEFAULT_GPIO_RESET | PEGASUS_II)
252 PEGASUS_DEV("IO DATA USB ETX-US2", VENDOR_IODATA, 0x093a,
253 DEFAULT_GPIO_RESET | PEGASUS_II)
254 PEGASUS_DEV("Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
255 DEFAULT_GPIO_RESET)
256 PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
257 DEFAULT_GPIO_RESET)
258 PEGASUS_DEV("LANEED USB Ethernet LD-USBL/TX", VENDOR_LANEED, 0x4005,
259 DEFAULT_GPIO_RESET | PEGASUS_II)
260 PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
261 DEFAULT_GPIO_RESET | PEGASUS_II)
262 PEGASUS_DEV("LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,
263 DEFAULT_GPIO_RESET)
264 PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c,
265 DEFAULT_GPIO_RESET | PEGASUS_II)
266 PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x2202,
267 DEFAULT_GPIO_RESET)
268 PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
269 DEFAULT_GPIO_RESET)
270 PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
271 DEFAULT_GPIO_RESET | HAS_HOME_PNA)
272 PEGASUS_DEV("Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
273 DEFAULT_GPIO_RESET | PEGASUS_II)
274 PEGASUS_DEV("Linksys USBVPN1", VENDOR_LINKSYS2, 0x08b4,
275 DEFAULT_GPIO_RESET)
276 PEGASUS_DEV("Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
277 DEFAULT_GPIO_RESET | PEGASUS_II)
278 PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
279 DEFAULT_GPIO_RESET | PEGASUS_II)
280 PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001,
281 DEFAULT_GPIO_RESET)
282 PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
283 DEFAULT_GPIO_RESET)
284 PEGASUS_DEV("MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
285 DEFAULT_GPIO_RESET | PEGASUS_II)
286 PEGASUS_DEV("Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
287 DEFAULT_GPIO_RESET | PEGASUS_II)
288 PEGASUS_DEV("NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
289 DEFAULT_GPIO_RESET | PEGASUS_II)
290 PEGASUS_DEV("OCT Inc.", VENDOR_OCT, 0x0109,
291 DEFAULT_GPIO_RESET | PEGASUS_II)
292 PEGASUS_DEV("OCT USB TO Ethernet", VENDOR_OCT, 0x0901,
293 DEFAULT_GPIO_RESET | PEGASUS_II)
294 PEGASUS_DEV("smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003,
295 DEFAULT_GPIO_RESET | PEGASUS_II)
296 PEGASUS_DEV("SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
297 DEFAULT_GPIO_RESET)
298 PEGASUS_DEV("SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201,
299 DEFAULT_GPIO_RESET | PEGASUS_II)
300 PEGASUS_DEV("SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
301 DEFAULT_GPIO_RESET)
302 PEGASUS_DEV("SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110,
303 DEFAULT_GPIO_RESET | PEGASUS_II)
304 PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
305 DEFAULT_GPIO_RESET | PEGASUS_II)
308 #endif /* PEGASUS_DEV */