aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/net/Kconfig25
-rw-r--r--drivers/usb/net/Makefile1
-rw-r--r--drivers/usb/net/plusb.c156
-rw-r--r--drivers/usb/net/usbnet.c214
4 files changed, 179 insertions, 217 deletions
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
index 5f3ae1e06b1e..8c010bb44eb8 100644
--- a/drivers/usb/net/Kconfig
+++ b/drivers/usb/net/Kconfig
@@ -99,7 +99,7 @@ config USB_USBNET
99 with "minidrivers" built around a common network driver core 99 with "minidrivers" built around a common network driver core
100 that supports deep queues for efficient transfers. (This gives 100 that supports deep queues for efficient transfers. (This gives
101 better performance with small packets and at high speeds). 101 better performance with small packets and at high speeds).
102 102
103 The USB host runs "usbnet", and the other end of the link might be: 103 The USB host runs "usbnet", and the other end of the link might be:
104 104
105 - Another USB host, when using USB "network" or "data transfer" 105 - Another USB host, when using USB "network" or "data transfer"
@@ -125,20 +125,6 @@ config USB_USBNET
125 To compile this driver as a module, choose M here: the 125 To compile this driver as a module, choose M here: the
126 module will be called usbnet. 126 module will be called usbnet.
127 127
128comment "USB Host-to-Host Cables"
129 depends on USB_USBNET
130
131config USB_PL2301
132 boolean "Prolific PL-2301/2302 based cables"
133 default y
134 # handshake/init/reset problems, from original 'plusb' driver
135 depends on USB_USBNET && EXPERIMENTAL
136 help
137 Choose this option if you're using a host-to-host cable
138 with one of these chips.
139
140comment "Drivers built using the usbnet core"
141
142config USB_NET_AX8817X 128config USB_NET_AX8817X
143 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" 129 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
144 depends on USB_USBNET && NET_ETHERNET 130 depends on USB_USBNET && NET_ETHERNET
@@ -212,6 +198,15 @@ config USB_NET_NET1080
212 on this design: one NetChip 1080 chip and supporting logic, 198 on this design: one NetChip 1080 chip and supporting logic,
213 optionally with LEDs that indicate traffic 199 optionally with LEDs that indicate traffic
214 200
201config USB_NET_PLUSB
202 tristate "Prolific PL-2301/2302 based cables"
203 # if the handshake/init/reset problems, from original 'plusb',
204 # are ever resolved ... then remove "experimental"
205 depends on USB_USBNET && EXPERIMENTAL
206 help
207 Choose this option if you're using a host-to-host cable
208 with one of these chips.
209
215config USB_NET_RNDIS_HOST 210config USB_NET_RNDIS_HOST
216 tristate "Host for RNDIS devices (EXPERIMENTAL)" 211 tristate "Host for RNDIS devices (EXPERIMENTAL)"
217 depends on USB_USBNET && EXPERIMENTAL 212 depends on USB_USBNET && EXPERIMENTAL
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
index cb789c3ded53..222c0495f791 100644
--- a/drivers/usb/net/Makefile
+++ b/drivers/usb/net/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_USB_NET_AX8817X) += asix.o
10obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o 10obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
11obj-$(CONFIG_USB_NET_GL620A) += gl620a.o 11obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
12obj-$(CONFIG_USB_NET_NET1080) += net1080.o 12obj-$(CONFIG_USB_NET_NET1080) += net1080.o
13obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
13obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o 14obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
14obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o 15obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
15obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o 16obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
diff --git a/drivers/usb/net/plusb.c b/drivers/usb/net/plusb.c
new file mode 100644
index 000000000000..74c2b3581c76
--- /dev/null
+++ b/drivers/usb/net/plusb.c
@@ -0,0 +1,156 @@
1/*
2 * PL-2301/2302 USB host-to-host link cables
3 * Copyright (C) 2000-2005 by David Brownell
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20// #define DEBUG // error path messages, extra info
21// #define VERBOSE // more; success messages
22
23#include <linux/config.h>
24#ifdef CONFIG_USB_DEBUG
25# define DEBUG
26#endif
27#include <linux/module.h>
28#include <linux/sched.h>
29#include <linux/init.h>
30#include <linux/netdevice.h>
31#include <linux/etherdevice.h>
32#include <linux/ethtool.h>
33#include <linux/workqueue.h>
34#include <linux/mii.h>
35#include <linux/usb.h>
36
37#include "usbnet.h"
38
39
40/*
41 * Prolific PL-2301/PL-2302 driver ... http://www.prolifictech.com
42 *
43 * The protocol and handshaking used here should be bug-compatible
44 * with the Linux 2.2 "plusb" driver, by Deti Fliegl.
45 *
46 * HEADS UP: this handshaking isn't all that robust. This driver
47 * gets confused easily if you unplug one end of the cable then
48 * try to connect it again; you'll need to restart both ends. The
49 * "naplink" software (used by some PlayStation/2 deveopers) does
50 * the handshaking much better! Also, sometimes this hardware
51 * seems to get wedged under load. Prolific docs are weak, and
52 * don't identify differences between PL2301 and PL2302, much less
53 * anything to explain the different PL2302 versions observed.
54 */
55
56/*
57 * Bits 0-4 can be used for software handshaking; they're set from
58 * one end, cleared from the other, "read" with the interrupt byte.
59 */
60#define PL_S_EN (1<<7) /* (feature only) suspend enable */
61/* reserved bit -- rx ready (6) ? */
62#define PL_TX_READY (1<<5) /* (interrupt only) transmit ready */
63#define PL_RESET_OUT (1<<4) /* reset output pipe */
64#define PL_RESET_IN (1<<3) /* reset input pipe */
65#define PL_TX_C (1<<2) /* transmission complete */
66#define PL_TX_REQ (1<<1) /* transmission received */
67#define PL_PEER_E (1<<0) /* peer exists */
68
69static inline int
70pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index)
71{
72 return usb_control_msg(dev->udev,
73 usb_rcvctrlpipe(dev->udev, 0),
74 req,
75 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
76 val, index,
77 NULL, 0,
78 USB_CTRL_GET_TIMEOUT);
79}
80
81static inline int
82pl_clear_QuickLink_features(struct usbnet *dev, int val)
83{
84 return pl_vendor_req(dev, 1, (u8) val, 0);
85}
86
87static inline int
88pl_set_QuickLink_features(struct usbnet *dev, int val)
89{
90 return pl_vendor_req(dev, 3, (u8) val, 0);
91}
92
93static int pl_reset(struct usbnet *dev)
94{
95 /* some units seem to need this reset, others reject it utterly.
96 * FIXME be more like "naplink" or windows drivers.
97 */
98 (void) pl_set_QuickLink_features(dev,
99 PL_S_EN|PL_RESET_OUT|PL_RESET_IN|PL_PEER_E);
100 return 0;
101}
102
103static const struct driver_info prolific_info = {
104 .description = "Prolific PL-2301/PL-2302",
105 .flags = FLAG_NO_SETINT,
106 /* some PL-2302 versions seem to fail usb_set_interface() */
107 .reset = pl_reset,
108};
109
110
111/*-------------------------------------------------------------------------*/
112
113/*
114 * Proilific's name won't normally be on the cables, and
115 * may not be on the device.
116 */
117
118static const struct usb_device_id products [] = {
119
120{
121 USB_DEVICE(0x067b, 0x0000), // PL-2301
122 .driver_info = (unsigned long) &prolific_info,
123}, {
124 USB_DEVICE(0x067b, 0x0001), // PL-2302
125 .driver_info = (unsigned long) &prolific_info,
126},
127
128 { }, // END
129};
130MODULE_DEVICE_TABLE(usb, products);
131
132static struct usb_driver plusb_driver = {
133 .owner = THIS_MODULE,
134 .name = "plusb",
135 .id_table = products,
136 .probe = usbnet_probe,
137 .disconnect = usbnet_disconnect,
138 .suspend = usbnet_suspend,
139 .resume = usbnet_resume,
140};
141
142static int __init plusb_init(void)
143{
144 return usb_register(&plusb_driver);
145}
146module_init(plusb_init);
147
148static void __exit plusb_exit(void)
149{
150 usb_deregister(&plusb_driver);
151}
152module_exit(plusb_exit);
153
154MODULE_AUTHOR("David Brownell");
155MODULE_DESCRIPTION("Prolific PL-2301/2302 USB Host to Host Link Driver");
156MODULE_LICENSE("GPL");
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 6c78a42affaa..6c460918d54f 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * USB Networking Links 2 * USB Network driver infrastructure
3 * Copyright (C) 2000-2005 by David Brownell 3 * Copyright (C) 2000-2005 by David Brownell
4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 4 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
5 * 5 *
@@ -20,96 +20,15 @@
20 20
21/* 21/*
22 * This is a generic "USB networking" framework that works with several 22 * This is a generic "USB networking" framework that works with several
23 * kinds of full and high speed networking devices: 23 * kinds of full and high speed networking devices: host-to-host cables,
24 * smart usb peripherals, and actual Ethernet adapters.
24 * 25 *
25 * + USB host-to-host "network cables", used for IP-over-USB links. 26 * These devices usually differ in terms of control protocols (if they
26 * These are often used for Laplink style connectivity products. 27 * even have one!) and sometimes they define new framing to wrap or batch
27 * - AnchorChip 2720 28 * Ethernet packets. Otherwise, they talk to USB pretty much the same,
28 * - Belkin, eTEK (interops with Win32 drivers) 29 * so interface (un)binding, endpoint I/O queues, fault handling, and other
29 * - GeneSys GL620USB-A 30 * issues can usefully be addressed by this framework.
30 * - NetChip 1080 (interoperates with NetChip Win32 drivers) 31 */
31 * - Prolific PL-2301/2302 (replaces "plusb" driver)
32 * - KC Technology KC2190
33 *
34 * + Smart USB devices can support such links directly, using Internet
35 * standard protocols instead of proprietary host-to-device links.
36 * - Linux PDAs like iPaq, Yopy, and Zaurus
37 * - The BLOB boot loader (for diskless booting)
38 * - Linux "gadgets", perhaps using PXA-2xx or Net2280 controllers
39 * - Devices using EPSON's sample USB firmware
40 * - CDC-Ethernet class devices, such as many cable modems
41 *
42 * + Adapters to networks such as Ethernet.
43 * - AX8817X based USB 2.0 products
44 *
45 * Links to these devices can be bridged using Linux Ethernet bridging.
46 * With minor exceptions, these all use similar USB framing for network
47 * traffic, but need different protocols for control traffic.
48 *
49 * USB devices can implement their side of this protocol at the cost
50 * of two bulk endpoints; it's not restricted to "cable" applications.
51 * See the SA1110, Zaurus, or EPSON device/client support in this driver;
52 * slave/target drivers such as "usb-eth" (on most SA-1100 PDAs) or
53 * "g_ether" (in the Linux "gadget" framework) implement that behavior
54 * within devices.
55 *
56 *
57 * CHANGELOG:
58 *
59 * 13-sep-2000 experimental, new
60 * 10-oct-2000 usb_device_id table created.
61 * 28-oct-2000 misc fixes; mostly, discard more TTL-mangled rx packets.
62 * 01-nov-2000 usb_device_id table and probing api update by
63 * Adam J. Richter <adam@yggdrasil.com>.
64 * 18-dec-2000 (db) tx watchdog, "net1080" renaming to "usbnet", device_info
65 * and prolific support, isolate net1080-specific bits, cleanup.
66 * fix unlink_urbs oops in D3 PM resume code path.
67 *
68 * 02-feb-2001 (db) fix tx skb sharing, packet length, match_flags, ...
69 * 08-feb-2001 stubbed in "linuxdev", maybe the SA-1100 folk can use it;
70 * AnchorChips 2720 support (from spec) for testing;
71 * fix bit-ordering problem with ethernet multicast addr
72 * 19-feb-2001 Support for clearing halt conditions. SA1100 UDC support
73 * updates. Oleg Drokin (green@iXcelerator.com)
74 * 25-mar-2001 More SA-1100 updates, including workaround for ip problem
75 * expecting cleared skb->cb and framing change to match latest
76 * handhelds.org version (Oleg). Enable device IDs from the
77 * Win32 Belkin driver; other cleanups (db).
78 * 16-jul-2001 Bugfixes for uhci oops-on-unplug, Belkin support, various
79 * cleanups for problems not yet seen in the field. (db)
80 * 17-oct-2001 Handle "Advance USBNET" product, like Belkin/eTEK devices,
81 * from Ioannis Mavroukakis <i.mavroukakis@btinternet.com>;
82 * rx unlinks somehow weren't async; minor cleanup.
83 * 03-nov-2001 Merged GeneSys driver; original code from Jiun-Jie Huang
84 * <huangjj@genesyslogic.com.tw>, updated by Stanislav Brabec
85 * <utx@penguin.cz>. Made framing options (NetChip/GeneSys)
86 * tie mostly to (sub)driver info. Workaround some PL-2302
87 * chips that seem to reject SET_INTERFACE requests.
88 *
89 * 06-apr-2002 Added ethtool support, based on a patch from Brad Hards.
90 * Level of diagnostics is more configurable; they use device
91 * location (usb_device->devpath) instead of address (2.5).
92 * For tx_fixup, memflags can't be NOIO.
93 * 07-may-2002 Generalize/cleanup keventd support, handling rx stalls (mostly
94 * for USB 2.0 TTs) and memory shortages (potential) too. (db)
95 * Use "locally assigned" IEEE802 address space. (Brad Hards)
96 * 18-oct-2002 Support for Zaurus (Pavel Machek), related cleanup (db).
97 * 14-dec-2002 Remove Zaurus-private crc32 code (Pavel); 2.5 oops fix,
98 * cleanups and stubbed PXA-250 support (db), fix for framing
99 * issues on Z, net1080, and gl620a (Toby Milne)
100 *
101 * 31-mar-2003 Use endpoint descriptors: high speed support, simpler sa1100
102 * vs pxa25x, and CDC Ethernet. Throttle down log floods on
103 * disconnect; other cleanups. (db) Flush net1080 fifos
104 * after several sequential framing errors. (Johannes Erdfelt)
105 * 22-aug-2003 AX8817X support (Dave Hollis).
106 *
107 * 14-jun-2004 Trivial patch for AX8817X based Buffalo LUA-U2-KTX in Japan
108 * (Neil Bortnak)
109 * 03-nov-2004 Trivial patch for KC2190 (KC-190) chip. (Jonathan McDowell)
110 *
111 * 01-feb-2005 AX88772 support (Phil Chang & Dave Hollis)
112 *-------------------------------------------------------------------------*/
113 32
114// #define DEBUG // error path messages, extra info 33// #define DEBUG // error path messages, extra info
115// #define VERBOSE // more; success messages 34// #define VERBOSE // more; success messages
@@ -302,77 +221,6 @@ void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)
302EXPORT_SYMBOL_GPL(usbnet_skb_return); 221EXPORT_SYMBOL_GPL(usbnet_skb_return);
303 222
304 223
305#ifdef CONFIG_USB_PL2301
306#define HAVE_HARDWARE
307
308/*-------------------------------------------------------------------------
309 *
310 * Prolific PL-2301/PL-2302 driver ... http://www.prolifictech.com
311 *
312 * The protocol and handshaking used here should be bug-compatible
313 * with the Linux 2.2 "plusb" driver, by Deti Fliegl.
314 *
315 *-------------------------------------------------------------------------*/
316
317/*
318 * Bits 0-4 can be used for software handshaking; they're set from
319 * one end, cleared from the other, "read" with the interrupt byte.
320 */
321#define PL_S_EN (1<<7) /* (feature only) suspend enable */
322/* reserved bit -- rx ready (6) ? */
323#define PL_TX_READY (1<<5) /* (interrupt only) transmit ready */
324#define PL_RESET_OUT (1<<4) /* reset output pipe */
325#define PL_RESET_IN (1<<3) /* reset input pipe */
326#define PL_TX_C (1<<2) /* transmission complete */
327#define PL_TX_REQ (1<<1) /* transmission received */
328#define PL_PEER_E (1<<0) /* peer exists */
329
330static inline int
331pl_vendor_req (struct usbnet *dev, u8 req, u8 val, u8 index)
332{
333 return usb_control_msg (dev->udev,
334 usb_rcvctrlpipe (dev->udev, 0),
335 req,
336 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
337 val, index,
338 NULL, 0,
339 USB_CTRL_GET_TIMEOUT);
340}
341
342static inline int
343pl_clear_QuickLink_features (struct usbnet *dev, int val)
344{
345 return pl_vendor_req (dev, 1, (u8) val, 0);
346}
347
348static inline int
349pl_set_QuickLink_features (struct usbnet *dev, int val)
350{
351 return pl_vendor_req (dev, 3, (u8) val, 0);
352}
353
354/*-------------------------------------------------------------------------*/
355
356static int pl_reset (struct usbnet *dev)
357{
358 /* some units seem to need this reset, others reject it utterly.
359 * FIXME be more like "naplink" or windows drivers.
360 */
361 (void) pl_set_QuickLink_features (dev,
362 PL_S_EN|PL_RESET_OUT|PL_RESET_IN|PL_PEER_E);
363 return 0;
364}
365
366static const struct driver_info prolific_info = {
367 .description = "Prolific PL-2301/PL-2302",
368 .flags = FLAG_NO_SETINT,
369 /* some PL-2302 versions seem to fail usb_set_interface() */
370 .reset = pl_reset,
371};
372
373#endif /* CONFIG_USB_PL2301 */
374
375
376/*------------------------------------------------------------------------- 224/*-------------------------------------------------------------------------
377 * 225 *
378 * Network Device Driver (peer link to "Host Device", from USB host) 226 * Network Device Driver (peer link to "Host Device", from USB host)
@@ -1356,60 +1204,22 @@ EXPORT_SYMBOL_GPL(usbnet_resume);
1356 1204
1357/*-------------------------------------------------------------------------*/ 1205/*-------------------------------------------------------------------------*/
1358 1206
1359#ifndef HAVE_HARDWARE
1360#error You need to configure some hardware for this driver
1361#endif
1362
1363/*
1364 * chip vendor names won't normally be on the cables, and
1365 * may not be on the device.
1366 */
1367
1368static const struct usb_device_id products [] = {
1369
1370#ifdef CONFIG_USB_PL2301
1371{
1372 USB_DEVICE (0x067b, 0x0000), // PL-2301
1373 .driver_info = (unsigned long) &prolific_info,
1374}, {
1375 USB_DEVICE (0x067b, 0x0001), // PL-2302
1376 .driver_info = (unsigned long) &prolific_info,
1377},
1378#endif
1379 { }, // END
1380};
1381MODULE_DEVICE_TABLE (usb, products);
1382
1383static struct usb_driver usbnet_driver = {
1384 .owner = THIS_MODULE,
1385 .name = driver_name,
1386 .id_table = products,
1387 .probe = usbnet_probe,
1388 .disconnect = usbnet_disconnect,
1389 .suspend = usbnet_suspend,
1390 .resume = usbnet_resume,
1391};
1392
1393/*-------------------------------------------------------------------------*/
1394
1395static int __init usbnet_init(void) 1207static int __init usbnet_init(void)
1396{ 1208{
1397 // compiler should optimize these out 1209 /* compiler should optimize this out */
1398 BUG_ON (sizeof (((struct sk_buff *)0)->cb) 1210 BUG_ON (sizeof (((struct sk_buff *)0)->cb)
1399 < sizeof (struct skb_data)); 1211 < sizeof (struct skb_data));
1400 1212
1401 random_ether_addr(node_id); 1213 random_ether_addr(node_id);
1402 1214 return 0;
1403 return usb_register(&usbnet_driver);
1404} 1215}
1405module_init(usbnet_init); 1216module_init(usbnet_init);
1406 1217
1407static void __exit usbnet_exit(void) 1218static void __exit usbnet_exit(void)
1408{ 1219{
1409 usb_deregister(&usbnet_driver);
1410} 1220}
1411module_exit(usbnet_exit); 1221module_exit(usbnet_exit);
1412 1222
1413MODULE_AUTHOR("David Brownell"); 1223MODULE_AUTHOR("David Brownell");
1414MODULE_DESCRIPTION("USB Host-to-Host Link Drivers (numerous vendors)"); 1224MODULE_DESCRIPTION("USB network driver framework");
1415MODULE_LICENSE("GPL"); 1225MODULE_LICENSE("GPL");