Commit 0e438d5e authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: usbnet, config changes for CDC Ether

This patch changes how usbnet and CDC Ether get configured,
switching to the newer implementation with that CDC model
(using a "minidriver" for "usbnet").

  - Removes "cdc-ether" from Kconfig and Makefile.
    Once everything flies, "cdc-ether.c" can be
    removed from the kernel.

  - Makes all the "minidriver" options in "usbnet"
    explicit in Kconfig, defaulting to "y" for most
    cases.  So folk expecting a CDC Ether option in
    Kconfig will still have one, and during config
    a list of hardware (cables, PDAs, etc) using the
    "usbnet" driver is now available.  (It's possible
    to save a few pages of code by configuring out
    drivers that use custom framing.)

  - Since now it's possible to create broken configs,
    this checks for them.  The two basic errors being
    configuring "usbnet" with no minidrivers, and
    needing to blacklist Zaurus in CDC-only configs.

  - Zaurus shouldn't do full CDC style init, since it
    doesn't uniquify the Ethernet address it reports;
    and it still shouldn't come up as an "eth%d" link.

The CDC support is still "experimental", since I want
to see a few interop reports for commercial products
before changing that.
parent 57b40886
...@@ -36,7 +36,6 @@ obj-$(CONFIG_USB_STV680) += media/ ...@@ -36,7 +36,6 @@ obj-$(CONFIG_USB_STV680) += media/
obj-$(CONFIG_USB_VICAM) += media/ obj-$(CONFIG_USB_VICAM) += media/
obj-$(CONFIG_USB_CATC) += net/ obj-$(CONFIG_USB_CATC) += net/
obj-$(CONFIG_USB_CDCETHER) += net/
obj-$(CONFIG_USB_KAWETH) += net/ obj-$(CONFIG_USB_KAWETH) += net/
obj-$(CONFIG_USB_PEGASUS) += net/ obj-$(CONFIG_USB_PEGASUS) += net/
obj-$(CONFIG_USB_RTL8150) += net/ obj-$(CONFIG_USB_RTL8150) += net/
......
...@@ -28,30 +28,6 @@ config USB_CATC ...@@ -28,30 +28,6 @@ config USB_CATC
The module will be called catc. If you want to compile it as a The module will be called catc. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
config USB_CDCETHER
tristate "USB CDC Ethernet support (EXPERIMENTAL)"
depends on USB && NET && EXPERIMENTAL
---help---
This driver supports devices conforming to the Communication Device
Class Ethernet Control Model. This is used in some cable modems.
For more details on the specification, get the Communication Device
Class specification from <http://www.usb.org/>.
This driver should work with the following devices:
* Ericsson PipeRider (all variants)
* Motorola (DM100 and SB4100)
* Broadcom Cable Modem (reference design)
* Toshiba PCX1100U and possibly other cable modems
The device creates a network device (ethX, where X depends on what
other networking devices you have in use), as for a normal PCI
or ISA based ethernet network card.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called cdc-ether. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
config USB_KAWETH config USB_KAWETH
tristate "USB KLSI KL5USB101-based ethernet device support" tristate "USB KLSI KL5USB101-based ethernet device support"
depends on USB && NET depends on USB && NET
...@@ -124,26 +100,147 @@ config USB_RTL8150 ...@@ -124,26 +100,147 @@ config USB_RTL8150
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
config USB_USBNET config USB_USBNET
tristate "USB-to-USB Networking for cables, PDAs and other devices" tristate "Host-to-Host Networking for Cables and Smart Devices"
depends on USB && NET depends on USB && NET
---help--- ---help---
This driver supports network links over USB with USB "Network" This driver supports several kinds of network links over USB,
or "data transfer" cables, often used to network laptops to PCs. with "minidrivers" built around a common network driver core
Such cables have chips from suppliers such as Belkin/eTEK, GeneSys that supports deep queues for efficient transfers.
(GeneLink), NetChip and Prolific. Some motherboards with USB PC2PC
support include such chips. Typically, these links involves only two network hosts. The
host runs "usbnet", and the other end of the link might be:
- Another USB host, when using USB "network" or "data transfer"
cables. These are often used to network laptops to PCs, like
"Laplink" parallel cables or some motherboards. These rely
on specialized chips from many suppliers.
- An intelligent USB gadget, perhaps embedding a Linux system.
These include PDAs running Linux (iPaq, Yopy, Zaurus, and
others), and devices that interoperate using the standard
CDC-Ethernet specification (including many cable modems).
Intelligent USB devices, such as PDAs running Linux (like Yopy The link will appear with a name like "usb0", when the link is
and Zaurus, or iPaqs after upgrading to Linux) can use the same a two-node link, or "eth0" for most CDC-Ethernet devices. Those
approach to provide Internet access. two-node links are most easily managed with Ethernet Bridging
(CONFIG_BRIDGE) instead of routing.
These links will have names like "usb0", "usb1", etc. They act For more information see <http://www.linux-usb.org/usbnet/>.
like two-node Ethernets, so you can use 802.1d Ethernet Bridging
(CONFIG_BRIDGE) to simplify your network routing. For more
information see <http://www.linux-usb.org/usbnet/>.
This code is also available as a kernel module (code which can be This code is also available as a kernel module (code which can be
inserted in and removed from the running kernel whenever you want). inserted in and removed from the running kernel whenever you want).
The module will be called usbnet. If you want to compile it as a The module will be called usbnet. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
comment "USB Host-to-Host Cables"
depends on USB_USBNET
config USB_AN2720
boolean "AnchorChips 2720 based cables (Xircom PGUNET, ...)"
depends on USB_USBNET
default y
help
Choose this option if you're using a host-to-host cable
based on this design. Note that AnchorChips is now a
Cypress brand.
config USB_BELKIN
boolean "eTEK based host-to-host cables (Advance, Belkin, ...)"
depends on USB_USBNET
default y
help
Choose this option if you're using a host-to-host cable
based on this design: two NetChip 2890 chips and an Atmel
microcontroller, with LEDs that indicate traffic.
config USB_GENESYS
boolean "GeneSys GL620USB-A based cables"
default y
depends on USB_USBNET
help
Choose this option if you're using a host-to-host cable,
or PC2PC motherboard, with this chip.
Note that the half-duplex "GL620USB" is not supported.
config USB_NET1080
boolean "NetChip 1080 based cables (Laplink, ...)"
default y
depends on USB_USBNET
help
Choose this option if you're using a host-to-host cable based
on this design: one NetChip 1080 chips and supporting logic,
supporting LEDs that indicate traffic
config USB_PL2301
boolean "Prolific PL-2301/2302 based cables"
default y
# handshake/init/reset problems, from original 'plusb' driver
depends on USB_USBNET && EXPERIMENTAL
help
Choose this option if you're using a host-to-host cable
with one of these chips.
comment "Intelligent USB Devices/Gadgets"
depends on USB_USBNET
config USB_ARMLINUX
boolean "Embedded ARM Linux links (iPaq, ...)"
depends on USB_USBNET
default y
help
Choose this option to support the "usb-eth" networking driver
used by most of the ARM Linux community with device controllers
such as the SA-11x0 and PXA-25x UDCs.
Although the ROMs shipped with Sharp Zaurus products use a
different link level framing protocol, you can have them use
this simpler protocol by installing a different kernel.
config USB_EPSON2888
boolean "Epson 2888 based firmware (DEVELOPMENT)"
depends on USB_USBNET
default y
help
Choose this option to support the usb networking links used
by some sample firmware from Epson.
config USB_ZAURUS
boolean "Sharp Zaurus (stock ROMs)"
depends on USB_USBNET
default y
help
Choose this option to support the usb networking links used by
Zaurus models like the SL-5000D, SL-5500, SL-5600, A-300, B-500.
If you install an alternate ROM image, you may no longer need
to support this protocol. Only the "eth-fd" driver really needs
this non-conformant variant of CDC Ethernet protocol.
config USB_CDCETHER
boolean "CDC Ethernet support (smart devices such as cable modems)"
# experimental primarily because cdc-ether was.
# make it non-experimental after more interop testing
depends on USB_USBNET && EXPERIMENTAL
default y
help
This option supports devices conforming to the Communication Device
Class (CDC) Ethernet Control Model, a specification that's easy to
implement in device firmware. The CDC specifications are available
from <http://www.usb.org/>.
CDC Ethernet is an implementation option for DOCSIS cable modems
that support USB connectivity, used for non-Microsoft USB hosts.
This driver should work with at least the following devices:
* Ericsson PipeRider (all variants)
* Motorola (DM100 and SB4100)
* Broadcom Cable Modem (reference design)
* Toshiba PCX1100U
* ...
This driver creates an interface named "ethX", where X depends on
what other networking devices you have in use. However, if the
IEEE 802 "local assignment" bit is set in the address, a "usbX"
name is used instead.
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# #
obj-$(CONFIG_USB_CATC) += catc.o obj-$(CONFIG_USB_CATC) += catc.o
obj-$(CONFIG_USB_CDCETHER) += cdc-ether.o
obj-$(CONFIG_USB_KAWETH) += kaweth.o obj-$(CONFIG_USB_KAWETH) += kaweth.o
obj-$(CONFIG_USB_PEGASUS) += pegasus.o obj-$(CONFIG_USB_PEGASUS) += pegasus.o
obj-$(CONFIG_USB_RTL8150) += rtl8150.o obj-$(CONFIG_USB_RTL8150) += rtl8150.o
......
...@@ -157,20 +157,7 @@ ...@@ -157,20 +157,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
/* minidrivers _could_ be individually configured */ #define DRIVER_VERSION "25-Apr-2003"
#define CONFIG_USB_AN2720
#define CONFIG_USB_BELKIN
#undef CONFIG_USB_CDCETHER
//#define CONFIG_USB_CDCETHER /* NYET */
#define CONFIG_USB_EPSON2888
#define CONFIG_USB_GENESYS
#define CONFIG_USB_NET1080
#define CONFIG_USB_PL2301
#define CONFIG_USB_ARMLINUX
#define CONFIG_USB_ZAURUS
#define DRIVER_VERSION "31-Mar-2003"
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -256,6 +243,7 @@ struct driver_info { ...@@ -256,6 +243,7 @@ struct driver_info {
#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */ #define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */
#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */ #define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
/* init device ... can sleep, or cause probe() failure */ /* init device ... can sleep, or cause probe() failure */
int (*bind)(struct usbnet *, struct usb_interface *); int (*bind)(struct usbnet *, struct usb_interface *);
...@@ -396,6 +384,7 @@ get_endpoints (struct usbnet *dev, struct usb_interface *intf) ...@@ -396,6 +384,7 @@ get_endpoints (struct usbnet *dev, struct usb_interface *intf)
#ifdef CONFIG_USB_AN2720 #ifdef CONFIG_USB_AN2720
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
...@@ -421,6 +410,7 @@ static const struct driver_info an2720_info = { ...@@ -421,6 +410,7 @@ static const struct driver_info an2720_info = {
#ifdef CONFIG_USB_BELKIN #ifdef CONFIG_USB_BELKIN
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
...@@ -447,7 +437,11 @@ static const struct driver_info belkin_info = { ...@@ -447,7 +437,11 @@ static const struct driver_info belkin_info = {
* Takes two interfaces. The DATA interface is inactive till an altsetting * Takes two interfaces. The DATA interface is inactive till an altsetting
* is selected. Configuration data includes class descriptors. * is selected. Configuration data includes class descriptors.
* *
* Zaurus uses nonstandard framing, but is otherwise CDC Ether. * Zaurus uses nonstandard framing, and doesn't uniquify its Ethernet
* addresses, but is otherwise CDC Ether.
*
* This should interop with whatever the 2.4 "CDCEther.c" driver
* (by Brad Hards) talked with.
* *
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
...@@ -589,9 +583,17 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf) ...@@ -589,9 +583,17 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf)
if (!info->header || !info ->u || !info->ether) if (!info->header || !info ->u || !info->ether)
goto bad_desc; goto bad_desc;
#ifdef CONFIG_USB_ZAURUS
/* Zaurus ethernet addresses aren't unique ... */
if ((dev->driver_info->flags & FLAG_FRAMING_Z) != 0)
/* ignore */ ;
else
#endif
{
status = get_ethernet_addr (dev, info->ether); status = get_ethernet_addr (dev, info->ether);
if (status < 0) if (status < 0)
return status; return status;
}
/* claim data interface and set it up ... with side effects. /* claim data interface and set it up ... with side effects.
* network traffic can't flow until an altsetting is enabled. * network traffic can't flow until an altsetting is enabled.
...@@ -609,8 +611,6 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf) ...@@ -609,8 +611,6 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf)
dev->net.mtu = cpu_to_le16p (&info->ether->wMaxSegmentSize) dev->net.mtu = cpu_to_le16p (&info->ether->wMaxSegmentSize)
- ETH_HLEN; - ETH_HLEN;
if ((dev->driver_info->flags & FLAG_FRAMING_Z) == 0)
strcpy (dev->net.name, "eth%d");
return 0; return 0;
bad_desc: bad_desc:
...@@ -640,9 +640,11 @@ static void cdc_unbind (struct usbnet *dev, struct usb_interface *intf) ...@@ -640,9 +640,11 @@ static void cdc_unbind (struct usbnet *dev, struct usb_interface *intf)
#ifdef CONFIG_USB_CDCETHER #ifdef CONFIG_USB_CDCETHER
#define HAVE_HARDWARE
static const struct driver_info cdc_info = { static const struct driver_info cdc_info = {
.description = "CDC Ethernet Device", .description = "CDC Ethernet Device",
.flags = FLAG_ETHER,
// .check_connect = cdc_check_connect, // .check_connect = cdc_check_connect,
.bind = cdc_bind, .bind = cdc_bind,
.unbind = cdc_unbind, .unbind = cdc_unbind,
...@@ -653,6 +655,7 @@ static const struct driver_info cdc_info = { ...@@ -653,6 +655,7 @@ static const struct driver_info cdc_info = {
#ifdef CONFIG_USB_EPSON2888 #ifdef CONFIG_USB_EPSON2888
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
...@@ -663,6 +666,8 @@ static const struct driver_info cdc_info = { ...@@ -663,6 +666,8 @@ static const struct driver_info cdc_info = {
* implements this interface. Product developers can reuse or modify that * implements this interface. Product developers can reuse or modify that
* code, such as by using their own product and vendor codes. * code, such as by using their own product and vendor codes.
* *
* Support was from Juro Bystricky <bystricky.juro@erd.epson.com>
*
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
static const struct driver_info epson2888_info = { static const struct driver_info epson2888_info = {
...@@ -676,6 +681,7 @@ static const struct driver_info epson2888_info = { ...@@ -676,6 +681,7 @@ static const struct driver_info epson2888_info = {
#ifdef CONFIG_USB_GENESYS #ifdef CONFIG_USB_GENESYS
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
...@@ -693,6 +699,9 @@ static const struct driver_info epson2888_info = { ...@@ -693,6 +699,9 @@ static const struct driver_info epson2888_info = {
* the transfer direction. (That's disabled here, partially coded.) * the transfer direction. (That's disabled here, partially coded.)
* A control URB would block until other side writes an interrupt. * A control URB would block until other side writes an interrupt.
* *
* Original code from Jiun-Jie Huang <huangjj@genesyslogic.com.tw>
* and merged into "usbnet" by Stanislav Brabec <utx@penguin.cz>.
*
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
// control msg write command // control msg write command
...@@ -1011,6 +1020,7 @@ static const struct driver_info genelink_info = { ...@@ -1011,6 +1020,7 @@ static const struct driver_info genelink_info = {
#ifdef CONFIG_USB_NET1080 #ifdef CONFIG_USB_NET1080
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
...@@ -1526,11 +1536,15 @@ static const struct driver_info net1080_info = { ...@@ -1526,11 +1536,15 @@ static const struct driver_info net1080_info = {
#ifdef CONFIG_USB_PL2301 #ifdef CONFIG_USB_PL2301
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* Prolific PL-2301/PL-2302 driver ... http://www.prolifictech.com * Prolific PL-2301/PL-2302 driver ... http://www.prolifictech.com
* *
* The protocol and handshaking used here should be bug-compatible
* with the Linux 2.2 "plusb" driver, by Deti Fliegl.
*
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
/* /*
...@@ -1590,6 +1604,7 @@ static const struct driver_info prolific_info = { ...@@ -1590,6 +1604,7 @@ static const struct driver_info prolific_info = {
#ifdef CONFIG_USB_ARMLINUX #ifdef CONFIG_USB_ARMLINUX
#define HAVE_HARDWARE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
...@@ -1622,6 +1637,7 @@ static const struct driver_info yopy_info = { ...@@ -1622,6 +1637,7 @@ static const struct driver_info yopy_info = {
#ifdef CONFIG_USB_ZAURUS #ifdef CONFIG_USB_ZAURUS
#define HAVE_HARDWARE
#include <linux/crc32.h> #include <linux/crc32.h>
...@@ -1736,7 +1752,9 @@ static struct net_device_stats *usbnet_get_stats (struct net_device *net) ...@@ -1736,7 +1752,9 @@ static struct net_device_stats *usbnet_get_stats (struct net_device *net)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* urb completions may be in_irq; avoid doing real work then. */ /* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from
* completion callbacks. 2.5 should have fixed those bugs...
*/
static void defer_bh (struct usbnet *dev, struct sk_buff *skb) static void defer_bh (struct usbnet *dev, struct sk_buff *skb)
{ {
...@@ -2502,6 +2520,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) ...@@ -2502,6 +2520,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
int status; int status;
info = (struct driver_info *) prod->driver_info; info = (struct driver_info *) prod->driver_info;
if (!info) {
dev_dbg (&udev->dev, "blacklisted by %s\n", driver_name);
return -ENODEV;
}
xdev = interface_to_usbdev (udev); xdev = interface_to_usbdev (udev);
interface = &udev->altsetting [udev->act_altsetting]; interface = &udev->altsetting [udev->act_altsetting];
...@@ -2553,9 +2575,15 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) ...@@ -2553,9 +2575,15 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
// allow device-specific bind/init procedures // allow device-specific bind/init procedures
// NOTE net->name still not usable ... // NOTE net->name still not usable ...
if (info->bind) if (info->bind) {
status = info->bind (dev, udev); status = info->bind (dev, udev);
else if (!info->in || info->out) // heuristic: "usb%d" for links we know are two-host,
// else "eth%d" when there's reasonable doubt. userspace
// can rename the link if it knows better.
if ((dev->driver_info->flags & FLAG_ETHER) != 0
&& (net->dev_addr [0] & 0x02) == 0)
strcpy (net->name, "eth%d");
} else if (!info->in || info->out)
status = get_endpoints (dev, udev); status = get_endpoints (dev, udev);
else { else {
dev->in = usb_rcvbulkpipe (xdev, info->in); dev->in = usb_rcvbulkpipe (xdev, info->in);
...@@ -2592,6 +2620,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) ...@@ -2592,6 +2620,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#ifndef HAVE_HARDWARE
#error You need to configure some hardware for this driver
#endif
/* /*
* chip vendor names won't normally be on the cables, and * chip vendor names won't normally be on the cables, and
* may not be on the device. * may not be on the device.
...@@ -2716,6 +2748,22 @@ static const struct usb_device_id products [] = { ...@@ -2716,6 +2748,22 @@ static const struct usb_device_id products [] = {
#endif #endif
#ifdef CONFIG_USB_CDCETHER #ifdef CONFIG_USB_CDCETHER
#ifndef CONFIG_USB_ZAURUS
/* if we couldn't whitelist Zaurus, we must blacklist it */
{
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD,
.idProduct = 0x8004,
/* match the master interface */
.bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0,
.driver_info = 0, /* BLACKLIST */
},
#endif
{ {
/* CDC Ether uses two interfaces, not necessarily consecutive. /* CDC Ether uses two interfaces, not necessarily consecutive.
* We match the main interface, ignoring the optional device * We match the main interface, ignoring the optional device
...@@ -2725,10 +2773,7 @@ static const struct usb_device_id products [] = { ...@@ -2725,10 +2773,7 @@ static const struct usb_device_id products [] = {
* NOTE: this match must come AFTER entries working around * NOTE: this match must come AFTER entries working around
* bugs/quirks in a given product (like Zaurus, above). * bugs/quirks in a given product (like Zaurus, above).
*/ */
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, USB_INTERFACE_INFO (USB_CLASS_COMM, 6 /* Ethernet model */, 0),
.bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = 6 /* Ethernet model */,
.bInterfaceProtocol = 0,
.driver_info = (unsigned long) &cdc_info, .driver_info = (unsigned long) &cdc_info,
}, },
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment