diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2008-06-19 18:19:46 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 15:16:13 -0700 |
commit | da741b8c56d612b5dd26ffa31341911a5fea23ee (patch) | |
tree | 201018abff24086e048a7dbf96ae07e60a82433e /drivers/usb/gadget/u_ether.h | |
parent | 8a40819e97368f2b6e67fea103348f9fc2f68ceb (diff) |
usb ethernet gadget: split CDC Ethernet function
This is a "CDC Ethernet" (ECM) function driver, extracted from the
all-in-one Ethernet gadget driver.
This is a good example of how to implement interface altsettings.
In fact it's currently the only such example in the gadget stack,
pending addition of OBEX support.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/u_ether.h')
-rw-r--r-- | drivers/usb/gadget/u_ether.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/gadget/u_ether.h b/drivers/usb/gadget/u_ether.h index 0ef823447f28..8abf197ab402 100644 --- a/drivers/usb/gadget/u_ether.h +++ b/drivers/usb/gadget/u_ether.h @@ -28,6 +28,9 @@ #include <linux/usb/composite.h> #include <linux/usb/cdc.h> +#include "gadget_chips.h" + + /* * This represents the USB side of an "ethernet" link, managed by a USB * function which provides control and (maybe) framing. Two functions @@ -80,7 +83,28 @@ void gether_cleanup(void); struct net_device *gether_connect(struct gether *); void gether_disconnect(struct gether *); +/* Some controllers can't support CDC Ethernet (ECM) ... */ +static inline bool can_support_ecm(struct usb_gadget *gadget) +{ + if (!gadget_supports_altsettings(gadget)) + return false; + + /* SA1100 can do ECM, *without* status endpoint ... but we'll + * only use it in non-ECM mode for backwards compatibility + * (and since we currently require a status endpoint) + */ + if (gadget_is_sa1100(gadget)) + return false; + + /* Everything else is *presumably* fine ... but this is a bit + * chancy, so be **CERTAIN** there are no hardware issues with + * your controller. Add it above if it can't handle CDC. + */ + return true; +} + /* each configuration may bind one instance of an ethernet link */ int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); +int ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); #endif /* __U_ETHER_H */ |