aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ether.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:25:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:25:16 -0400
commitbe90a49ca22a95f184d9f32d35b5247b44032849 (patch)
treed3c2edc18c003c384366f57901616ac29c80bc27 /drivers/usb/gadget/ether.c
parent1f0918d03ff4b5c94540c71ce889672abdbc2f4a (diff)
parenta87371b477774b290c27bc5cb7f4ccc5379574a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (142 commits) USB: Fix sysfs paths in documentation USB: skeleton: fix coding style issues. USB: O_NONBLOCK in read path of skeleton USB: make usb-skeleton honor O_NONBLOCK in write path USB: skel_read really sucks royally USB: Add hub descriptor update hook for xHCI USB: xhci: Support USB hubs. USB: xhci: Set multi-TT field for LS/FS devices under hubs. USB: xhci: Set route string for all devices. USB: xhci: Fix command wait list handling. USB: xhci: Change how xHCI commands are handled. USB: xhci: Refactor input device context setup. USB: xhci: Endpoint representation refactoring. USB: gadget: ether needs to select CRC32 USB: fix USBTMC get_capabilities success handling USB: fix missing error check in probing USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag USB: support for autosuspend in sierra while online USB: ehci-dbgp,ehci: Allow dbpg to work with suspend/resume USB: ehci-dbgp,documentation: Documentation updates for ehci-dbgp ...
Diffstat (limited to 'drivers/usb/gadget/ether.c')
-rw-r--r--drivers/usb/gadget/ether.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index bd102f5052ba..f37de283d0ab 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -61,6 +61,11 @@
61 * simpler, Microsoft pushes their own approach: RNDIS. The published 61 * simpler, Microsoft pushes their own approach: RNDIS. The published
62 * RNDIS specs are ambiguous and appear to be incomplete, and are also 62 * RNDIS specs are ambiguous and appear to be incomplete, and are also
63 * needlessly complex. They borrow more from CDC ACM than CDC ECM. 63 * needlessly complex. They borrow more from CDC ACM than CDC ECM.
64 *
65 * While CDC ECM, CDC Subset, and RNDIS are designed to extend the ethernet
66 * interface to the target, CDC EEM was designed to use ethernet over the USB
67 * link between the host and target. CDC EEM is implemented as an alternative
68 * to those other protocols when that communication model is more appropriate
64 */ 69 */
65 70
66#define DRIVER_DESC "Ethernet Gadget" 71#define DRIVER_DESC "Ethernet Gadget"
@@ -114,6 +119,7 @@ static inline bool has_rndis(void)
114#include "f_rndis.c" 119#include "f_rndis.c"
115#include "rndis.c" 120#include "rndis.c"
116#endif 121#endif
122#include "f_eem.c"
117#include "u_ether.c" 123#include "u_ether.c"
118 124
119/*-------------------------------------------------------------------------*/ 125/*-------------------------------------------------------------------------*/
@@ -150,6 +156,10 @@ static inline bool has_rndis(void)
150#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */ 156#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */
151#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */ 157#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
152 158
159/* For EEM gadgets */
160#define EEM_VENDOR_NUM 0x0525 /* INVALID - NEEDS TO BE ALLOCATED */
161#define EEM_PRODUCT_NUM 0xa4a1 /* INVALID - NEEDS TO BE ALLOCATED */
162
153/*-------------------------------------------------------------------------*/ 163/*-------------------------------------------------------------------------*/
154 164
155static struct usb_device_descriptor device_desc = { 165static struct usb_device_descriptor device_desc = {
@@ -246,8 +256,16 @@ static struct usb_configuration rndis_config_driver = {
246 256
247/*-------------------------------------------------------------------------*/ 257/*-------------------------------------------------------------------------*/
248 258
259#ifdef CONFIG_USB_ETH_EEM
260static int use_eem = 1;
261#else
262static int use_eem;
263#endif
264module_param(use_eem, bool, 0);
265MODULE_PARM_DESC(use_eem, "use CDC EEM mode");
266
249/* 267/*
250 * We _always_ have an ECM or CDC Subset configuration. 268 * We _always_ have an ECM, CDC Subset, or EEM configuration.
251 */ 269 */
252static int __init eth_do_config(struct usb_configuration *c) 270static int __init eth_do_config(struct usb_configuration *c)
253{ 271{
@@ -258,7 +276,9 @@ static int __init eth_do_config(struct usb_configuration *c)
258 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; 276 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
259 } 277 }
260 278
261 if (can_support_ecm(c->cdev->gadget)) 279 if (use_eem)
280 return eem_bind_config(c);
281 else if (can_support_ecm(c->cdev->gadget))
262 return ecm_bind_config(c, hostaddr); 282 return ecm_bind_config(c, hostaddr);
263 else 283 else
264 return geth_bind_config(c, hostaddr); 284 return geth_bind_config(c, hostaddr);
@@ -286,7 +306,12 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
286 return status; 306 return status;
287 307
288 /* set up main config label and device descriptor */ 308 /* set up main config label and device descriptor */
289 if (can_support_ecm(cdev->gadget)) { 309 if (use_eem) {
310 /* EEM */
311 eth_config_driver.label = "CDC Ethernet (EEM)";
312 device_desc.idVendor = cpu_to_le16(EEM_VENDOR_NUM);
313 device_desc.idProduct = cpu_to_le16(EEM_PRODUCT_NUM);
314 } else if (can_support_ecm(cdev->gadget)) {
290 /* ECM */ 315 /* ECM */
291 eth_config_driver.label = "CDC Ethernet (ECM)"; 316 eth_config_driver.label = "CDC Ethernet (ECM)";
292 } else { 317 } else {