blob: 75418c7050fb97e28306672e1304ed5b30822720 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * ether.c -- Ethernet gadget driver, with CDC and non-CDC options
3 *
David Brownell0391c822008-06-19 18:20:11 -07004 * Copyright (C) 2003-2005,2008 David Brownell
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger
David Brownell0391c822008-06-19 18:20:11 -07006 * Copyright (C) 2008 Nokia Corporation
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 */
13
David Brownell0cf4f2d2007-08-02 00:00:38 -070014/* #define VERBOSE_DEBUG */
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/kernel.h>
Michal Nazarewicz396cda92009-11-30 10:55:40 +010017
18#if defined USB_ETH_RNDIS
19# undef USB_ETH_RNDIS
20#endif
21#ifdef CONFIG_USB_ETH_RNDIS
22# define USB_ETH_RNDIS y
23#endif
24
David Brownell0391c822008-06-19 18:20:11 -070025#include "u_ether.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28/*
29 * Ethernet gadget driver -- with CDC and non-CDC options
30 * Builds on hardware support for a full duplex link.
31 *
32 * CDC Ethernet is the standard USB solution for sending Ethernet frames
33 * using USB. Real hardware tends to use the same framing protocol but look
34 * different for control features. This driver strongly prefers to use
35 * this USB-IF standard as its open-systems interoperability solution;
36 * most host side USB stacks (except from Microsoft) support it.
37 *
David Brownell0391c822008-06-19 18:20:11 -070038 * This is sometimes called "CDC ECM" (Ethernet Control Model) to support
39 * TLA-soup. "CDC ACM" (Abstract Control Model) is for modems, and a new
40 * "CDC EEM" (Ethernet Emulation Model) is starting to spread.
41 *
42 * There's some hardware that can't talk CDC ECM. We make that hardware
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 * implement a "minimalist" vendor-agnostic CDC core: same framing, but
David Brownell11d54892006-12-11 15:59:04 -080044 * link-level setup only requires activating the configuration. Only the
45 * endpoint descriptors, and product/vendor IDs, are relevant; no control
46 * operations are available. Linux supports it, but other host operating
47 * systems may not. (This is a subset of CDC Ethernet.)
48 *
49 * It turns out that if you add a few descriptors to that "CDC Subset",
50 * (Windows) host side drivers from MCCI can treat it as one submode of
51 * a proprietary scheme called "SAFE" ... without needing to know about
52 * specific product/vendor IDs. So we do that, making it easier to use
53 * those MS-Windows drivers. Those added descriptors make it resemble a
54 * CDC MDLM device, but they don't change device behavior at all. (See
55 * MCCI Engineering report 950198 "SAFE Networking Functions".)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 *
57 * A third option is also in use. Rather than CDC Ethernet, or something
58 * simpler, Microsoft pushes their own approach: RNDIS. The published
59 * RNDIS specs are ambiguous and appear to be incomplete, and are also
David Brownell0391c822008-06-19 18:20:11 -070060 * needlessly complex. They borrow more from CDC ACM than CDC ECM.
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 */
62
63#define DRIVER_DESC "Ethernet Gadget"
David Brownell0391c822008-06-19 18:20:11 -070064#define DRIVER_VERSION "Memorial Day 2008"
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
Michal Nazarewicz396cda92009-11-30 10:55:40 +010066#ifdef USB_ETH_RNDIS
David Brownell0391c822008-06-19 18:20:11 -070067#define PREFIX "RNDIS/"
68#else
69#define PREFIX ""
Linus Torvalds1da177e2005-04-16 15:20:36 -070070#endif
71
David Brownell0391c822008-06-19 18:20:11 -070072/*
73 * This driver aims for interoperability by using CDC ECM unless
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 *
David Brownell0391c822008-06-19 18:20:11 -070075 * can_support_ecm()
76 *
77 * returns false, in which case it supports the CDC Subset. By default,
78 * that returns true; most hardware has no problems with CDC ECM, that's
79 * a good default. Previous versions of this driver had no default; this
80 * version changes that, removing overhead for new controller support.
81 *
82 * IF YOUR HARDWARE CAN'T SUPPORT CDC ECM, UPDATE THAT ROUTINE!
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
David Brownell0391c822008-06-19 18:20:11 -070085static inline bool has_rndis(void)
86{
Michal Nazarewicz396cda92009-11-30 10:55:40 +010087#ifdef USB_ETH_RNDIS
David Brownell0391c822008-06-19 18:20:11 -070088 return true;
89#else
90 return false;
91#endif
92}
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094/*-------------------------------------------------------------------------*/
95
David Brownell33376c12008-08-18 17:45:07 -070096/*
97 * Kbuild is not very cooperative with respect to linking separately
98 * compiled library objects into one module. So for now we won't use
99 * separate compilation ... ensuring init/exit sections work to shrink
100 * the runtime footprint, and giving us at least some parts of what
101 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
102 */
David Brownell33376c12008-08-18 17:45:07 -0700103#include "f_ecm.c"
104#include "f_subset.c"
Michal Nazarewicz396cda92009-11-30 10:55:40 +0100105#ifdef USB_ETH_RNDIS
David Brownell33376c12008-08-18 17:45:07 -0700106#include "f_rndis.c"
107#include "rndis.c"
108#endif
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500109#include "f_eem.c"
David Brownell33376c12008-08-18 17:45:07 -0700110
111/*-------------------------------------------------------------------------*/
Sebastian Andrzej Siewior7d16e8d2012-09-10 15:01:53 +0200112USB_GADGET_COMPOSITE_OPTIONS();
David Brownell33376c12008-08-18 17:45:07 -0700113
Andrzej Pietrasiewiczf1a18232013-05-23 09:22:03 +0200114USB_ETHERNET_MODULE_PARAMETERS();
115
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
117 * Instead: allocate your own, using normal USB-IF procedures.
118 */
119
120/* Thanks to NetChip Technologies for donating this product ID.
121 * It's for devices with only CDC Ethernet configurations.
122 */
David Brownell0391c822008-06-19 18:20:11 -0700123#define CDC_VENDOR_NUM 0x0525 /* NetChip */
124#define CDC_PRODUCT_NUM 0xa4a1 /* Linux-USB Ethernet Gadget */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
126/* For hardware that can't talk CDC, we use the same vendor ID that
127 * ARM Linux has used for ethernet-over-usb, both with sa1100 and
128 * with pxa250. We're protocol-compatible, if the host-side drivers
129 * use the endpoint descriptors. bcdDevice (version) is nonzero, so
130 * drivers that need to hard-wire endpoint numbers have a hook.
131 *
132 * The protocol is a minimal subset of CDC Ether, which works on any bulk
133 * hardware that's not deeply broken ... even on hardware that can't talk
134 * RNDIS (like SA-1100, with no interrupt endpoint, or anything that
135 * doesn't handle control-OUT).
136 */
137#define SIMPLE_VENDOR_NUM 0x049f
138#define SIMPLE_PRODUCT_NUM 0x505a
139
140/* For hardware that can talk RNDIS and either of the above protocols,
141 * use this ID ... the windows INF files will know it. Unless it's
142 * used with CDC Ethernet, Linux 2.4 hosts will need updates to choose
143 * the non-RNDIS configuration.
144 */
145#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */
146#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
147
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500148/* For EEM gadgets */
Brian Niebuhr4238ef52009-10-14 12:04:33 -0500149#define EEM_VENDOR_NUM 0x1d6b /* Linux Foundation */
150#define EEM_PRODUCT_NUM 0x0102 /* EEM Gadget */
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500151
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152/*-------------------------------------------------------------------------*/
153
David Brownell0391c822008-06-19 18:20:11 -0700154static struct usb_device_descriptor device_desc = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 .bLength = sizeof device_desc,
156 .bDescriptorType = USB_DT_DEVICE,
157
Harvey Harrison551509d2009-02-11 14:11:36 -0800158 .bcdUSB = cpu_to_le16 (0x0200),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
160 .bDeviceClass = USB_CLASS_COMM,
161 .bDeviceSubClass = 0,
162 .bDeviceProtocol = 0,
David Brownell0391c822008-06-19 18:20:11 -0700163 /* .bMaxPacketSize0 = f(hardware) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
David Brownell0391c822008-06-19 18:20:11 -0700165 /* Vendor and product id defaults change according to what configs
166 * we support. (As does bNumConfigurations.) These values can
167 * also be overridden by module parameters.
168 */
Harvey Harrison551509d2009-02-11 14:11:36 -0800169 .idVendor = cpu_to_le16 (CDC_VENDOR_NUM),
170 .idProduct = cpu_to_le16 (CDC_PRODUCT_NUM),
David Brownell0391c822008-06-19 18:20:11 -0700171 /* .bcdDevice = f(hardware) */
172 /* .iManufacturer = DYNAMIC */
173 /* .iProduct = DYNAMIC */
174 /* NO SERIAL NUMBER */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 .bNumConfigurations = 1,
176};
177
David Brownell0391c822008-06-19 18:20:11 -0700178static struct usb_otg_descriptor otg_descriptor = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 .bLength = sizeof otg_descriptor,
180 .bDescriptorType = USB_DT_OTG,
181
David Brownell0391c822008-06-19 18:20:11 -0700182 /* REVISIT SRP-only hardware is possible, although
183 * it would not be called "OTG" ...
184 */
185 .bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186};
187
David Brownell0391c822008-06-19 18:20:11 -0700188static const struct usb_descriptor_header *otg_desc[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 (struct usb_descriptor_header *) &otg_descriptor,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 NULL,
191};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
David Brownell0391c822008-06-19 18:20:11 -0700193static struct usb_string strings_dev[] = {
Sebastian Andrzej Siewiorcc2683c2012-09-10 15:01:58 +0200194 [USB_GADGET_MANUFACTURER_IDX].s = "",
Sebastian Andrzej Siewior276e2e42012-09-06 20:11:21 +0200195 [USB_GADGET_PRODUCT_IDX].s = PREFIX DRIVER_DESC,
196 [USB_GADGET_SERIAL_IDX].s = "",
David Brownell0391c822008-06-19 18:20:11 -0700197 { } /* end of list */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198};
199
David Brownell0391c822008-06-19 18:20:11 -0700200static struct usb_gadget_strings stringtab_dev = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 .language = 0x0409, /* en-us */
David Brownell0391c822008-06-19 18:20:11 -0700202 .strings = strings_dev,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203};
204
David Brownell0391c822008-06-19 18:20:11 -0700205static struct usb_gadget_strings *dev_strings[] = {
206 &stringtab_dev,
207 NULL,
208};
209
Andrzej Pietrasiewiczf1a18232013-05-23 09:22:03 +0200210static u8 host_mac[ETH_ALEN];
Sebastian Andrzej Siewiord6a01432012-12-23 21:10:12 +0100211static struct eth_dev *the_dev;
David Brownell0391c822008-06-19 18:20:11 -0700212/*-------------------------------------------------------------------------*/
213
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214/*
David Brownell0391c822008-06-19 18:20:11 -0700215 * We may not have an RNDIS configuration, but if we do it needs to be
216 * the first one present. That's to make Microsoft's drivers happy,
217 * and to follow DOCSIS 1.0 (cable modem standard).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 */
Michal Nazarewicze12995e2010-08-12 17:43:52 +0200219static int __init rndis_do_config(struct usb_configuration *c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220{
David Brownell0391c822008-06-19 18:20:11 -0700221 /* FIXME alloc iConfiguration string, set it in c->strings */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222
David Brownell0391c822008-06-19 18:20:11 -0700223 if (gadget_is_otg(c->cdev->gadget)) {
224 c->descriptors = otg_desc;
225 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 }
227
Andrzej Pietrasiewiczf1a18232013-05-23 09:22:03 +0200228 return rndis_bind_config(c, host_mac, the_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229}
230
David Brownell0391c822008-06-19 18:20:11 -0700231static struct usb_configuration rndis_config_driver = {
232 .label = "RNDIS",
David Brownell0391c822008-06-19 18:20:11 -0700233 .bConfigurationValue = 2,
234 /* .iConfiguration = DYNAMIC */
235 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
David Brownell0391c822008-06-19 18:20:11 -0700236};
237
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238/*-------------------------------------------------------------------------*/
239
Robert P. J. Dayc9188ad2009-12-28 06:31:08 -0500240#ifdef CONFIG_USB_ETH_EEM
Rusty Russell90ab5ee2012-01-13 09:32:20 +1030241static bool use_eem = 1;
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500242#else
Rusty Russell90ab5ee2012-01-13 09:32:20 +1030243static bool use_eem;
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500244#endif
245module_param(use_eem, bool, 0);
246MODULE_PARM_DESC(use_eem, "use CDC EEM mode");
247
David Brownell0391c822008-06-19 18:20:11 -0700248/*
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500249 * We _always_ have an ECM, CDC Subset, or EEM configuration.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 */
Michal Nazarewicze12995e2010-08-12 17:43:52 +0200251static int __init eth_do_config(struct usb_configuration *c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252{
David Brownell0391c822008-06-19 18:20:11 -0700253 /* FIXME alloc iConfiguration string, set it in c->strings */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254
David Brownell0391c822008-06-19 18:20:11 -0700255 if (gadget_is_otg(c->cdev->gadget)) {
256 c->descriptors = otg_desc;
257 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 }
259
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500260 if (use_eem)
Sebastian Andrzej Siewiord6a01432012-12-23 21:10:12 +0100261 return eem_bind_config(c, the_dev);
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500262 else if (can_support_ecm(c->cdev->gadget))
Andrzej Pietrasiewiczf1a18232013-05-23 09:22:03 +0200263 return ecm_bind_config(c, host_mac, the_dev);
David Brownell0391c822008-06-19 18:20:11 -0700264 else
Andrzej Pietrasiewiczf1a18232013-05-23 09:22:03 +0200265 return geth_bind_config(c, host_mac, the_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266}
267
David Brownell0391c822008-06-19 18:20:11 -0700268static struct usb_configuration eth_config_driver = {
269 /* .label = f(hardware) */
David Brownell0391c822008-06-19 18:20:11 -0700270 .bConfigurationValue = 1,
271 /* .iConfiguration = DYNAMIC */
272 .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
David Brownell0391c822008-06-19 18:20:11 -0700273};
274
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275/*-------------------------------------------------------------------------*/
276
Michal Nazarewicze12995e2010-08-12 17:43:52 +0200277static int __init eth_bind(struct usb_composite_dev *cdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278{
David Brownell0391c822008-06-19 18:20:11 -0700279 struct usb_gadget *gadget = cdev->gadget;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 int status;
David Brownell7e27f182006-06-13 09:54:40 -0700281
David Brownell0391c822008-06-19 18:20:11 -0700282 /* set up network link layer */
Andrzej Pietrasiewiczf1a18232013-05-23 09:22:03 +0200283 the_dev = gether_setup(cdev->gadget, dev_addr, host_addr, host_mac,
284 qmult);
Sebastian Andrzej Siewiord6a01432012-12-23 21:10:12 +0100285 if (IS_ERR(the_dev))
286 return PTR_ERR(the_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287
David Brownell0391c822008-06-19 18:20:11 -0700288 /* set up main config label and device descriptor */
Brian Niebuhr9b39e9d2009-08-14 10:04:22 -0500289 if (use_eem) {
290 /* EEM */
291 eth_config_driver.label = "CDC Ethernet (EEM)";
292 device_desc.idVendor = cpu_to_le16(EEM_VENDOR_NUM);
293 device_desc.idProduct = cpu_to_le16(EEM_PRODUCT_NUM);
294 } else if (can_support_ecm(cdev->gadget)) {
David Brownell0391c822008-06-19 18:20:11 -0700295 /* ECM */
296 eth_config_driver.label = "CDC Ethernet (ECM)";
297 } else {
298 /* CDC Subset */
299 eth_config_driver.label = "CDC Subset/SAFE";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300
David Brownell4e19f222009-06-19 03:09:04 -0700301 device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM);
302 device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM);
303 if (!has_rndis())
304 device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 }
306
David Brownell0391c822008-06-19 18:20:11 -0700307 if (has_rndis()) {
308 /* RNDIS plus ECM-or-Subset */
David Brownell4e19f222009-06-19 03:09:04 -0700309 device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM);
310 device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM);
David Brownell0391c822008-06-19 18:20:11 -0700311 device_desc.bNumConfigurations = 2;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 }
313
David Brownell0391c822008-06-19 18:20:11 -0700314 /* Allocate string descriptor numbers ... note that string
315 * contents can be overridden by the composite_dev glue.
316 */
317
Sebastian Andrzej Siewiore1f15cc2012-09-06 20:11:16 +0200318 status = usb_string_ids_tab(cdev, strings_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 if (status < 0)
David Brownell0391c822008-06-19 18:20:11 -0700320 goto fail;
Sebastian Andrzej Siewior276e2e42012-09-06 20:11:21 +0200321 device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
322 device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323
David Brownell0391c822008-06-19 18:20:11 -0700324 /* register our configuration(s); RNDIS first, if it's used */
325 if (has_rndis()) {
Uwe Kleine-Königc9bfff92010-08-12 17:43:55 +0200326 status = usb_add_config(cdev, &rndis_config_driver,
327 rndis_do_config);
David Brownell0391c822008-06-19 18:20:11 -0700328 if (status < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 goto fail;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331
Uwe Kleine-Königc9bfff92010-08-12 17:43:55 +0200332 status = usb_add_config(cdev, &eth_config_driver, eth_do_config);
David Brownell0391c822008-06-19 18:20:11 -0700333 if (status < 0)
334 goto fail;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335
Sebastian Andrzej Siewior7d16e8d2012-09-10 15:01:53 +0200336 usb_composite_overwrite_options(cdev, &coverwrite);
David Brownell33376c12008-08-18 17:45:07 -0700337 dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n",
338 DRIVER_DESC);
David Brownell0391c822008-06-19 18:20:11 -0700339
340 return 0;
341
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342fail:
Sebastian Andrzej Siewiord6a01432012-12-23 21:10:12 +0100343 gether_cleanup(the_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 return status;
345}
346
David Brownell0391c822008-06-19 18:20:11 -0700347static int __exit eth_unbind(struct usb_composite_dev *cdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348{
Sebastian Andrzej Siewiord6a01432012-12-23 21:10:12 +0100349 gether_cleanup(the_dev);
David Brownell0391c822008-06-19 18:20:11 -0700350 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351}
352
Sebastian Andrzej Siewiorc2ec75c2012-09-06 20:11:03 +0200353static __refdata struct usb_composite_driver eth_driver = {
David Brownell0391c822008-06-19 18:20:11 -0700354 .name = "g_ether",
355 .dev = &device_desc,
356 .strings = dev_strings,
Paul Zimmerman04617db2011-06-27 14:13:18 -0700357 .max_speed = USB_SPEED_SUPER,
Sebastian Andrzej Siewior03e42bd2012-09-06 20:11:04 +0200358 .bind = eth_bind,
David Brownell0391c822008-06-19 18:20:11 -0700359 .unbind = __exit_p(eth_unbind),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360};
361
David Brownell0391c822008-06-19 18:20:11 -0700362MODULE_DESCRIPTION(PREFIX DRIVER_DESC);
363MODULE_AUTHOR("David Brownell, Benedikt Spanger");
364MODULE_LICENSE("GPL");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365
David Brownell0391c822008-06-19 18:20:11 -0700366static int __init init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367{
Sebastian Andrzej Siewior03e42bd2012-09-06 20:11:04 +0200368 return usb_composite_probe(&eth_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369}
David Brownell0391c822008-06-19 18:20:11 -0700370module_init(init);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371
David Brownell0391c822008-06-19 18:20:11 -0700372static void __exit cleanup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373{
David Brownell0391c822008-06-19 18:20:11 -0700374 usb_composite_unregister(&eth_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375}
David Brownell0391c822008-06-19 18:20:11 -0700376module_exit(cleanup);