aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2005-08-31 12:52:45 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 19:28:31 -0400
commit38bde1d4699af45e6a4167a72e2e512e45c35ca8 (patch)
tree9a133b9c7f7d6d2ecbf99b14a9ce8bfd5b0ceea7
parentf29fc259976e9f4dd1fe8ed59ccdd50e4ea61db0 (diff)
[PATCH] USB: usbnet (2/9) module for simple network links
This patch creates the first of several separate "minidriver" modules for "usbnet". This one handles only the very simplest hardware, which can be handled almost entirely by the "usbnet" core. - Move device-specific bits into new "cdc_subset.c" driver, shrinking "usbnet" by a bunch; - Export the functions needed to support this minidriver (with EXPORT_SYMBOL_GPL); - Update Kconfig and kbuild accordingly. This one handles about a dozen different device types, with the most notable ones being Gumstix and most Linux-based PDAs (except Zaurus running that ancient code from Sharp). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/net/Kconfig123
-rw-r--r--drivers/usb/net/Makefile1
-rw-r--r--drivers/usb/net/cdc_subset.c335
-rw-r--r--drivers/usb/net/usbnet.c240
-rw-r--r--drivers/usb/net/usbnet.h15
5 files changed, 429 insertions, 285 deletions
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
index 135d50889d81..6399b43d41a5 100644
--- a/drivers/usb/net/Kconfig
+++ b/drivers/usb/net/Kconfig
@@ -128,32 +128,6 @@ config USB_USBNET
128comment "USB Host-to-Host Cables" 128comment "USB Host-to-Host Cables"
129 depends on USB_USBNET 129 depends on USB_USBNET
130 130
131config USB_ALI_M5632
132 boolean "ALi M5632 based 'USB 2.0 Data Link' cables"
133 depends on USB_USBNET
134 default y
135 help
136 Choose this option if you're using a host-to-host cable
137 based on this design, which supports USB 2.0 high speed.
138
139config USB_AN2720
140 boolean "AnchorChips 2720 based cables (Xircom PGUNET, ...)"
141 depends on USB_USBNET
142 default y
143 help
144 Choose this option if you're using a host-to-host cable
145 based on this design. Note that AnchorChips is now a
146 Cypress brand.
147
148config USB_BELKIN
149 boolean "eTEK based host-to-host cables (Advance, Belkin, ...)"
150 depends on USB_USBNET
151 default y
152 help
153 Choose this option if you're using a host-to-host cable
154 based on this design: two NetChip 2890 chips and an Atmel
155 microcontroller, with LEDs that indicate traffic.
156
157config USB_GENESYS 131config USB_GENESYS
158 boolean "GeneSys GL620USB-A based cables" 132 boolean "GeneSys GL620USB-A based cables"
159 default y 133 default y
@@ -182,42 +156,9 @@ config USB_PL2301
182 Choose this option if you're using a host-to-host cable 156 Choose this option if you're using a host-to-host cable
183 with one of these chips. 157 with one of these chips.
184 158
185config USB_KC2190
186 boolean "KT Technology KC2190 based cables (InstaNet)"
187 default y
188 depends on USB_USBNET && EXPERIMENTAL
189 help
190 Choose this option if you're using a host-to-host cable
191 with one of these chips.
192
193comment "Intelligent USB Devices/Gadgets" 159comment "Intelligent USB Devices/Gadgets"
194 depends on USB_USBNET 160 depends on USB_USBNET
195 161
196config USB_ARMLINUX
197 boolean "Embedded ARM Linux links (iPaq, ...)"
198 depends on USB_USBNET
199 default y
200 help
201 Choose this option to support the "usb-eth" networking driver
202 used by most of the ARM Linux community with device controllers
203 such as the SA-11x0 and PXA-25x UDCs, or the tftp capabilities
204 in some PXA versions of the "blob" boot loader.
205
206 Linux-based "Gumstix" PXA-25x based systems use this protocol
207 to talk with other Linux systems.
208
209 Although the ROMs shipped with Sharp Zaurus products use a
210 different link level framing protocol, you can have them use
211 this simpler protocol by installing a different kernel.
212
213config USB_EPSON2888
214 boolean "Epson 2888 based firmware (DEVELOPMENT)"
215 depends on USB_USBNET
216 default y
217 help
218 Choose this option to support the usb networking links used
219 by some sample firmware from Epson.
220
221config USB_ZAURUS 162config USB_ZAURUS
222 boolean "Sharp Zaurus (stock ROMs) and compatible" 163 boolean "Sharp Zaurus (stock ROMs) and compatible"
223 depends on USB_USBNET 164 depends on USB_USBNET
@@ -292,6 +233,70 @@ config USB_AX8817X
292 This driver creates an interface named "ethX", where X depends on 233 This driver creates an interface named "ethX", where X depends on
293 what other networking devices you have in use. 234 what other networking devices you have in use.
294 235
236
237config USB_NET_CDC_SUBSET
238 tristate "Simple USB Network Links (CDC Ethernet subset)"
239 depends on USB_USBNET
240 help
241 This driver module supports USB network devices that can work
242 without any device-specific information. Select it if you have
243 one of these drivers.
244
245 Note that while many USB host-to-host cables can work in this mode,
246 that may mean not being able to talk to Win32 systems or more
247 commonly not being able to handle certain events (like replugging
248 the host on the other end) very well. Also, these devices will
249 not generally have permanently assigned Ethernet addresses.
250
251config USB_ALI_M5632
252 boolean "ALi M5632 based 'USB 2.0 Data Link' cables"
253 depends on USB_NET_CDC_SUBSET
254 help
255 Choose this option if you're using a host-to-host cable
256 based on this design, which supports USB 2.0 high speed.
257
258config USB_AN2720
259 boolean "AnchorChips 2720 based cables (Xircom PGUNET, ...)"
260 depends on USB_NET_CDC_SUBSET
261 help
262 Choose this option if you're using a host-to-host cable
263 based on this design. Note that AnchorChips is now a
264 Cypress brand.
265
266config USB_BELKIN
267 boolean "eTEK based host-to-host cables (Advance, Belkin, ...)"
268 depends on USB_NET_CDC_SUBSET
269 default y
270 help
271 Choose this option if you're using a host-to-host cable
272 based on this design: two NetChip 2890 chips and an Atmel
273 microcontroller, with LEDs that indicate traffic.
274
275config USB_ARMLINUX
276 boolean "Embedded ARM Linux links (iPaq, ...)"
277 depends on USB_NET_CDC_SUBSET
278 default y
279 help
280 Choose this option to support the "usb-eth" networking driver
281 used by most of the ARM Linux community with device controllers
282 such as the SA-11x0 and PXA-25x UDCs, or the tftp capabilities
283 in some PXA versions of the "blob" boot loader.
284
285 Linux-based "Gumstix" PXA-25x based systems use this protocol
286 to talk with other Linux systems.
287
288 Although the ROMs shipped with Sharp Zaurus products use a
289 different link level framing protocol, you can have them use
290 this simpler protocol by installing a different kernel.
291
292config USB_EPSON2888
293 boolean "Epson 2888 based firmware (DEVELOPMENT)"
294 depends on USB_NET_CDC_SUBSET
295 help
296 Choose this option to support the usb networking links used
297 by some sample firmware from Epson.
298
299
295config USB_ZD1201 300config USB_ZD1201
296 tristate "USB ZD1201 based Wireless device support" 301 tristate "USB ZD1201 based Wireless device support"
297 depends on NET_RADIO 302 depends on NET_RADIO
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
index fe3fd4115e1e..23608ccc6380 100644
--- a/drivers/usb/net/Makefile
+++ b/drivers/usb/net/Makefile
@@ -6,5 +6,6 @@ obj-$(CONFIG_USB_CATC) += catc.o
6obj-$(CONFIG_USB_KAWETH) += kaweth.o 6obj-$(CONFIG_USB_KAWETH) += kaweth.o
7obj-$(CONFIG_USB_PEGASUS) += pegasus.o 7obj-$(CONFIG_USB_PEGASUS) += pegasus.o
8obj-$(CONFIG_USB_RTL8150) += rtl8150.o 8obj-$(CONFIG_USB_RTL8150) += rtl8150.o
9obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
9obj-$(CONFIG_USB_USBNET) += usbnet.o 10obj-$(CONFIG_USB_USBNET) += usbnet.o
10obj-$(CONFIG_USB_ZD1201) += zd1201.o 11obj-$(CONFIG_USB_ZD1201) += zd1201.o
diff --git a/drivers/usb/net/cdc_subset.c b/drivers/usb/net/cdc_subset.c
new file mode 100644
index 000000000000..f1730b685fd2
--- /dev/null
+++ b/drivers/usb/net/cdc_subset.c
@@ -0,0 +1,335 @@
1/*
2 * Simple "CDC Subset" USB Networking Links
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#include <linux/config.h>
21#ifdef CONFIG_USB_DEBUG
22# define DEBUG
23#endif
24#include <linux/module.h>
25#include <linux/kmod.h>
26#include <linux/sched.h>
27#include <linux/init.h>
28#include <linux/netdevice.h>
29#include <linux/etherdevice.h>
30#include <linux/ethtool.h>
31#include <linux/workqueue.h>
32#include <linux/mii.h>
33#include <linux/usb.h>
34
35#include "usbnet.h"
36
37
38/*
39 * This supports simple USB network links that don't require any special
40 * framing or hardware control operations. The protocol used here is a
41 * strict subset of CDC Ethernet, with three basic differences reflecting
42 * the goal that almost any hardware should run it:
43 *
44 * - Minimal runtime control: one interface, no altsettings, and
45 * no vendor or class specific control requests. If a device is
46 * configured, it is allowed to exchange packets with the host.
47 * Fancier models would mean not working on some hardware.
48 *
49 * - Minimal manufacturing control: no IEEE "Organizationally
50 * Unique ID" required, or an EEPROMs to store one. Each host uses
51 * one random "locally assigned" Ethernet address instead, which can
52 * of course be overridden using standard tools like "ifconfig".
53 * (With 2^46 such addresses, same-net collisions are quite rare.)
54 *
55 * - There is no additional framing data for USB. Packets are written
56 * exactly as in CDC Ethernet, starting with an Ethernet header and
57 * terminated by a short packet. However, the host will never send a
58 * zero length packet; some systems can't handle those robustly.
59 *
60 * Anything that can transmit and receive USB bulk packets can implement
61 * this protocol. That includes both smart peripherals and quite a lot
62 * of "host-to-host" USB cables (which embed two devices back-to-back).
63 *
64 * Note that although Linux may use many of those host-to-host links
65 * with this "cdc_subset" framing, that doesn't mean there may not be a
66 * better approach. Handling the "other end unplugs/replugs" scenario
67 * well tends to require chip-specific vendor requests. Also, Windows
68 * peers at the other end of host-to-host cables may expect their own
69 * framing to be used rather than this "cdc_subset" model.
70 */
71
72#if defined(CONFIG_USB_EPSON2888) || defined(CONFIG_USB_ARMLINUX)
73/* PDA style devices are always connected if present */
74static int always_connected (struct usbnet *dev)
75{
76 return 0;
77}
78#endif
79
80#ifdef CONFIG_USB_ALI_M5632
81#define HAVE_HARDWARE
82
83/*-------------------------------------------------------------------------
84 *
85 * ALi M5632 driver ... does high speed
86 *
87 *-------------------------------------------------------------------------*/
88
89static const struct driver_info ali_m5632_info = {
90 .description = "ALi M5632",
91};
92
93
94#endif
95
96
97#ifdef CONFIG_USB_AN2720
98#define HAVE_HARDWARE
99
100/*-------------------------------------------------------------------------
101 *
102 * AnchorChips 2720 driver ... http://www.cypress.com
103 *
104 * This doesn't seem to have a way to detect whether the peer is
105 * connected, or need any reset handshaking. It's got pretty big
106 * internal buffers (handles most of a frame's worth of data).
107 * Chip data sheets don't describe any vendor control messages.
108 *
109 *-------------------------------------------------------------------------*/
110
111static const struct driver_info an2720_info = {
112 .description = "AnchorChips/Cypress 2720",
113 // no reset available!
114 // no check_connect available!
115
116 .in = 2, .out = 2, // direction distinguishes these
117};
118
119#endif /* CONFIG_USB_AN2720 */
120
121
122#ifdef CONFIG_USB_BELKIN
123#define HAVE_HARDWARE
124
125/*-------------------------------------------------------------------------
126 *
127 * Belkin F5U104 ... two NetChip 2280 devices + Atmel AVR microcontroller
128 *
129 * ... also two eTEK designs, including one sold as "Advance USBNET"
130 *
131 *-------------------------------------------------------------------------*/
132
133static const struct driver_info belkin_info = {
134 .description = "Belkin, eTEK, or compatible",
135};
136
137#endif /* CONFIG_USB_BELKIN */
138
139
140
141#ifdef CONFIG_USB_EPSON2888
142#define HAVE_HARDWARE
143
144/*-------------------------------------------------------------------------
145 *
146 * EPSON USB clients
147 *
148 * This is the same idea as Linux PDAs (below) except the firmware in the
149 * device might not be Tux-powered. Epson provides reference firmware that
150 * implements this interface. Product developers can reuse or modify that
151 * code, such as by using their own product and vendor codes.
152 *
153 * Support was from Juro Bystricky <bystricky.juro@erd.epson.com>
154 *
155 *-------------------------------------------------------------------------*/
156
157static const struct driver_info epson2888_info = {
158 .description = "Epson USB Device",
159 .check_connect = always_connected,
160
161 .in = 4, .out = 3,
162};
163
164#endif /* CONFIG_USB_EPSON2888 */
165
166
167#ifdef CONFIG_USB_KC2190
168#define HAVE_HARDWARE
169static const struct driver_info kc2190_info = {
170 .description = "KC Technology KC-190",
171};
172#endif /* CONFIG_USB_KC2190 */
173
174
175#ifdef CONFIG_USB_ARMLINUX
176#define HAVE_HARDWARE
177
178/*-------------------------------------------------------------------------
179 *
180 * Intel's SA-1100 chip integrates basic USB support, and is used
181 * in PDAs like some iPaqs, the Yopy, some Zaurus models, and more.
182 * When they run Linux, arch/arm/mach-sa1100/usb-eth.c may be used to
183 * network using minimal USB framing data.
184 *
185 * This describes the driver currently in standard ARM Linux kernels.
186 * The Zaurus uses a different driver (see later).
187 *
188 * PXA25x and PXA210 use XScale cores (ARM v5TE) with better USB support
189 * and different USB endpoint numbering than the SA1100 devices. The
190 * mach-pxa/usb-eth.c driver re-uses the device ids from mach-sa1100
191 * so we rely on the endpoint descriptors.
192 *
193 *-------------------------------------------------------------------------*/
194
195static const struct driver_info linuxdev_info = {
196 .description = "Linux Device",
197 .check_connect = always_connected,
198};
199
200static const struct driver_info yopy_info = {
201 .description = "Yopy",
202 .check_connect = always_connected,
203};
204
205static const struct driver_info blob_info = {
206 .description = "Boot Loader OBject",
207 .check_connect = always_connected,
208};
209
210#endif /* CONFIG_USB_ARMLINUX */
211
212
213/*-------------------------------------------------------------------------*/
214
215#ifndef HAVE_HARDWARE
216#error You need to configure some hardware for this driver
217#endif
218
219/*
220 * chip vendor names won't normally be on the cables, and
221 * may not be on the device.
222 */
223
224static const struct usb_device_id products [] = {
225
226#ifdef CONFIG_USB_ALI_M5632
227{
228 USB_DEVICE (0x0402, 0x5632), // ALi defaults
229 .driver_info = (unsigned long) &ali_m5632_info,
230},
231#endif
232
233#ifdef CONFIG_USB_AN2720
234{
235 USB_DEVICE (0x0547, 0x2720), // AnchorChips defaults
236 .driver_info = (unsigned long) &an2720_info,
237}, {
238 USB_DEVICE (0x0547, 0x2727), // Xircom PGUNET
239 .driver_info = (unsigned long) &an2720_info,
240},
241#endif
242
243#ifdef CONFIG_USB_BELKIN
244{
245 USB_DEVICE (0x050d, 0x0004), // Belkin
246 .driver_info = (unsigned long) &belkin_info,
247}, {
248 USB_DEVICE (0x056c, 0x8100), // eTEK
249 .driver_info = (unsigned long) &belkin_info,
250}, {
251 USB_DEVICE (0x0525, 0x9901), // Advance USBNET (eTEK)
252 .driver_info = (unsigned long) &belkin_info,
253},
254#endif
255
256#ifdef CONFIG_USB_EPSON2888
257{
258 USB_DEVICE (0x0525, 0x2888), // EPSON USB client
259 .driver_info = (unsigned long) &epson2888_info,
260},
261#endif
262
263#ifdef CONFIG_USB_KC2190
264{
265 USB_DEVICE (0x050f, 0x0190), // KC-190
266 .driver_info = (unsigned long) &kc2190_info,
267},
268#endif
269
270#ifdef CONFIG_USB_ARMLINUX
271/*
272 * SA-1100 using standard ARM Linux kernels, or compatible.
273 * Often used when talking to Linux PDAs (iPaq, Yopy, etc).
274 * The sa-1100 "usb-eth" driver handles the basic framing.
275 *
276 * PXA25x or PXA210 ... these use a "usb-eth" driver much like
277 * the sa1100 one, but hardware uses different endpoint numbers.
278 *
279 * Or the Linux "Ethernet" gadget on hardware that can't talk
280 * CDC Ethernet (e.g., no altsettings), in either of two modes:
281 * - acting just like the old "usb-eth" firmware, though
282 * the implementation is different
283 * - supporting RNDIS as the first/default configuration for
284 * MS-Windows interop; Linux needs to use the other config
285 */
286{
287 // 1183 = 0x049F, both used as hex values?
288 // Compaq "Itsy" vendor/product id
289 USB_DEVICE (0x049F, 0x505A), // usb-eth, or compatible
290 .driver_info = (unsigned long) &linuxdev_info,
291}, {
292 USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy"
293 .driver_info = (unsigned long) &yopy_info,
294}, {
295 USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader
296 .driver_info = (unsigned long) &blob_info,
297}, {
298 // Linux Ethernet/RNDIS gadget on pxa210/25x/26x, second config
299 // e.g. Gumstix, current OpenZaurus, ...
300 USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
301 .driver_info = (unsigned long) &linuxdev_info,
302},
303#endif
304
305 { }, // END
306};
307MODULE_DEVICE_TABLE(usb, products);
308
309/*-------------------------------------------------------------------------*/
310
311static struct usb_driver cdc_subset_driver = {
312 .owner = THIS_MODULE,
313 .name = "cdc_subset",
314 .probe = usbnet_probe,
315 .suspend = usbnet_suspend,
316 .resume = usbnet_resume,
317 .disconnect = usbnet_disconnect,
318 .id_table = products,
319};
320
321static int __init cdc_subset_init(void)
322{
323 return usb_register(&cdc_subset_driver);
324}
325module_init(cdc_subset_init);
326
327static void __exit cdc_subset_exit(void)
328{
329 usb_deregister(&cdc_subset_driver);
330}
331module_exit(cdc_subset_exit);
332
333MODULE_AUTHOR("David Brownell");
334MODULE_DESCRIPTION("Simple 'CDC Subset' USB networking links");
335MODULE_LICENSE("GPL");
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 3f2cad6dc261..57b41fbd3bb8 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -322,48 +322,6 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb)
322} 322}
323 323
324 324
325#ifdef CONFIG_USB_ALI_M5632
326#define HAVE_HARDWARE
327
328/*-------------------------------------------------------------------------
329 *
330 * ALi M5632 driver ... does high speed
331 *
332 *-------------------------------------------------------------------------*/
333
334static const struct driver_info ali_m5632_info = {
335 .description = "ALi M5632",
336};
337
338
339#endif
340
341
342#ifdef CONFIG_USB_AN2720
343#define HAVE_HARDWARE
344
345/*-------------------------------------------------------------------------
346 *
347 * AnchorChips 2720 driver ... http://www.cypress.com
348 *
349 * This doesn't seem to have a way to detect whether the peer is
350 * connected, or need any reset handshaking. It's got pretty big
351 * internal buffers (handles most of a frame's worth of data).
352 * Chip data sheets don't describe any vendor control messages.
353 *
354 *-------------------------------------------------------------------------*/
355
356static const struct driver_info an2720_info = {
357 .description = "AnchorChips/Cypress 2720",
358 // no reset available!
359 // no check_connect available!
360
361 .in = 2, .out = 2, // direction distinguishes these
362};
363
364#endif /* CONFIG_USB_AN2720 */
365
366
367#ifdef CONFIG_USB_AX8817X 325#ifdef CONFIG_USB_AX8817X
368/* ASIX AX8817X based USB 2.0 Ethernet Devices */ 326/* ASIX AX8817X based USB 2.0 Ethernet Devices */
369 327
@@ -1142,25 +1100,6 @@ static const struct driver_info ax88772_info = {
1142 1100
1143 1101
1144 1102
1145#ifdef CONFIG_USB_BELKIN
1146#define HAVE_HARDWARE
1147
1148/*-------------------------------------------------------------------------
1149 *
1150 * Belkin F5U104 ... two NetChip 2280 devices + Atmel microcontroller
1151 *
1152 * ... also two eTEK designs, including one sold as "Advance USBNET"
1153 *
1154 *-------------------------------------------------------------------------*/
1155
1156static const struct driver_info belkin_info = {
1157 .description = "Belkin, eTEK, or compatible",
1158};
1159
1160#endif /* CONFIG_USB_BELKIN */
1161
1162
1163
1164/*------------------------------------------------------------------------- 1103/*-------------------------------------------------------------------------
1165 * 1104 *
1166 * Communications Device Class declarations. 1105 * Communications Device Class declarations.
@@ -1538,32 +1477,6 @@ static const struct driver_info cdc_info = {
1538 1477
1539 1478
1540 1479
1541#ifdef CONFIG_USB_EPSON2888
1542#define HAVE_HARDWARE
1543
1544/*-------------------------------------------------------------------------
1545 *
1546 * EPSON USB clients
1547 *
1548 * This is the same idea as Linux PDAs (below) except the firmware in the
1549 * device might not be Tux-powered. Epson provides reference firmware that
1550 * implements this interface. Product developers can reuse or modify that
1551 * code, such as by using their own product and vendor codes.
1552 *
1553 * Support was from Juro Bystricky <bystricky.juro@erd.epson.com>
1554 *
1555 *-------------------------------------------------------------------------*/
1556
1557static const struct driver_info epson2888_info = {
1558 .description = "Epson USB Device",
1559 .check_connect = always_connected,
1560
1561 .in = 4, .out = 3,
1562};
1563
1564#endif /* CONFIG_USB_EPSON2888 */
1565
1566
1567#ifdef CONFIG_USB_GENESYS 1480#ifdef CONFIG_USB_GENESYS
1568#define HAVE_HARDWARE 1481#define HAVE_HARDWARE
1569 1482
@@ -2495,52 +2408,6 @@ static const struct driver_info prolific_info = {
2495#endif /* CONFIG_USB_PL2301 */ 2408#endif /* CONFIG_USB_PL2301 */
2496 2409
2497 2410
2498#ifdef CONFIG_USB_KC2190
2499#define HAVE_HARDWARE
2500static const struct driver_info kc2190_info = {
2501 .description = "KC Technology KC-190",
2502};
2503#endif /* CONFIG_USB_KC2190 */
2504
2505
2506#ifdef CONFIG_USB_ARMLINUX
2507#define HAVE_HARDWARE
2508
2509/*-------------------------------------------------------------------------
2510 *
2511 * Intel's SA-1100 chip integrates basic USB support, and is used
2512 * in PDAs like some iPaqs, the Yopy, some Zaurus models, and more.
2513 * When they run Linux, arch/arm/mach-sa1100/usb-eth.c may be used to
2514 * network using minimal USB framing data.
2515 *
2516 * This describes the driver currently in standard ARM Linux kernels.
2517 * The Zaurus uses a different driver (see later).
2518 *
2519 * PXA25x and PXA210 use XScale cores (ARM v5TE) with better USB support
2520 * and different USB endpoint numbering than the SA1100 devices. The
2521 * mach-pxa/usb-eth.c driver re-uses the device ids from mach-sa1100
2522 * so we rely on the endpoint descriptors.
2523 *
2524 *-------------------------------------------------------------------------*/
2525
2526static const struct driver_info linuxdev_info = {
2527 .description = "Linux Device",
2528 .check_connect = always_connected,
2529};
2530
2531static const struct driver_info yopy_info = {
2532 .description = "Yopy",
2533 .check_connect = always_connected,
2534};
2535
2536static const struct driver_info blob_info = {
2537 .description = "Boot Loader OBject",
2538 .check_connect = always_connected,
2539};
2540
2541#endif /* CONFIG_USB_ARMLINUX */
2542
2543
2544#ifdef CONFIG_USB_ZAURUS 2411#ifdef CONFIG_USB_ZAURUS
2545#define HAVE_HARDWARE 2412#define HAVE_HARDWARE
2546 2413
@@ -3575,7 +3442,7 @@ static void usbnet_bh (unsigned long param)
3575 3442
3576// precondition: never called in_interrupt 3443// precondition: never called in_interrupt
3577 3444
3578static void usbnet_disconnect (struct usb_interface *intf) 3445void usbnet_disconnect (struct usb_interface *intf)
3579{ 3446{
3580 struct usbnet *dev; 3447 struct usbnet *dev;
3581 struct usb_device *xdev; 3448 struct usb_device *xdev;
@@ -3589,7 +3456,8 @@ static void usbnet_disconnect (struct usb_interface *intf)
3589 xdev = interface_to_usbdev (intf); 3456 xdev = interface_to_usbdev (intf);
3590 3457
3591 if (netif_msg_probe (dev)) 3458 if (netif_msg_probe (dev))
3592 devinfo (dev, "unregister usbnet usb-%s-%s, %s", 3459 devinfo (dev, "unregister '%s' usb-%s-%s, %s",
3460 intf->dev.driver->name,
3593 xdev->bus->bus_name, xdev->devpath, 3461 xdev->bus->bus_name, xdev->devpath,
3594 dev->driver_info->description); 3462 dev->driver_info->description);
3595 3463
@@ -3605,6 +3473,7 @@ static void usbnet_disconnect (struct usb_interface *intf)
3605 free_netdev(net); 3473 free_netdev(net);
3606 usb_put_dev (xdev); 3474 usb_put_dev (xdev);
3607} 3475}
3476EXPORT_SYMBOL_GPL(usbnet_disconnect);
3608 3477
3609 3478
3610/*-------------------------------------------------------------------------*/ 3479/*-------------------------------------------------------------------------*/
@@ -3613,7 +3482,7 @@ static struct ethtool_ops usbnet_ethtool_ops;
3613 3482
3614// precondition: never called in_interrupt 3483// precondition: never called in_interrupt
3615 3484
3616static int 3485int
3617usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) 3486usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
3618{ 3487{
3619 struct usbnet *dev; 3488 struct usbnet *dev;
@@ -3719,8 +3588,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
3719 if (status) 3588 if (status)
3720 goto out3; 3589 goto out3;
3721 if (netif_msg_probe (dev)) 3590 if (netif_msg_probe (dev))
3722 devinfo (dev, "register usbnet at usb-%s-%s, %s, " 3591 devinfo (dev, "register '%s' at usb-%s-%s, %s, "
3723 "%02x:%02x:%02x:%02x:%02x:%02x", 3592 "%02x:%02x:%02x:%02x:%02x:%02x",
3593 udev->dev.driver->name,
3724 xdev->bus->bus_name, xdev->devpath, 3594 xdev->bus->bus_name, xdev->devpath,
3725 dev->driver_info->description, 3595 dev->driver_info->description,
3726 net->dev_addr [0], net->dev_addr [1], 3596 net->dev_addr [0], net->dev_addr [1],
@@ -3744,12 +3614,15 @@ out:
3744 usb_put_dev(xdev); 3614 usb_put_dev(xdev);
3745 return status; 3615 return status;
3746} 3616}
3617EXPORT_SYMBOL_GPL(usbnet_probe);
3747 3618
3748/*-------------------------------------------------------------------------*/ 3619/*-------------------------------------------------------------------------*/
3749 3620
3750#ifdef CONFIG_PM 3621/* FIXME these suspend/resume methods assume non-CDC style
3622 * devices, with only one interface.
3623 */
3751 3624
3752static int usbnet_suspend (struct usb_interface *intf, pm_message_t message) 3625int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
3753{ 3626{
3754 struct usbnet *dev = usb_get_intfdata(intf); 3627 struct usbnet *dev = usb_get_intfdata(intf);
3755 3628
@@ -3762,8 +3635,9 @@ static int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
3762 intf->dev.power.power_state = PMSG_SUSPEND; 3635 intf->dev.power.power_state = PMSG_SUSPEND;
3763 return 0; 3636 return 0;
3764} 3637}
3638EXPORT_SYMBOL_GPL(usbnet_suspend);
3765 3639
3766static int usbnet_resume (struct usb_interface *intf) 3640int usbnet_resume (struct usb_interface *intf)
3767{ 3641{
3768 struct usbnet *dev = usb_get_intfdata(intf); 3642 struct usbnet *dev = usb_get_intfdata(intf);
3769 3643
@@ -3772,13 +3646,8 @@ static int usbnet_resume (struct usb_interface *intf)
3772 tasklet_schedule (&dev->bh); 3646 tasklet_schedule (&dev->bh);
3773 return 0; 3647 return 0;
3774} 3648}
3649EXPORT_SYMBOL_GPL(usbnet_resume);
3775 3650
3776#else /* !CONFIG_PM */
3777
3778#define usbnet_suspend NULL
3779#define usbnet_resume NULL
3780
3781#endif /* CONFIG_PM */
3782 3651
3783/*-------------------------------------------------------------------------*/ 3652/*-------------------------------------------------------------------------*/
3784 3653
@@ -3793,36 +3662,6 @@ static int usbnet_resume (struct usb_interface *intf)
3793 3662
3794static const struct usb_device_id products [] = { 3663static const struct usb_device_id products [] = {
3795 3664
3796#ifdef CONFIG_USB_ALI_M5632
3797{
3798 USB_DEVICE (0x0402, 0x5632), // ALi defaults
3799 .driver_info = (unsigned long) &ali_m5632_info,
3800},
3801#endif
3802
3803#ifdef CONFIG_USB_AN2720
3804{
3805 USB_DEVICE (0x0547, 0x2720), // AnchorChips defaults
3806 .driver_info = (unsigned long) &an2720_info,
3807}, {
3808 USB_DEVICE (0x0547, 0x2727), // Xircom PGUNET
3809 .driver_info = (unsigned long) &an2720_info,
3810},
3811#endif
3812
3813#ifdef CONFIG_USB_BELKIN
3814{
3815 USB_DEVICE (0x050d, 0x0004), // Belkin
3816 .driver_info = (unsigned long) &belkin_info,
3817}, {
3818 USB_DEVICE (0x056c, 0x8100), // eTEK
3819 .driver_info = (unsigned long) &belkin_info,
3820}, {
3821 USB_DEVICE (0x0525, 0x9901), // Advance USBNET (eTEK)
3822 .driver_info = (unsigned long) &belkin_info,
3823},
3824#endif
3825
3826#ifdef CONFIG_USB_AX8817X 3665#ifdef CONFIG_USB_AX8817X
3827{ 3666{
3828 // Linksys USB200M 3667 // Linksys USB200M
@@ -3879,13 +3718,6 @@ static const struct usb_device_id products [] = {
3879}, 3718},
3880#endif 3719#endif
3881 3720
3882#ifdef CONFIG_USB_EPSON2888
3883{
3884 USB_DEVICE (0x0525, 0x2888), // EPSON USB client
3885 .driver_info = (unsigned long) &epson2888_info,
3886},
3887#endif
3888
3889#ifdef CONFIG_USB_GENESYS 3721#ifdef CONFIG_USB_GENESYS
3890{ 3722{
3891 USB_DEVICE (0x05e3, 0x0502), // GL620USB-A 3723 USB_DEVICE (0x05e3, 0x0502), // GL620USB-A
@@ -3916,13 +3748,6 @@ static const struct usb_device_id products [] = {
3916}, 3748},
3917#endif 3749#endif
3918 3750
3919#ifdef CONFIG_USB_KC2190
3920{
3921 USB_DEVICE (0x050f, 0x0190), // KC-190
3922 .driver_info = (unsigned long) &kc2190_info,
3923},
3924#endif
3925
3926#ifdef CONFIG_USB_RNDIS 3751#ifdef CONFIG_USB_RNDIS
3927{ 3752{
3928 /* RNDIS is MSFT's un-official variant of CDC ACM */ 3753 /* RNDIS is MSFT's un-official variant of CDC ACM */
@@ -3931,41 +3756,6 @@ static const struct usb_device_id products [] = {
3931}, 3756},
3932#endif 3757#endif
3933 3758
3934#ifdef CONFIG_USB_ARMLINUX
3935/*
3936 * SA-1100 using standard ARM Linux kernels, or compatible.
3937 * Often used when talking to Linux PDAs (iPaq, Yopy, etc).
3938 * The sa-1100 "usb-eth" driver handles the basic framing.
3939 *
3940 * PXA25x or PXA210 ... these use a "usb-eth" driver much like
3941 * the sa1100 one, but hardware uses different endpoint numbers.
3942 *
3943 * Or the Linux "Ethernet" gadget on hardware that can't talk
3944 * CDC Ethernet (e.g., no altsettings), in either of two modes:
3945 * - acting just like the old "usb-eth" firmware, though
3946 * the implementation is different
3947 * - supporting RNDIS as the first/default configuration for
3948 * MS-Windows interop; Linux needs to use the other config
3949 */
3950{
3951 // 1183 = 0x049F, both used as hex values?
3952 // Compaq "Itsy" vendor/product id
3953 USB_DEVICE (0x049F, 0x505A), // usb-eth, or compatible
3954 .driver_info = (unsigned long) &linuxdev_info,
3955}, {
3956 USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy"
3957 .driver_info = (unsigned long) &yopy_info,
3958}, {
3959 USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader
3960 .driver_info = (unsigned long) &blob_info,
3961}, {
3962 // Linux Ethernet/RNDIS gadget on pxa210/25x/26x
3963 // e.g. Gumstix, current OpenZaurus, ...
3964 USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
3965 .driver_info = (unsigned long) &linuxdev_info,
3966},
3967#endif
3968
3969#if defined(CONFIG_USB_ZAURUS) || defined(CONFIG_USB_CDCETHER) 3759#if defined(CONFIG_USB_ZAURUS) || defined(CONFIG_USB_CDCETHER)
3970/* 3760/*
3971 * SA-1100 based Sharp Zaurus ("collie"), or compatible. 3761 * SA-1100 based Sharp Zaurus ("collie"), or compatible.
diff --git a/drivers/usb/net/usbnet.h b/drivers/usb/net/usbnet.h
index 44026189a8a1..d903b4617563 100644
--- a/drivers/usb/net/usbnet.h
+++ b/drivers/usb/net/usbnet.h
@@ -24,7 +24,7 @@
24#define __USBNET_H 24#define __USBNET_H
25 25
26 26
27/* interface from usbnet core to each USB networking device we handle */ 27/* interface from usbnet core to each USB networking link we handle */
28struct usbnet { 28struct usbnet {
29 /* housekeeping */ 29 /* housekeeping */
30 struct usb_device *udev; 30 struct usb_device *udev;
@@ -62,6 +62,10 @@ struct usbnet {
62# define EVENT_LINK_RESET 4 62# define EVENT_LINK_RESET 4
63}; 63};
64 64
65static inline struct usb_driver *driver_of(struct usb_interface *intf)
66{
67 return to_usb_driver(intf->dev.driver);
68}
65 69
66/* interface from the device/framing level "minidriver" to core */ 70/* interface from the device/framing level "minidriver" to core */
67struct driver_info { 71struct driver_info {
@@ -111,6 +115,15 @@ struct driver_info {
111 unsigned long data; /* Misc driver specific data */ 115 unsigned long data; /* Misc driver specific data */
112}; 116};
113 117
118/* Minidrivers are just drivers using the "usbnet" core as a powerful
119 * network-specific subroutine library ... that happens to do pretty
120 * much everything except custom framing and chip-specific stuff.
121 */
122extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
123extern int usbnet_suspend (struct usb_interface *, pm_message_t );
124extern int usbnet_resume (struct usb_interface *);
125extern void usbnet_disconnect(struct usb_interface *);
126
114 127
115/* we record the state for each of our queued skbs */ 128/* we record the state for each of our queued skbs */
116enum skb_state { 129enum skb_state {