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