]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/gadget/u_ether.h
usb ethernet gadget: split RNDIS function
[linux-2.6-omap-h63xx.git] / drivers / usb / gadget / u_ether.h
index ca8ce467d8808e36d2120dce20150c36b8dc6d23..0d1f7ae3b0713877abc8c1f4d04b392ca1f0c2e9 100644 (file)
 #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
- * in different configurations could share the same ethernet link/netdev.
+ * in different configurations could share the same ethernet link/netdev,
+ * using different host interaction models.
  *
- * There is currently a limitation that one instance of this function
- * may be present in any given configuration.
+ * There is a current limitation that only one instance of this link may
+ * be present in any given configuration.  When that's a problem, network
+ * layer facilities can be used to package multiple logical links on this
+ * single "physical" one.
  */
 struct gether {
        struct usb_function             func;
@@ -80,4 +86,42 @@ 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]);
+
+#ifdef CONFIG_USB_ETH_RNDIS
+
+int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]);
+
+#else
+
+static inline int
+rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN])
+{
+       return 0;
+}
+
+#endif
+
 #endif /* __U_ETHER_H */