aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_ether.h
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-06-19 21:19:46 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:16:13 -0400
commitda741b8c56d612b5dd26ffa31341911a5fea23ee (patch)
tree201018abff24086e048a7dbf96ae07e60a82433e /drivers/usb/gadget/u_ether.h
parent8a40819e97368f2b6e67fea103348f9fc2f68ceb (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.h24
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 @@
28#include <linux/usb/composite.h> 28#include <linux/usb/composite.h>
29#include <linux/usb/cdc.h> 29#include <linux/usb/cdc.h>
30 30
31#include "gadget_chips.h"
32
33
31/* 34/*
32 * This represents the USB side of an "ethernet" link, managed by a USB 35 * This represents the USB side of an "ethernet" link, managed by a USB
33 * function which provides control and (maybe) framing. Two functions 36 * function which provides control and (maybe) framing. Two functions
@@ -80,7 +83,28 @@ void gether_cleanup(void);
80struct net_device *gether_connect(struct gether *); 83struct net_device *gether_connect(struct gether *);
81void gether_disconnect(struct gether *); 84void gether_disconnect(struct gether *);
82 85
86/* Some controllers can't support CDC Ethernet (ECM) ... */
87static inline bool can_support_ecm(struct usb_gadget *gadget)
88{
89 if (!gadget_supports_altsettings(gadget))
90 return false;
91
92 /* SA1100 can do ECM, *without* status endpoint ... but we'll
93 * only use it in non-ECM mode for backwards compatibility
94 * (and since we currently require a status endpoint)
95 */
96 if (gadget_is_sa1100(gadget))
97 return false;
98
99 /* Everything else is *presumably* fine ... but this is a bit
100 * chancy, so be **CERTAIN** there are no hardware issues with
101 * your controller. Add it above if it can't handle CDC.
102 */
103 return true;
104}
105
83/* each configuration may bind one instance of an ethernet link */ 106/* each configuration may bind one instance of an ethernet link */
84int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); 107int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
108int ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
85 109
86#endif /* __U_ETHER_H */ 110#endif /* __U_ETHER_H */