blob: 3547cf13d219c07ca56e7468ac2905b830c4959e [file] [log] [blame]
David Brownell4324fd42005-08-31 09:54:20 -07001/*
2 * CDC Ethernet based networking peripherals
3 * Copyright (C) 2003-2005 by David Brownell
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -08004 * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
David Brownell4324fd42005-08-31 09:54:20 -07005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// #define DEBUG // error path messages, extra info
22// #define VERBOSE // more; success messages
23
David Brownell4324fd42005-08-31 09:54:20 -070024#include <linux/module.h>
David Brownell4324fd42005-08-31 09:54:20 -070025#include <linux/init.h>
26#include <linux/netdevice.h>
27#include <linux/etherdevice.h>
David Brownell4324fd42005-08-31 09:54:20 -070028#include <linux/ethtool.h>
29#include <linux/workqueue.h>
30#include <linux/mii.h>
31#include <linux/usb.h>
David Brownella8c28f22006-06-13 09:57:47 -070032#include <linux/usb/cdc.h>
Jussi Kivilinna3692e942008-01-26 00:51:45 +020033#include <linux/usb/usbnet.h>
David Brownell4324fd42005-08-31 09:54:20 -070034
35
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -080036#if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
37
38static int is_rndis(struct usb_interface_descriptor *desc)
39{
Joe Perches8e95a202009-12-03 07:58:21 +000040 return (desc->bInterfaceClass == USB_CLASS_COMM &&
41 desc->bInterfaceSubClass == 2 &&
42 desc->bInterfaceProtocol == 0xff);
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -080043}
44
45static int is_activesync(struct usb_interface_descriptor *desc)
46{
Joe Perches8e95a202009-12-03 07:58:21 +000047 return (desc->bInterfaceClass == USB_CLASS_MISC &&
48 desc->bInterfaceSubClass == 1 &&
49 desc->bInterfaceProtocol == 1);
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -080050}
51
Thomas Backlund7e99eed2008-07-22 13:55:58 -070052static int is_wireless_rndis(struct usb_interface_descriptor *desc)
53{
Joe Perches8e95a202009-12-03 07:58:21 +000054 return (desc->bInterfaceClass == USB_CLASS_WIRELESS_CONTROLLER &&
55 desc->bInterfaceSubClass == 1 &&
56 desc->bInterfaceProtocol == 3);
Thomas Backlund7e99eed2008-07-22 13:55:58 -070057}
58
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -080059#else
60
61#define is_rndis(desc) 0
62#define is_activesync(desc) 0
Thomas Backlund7e99eed2008-07-22 13:55:58 -070063#define is_wireless_rndis(desc) 0
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -080064
65#endif
66
David Brownell4324fd42005-08-31 09:54:20 -070067/*
68 * probes control interface, claims data interface, collects the bulk
69 * endpoints, activates data interface (if needed), maybe sets MTU.
70 * all pure cdc, except for certain firmware workarounds, and knowing
71 * that rndis uses one different rule.
72 */
73int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
74{
75 u8 *buf = intf->cur_altsetting->extra;
76 int len = intf->cur_altsetting->extralen;
77 struct usb_interface_descriptor *d;
78 struct cdc_state *info = (void *) &dev->data;
79 int status;
80 int rndis;
81 struct usb_driver *driver = driver_of(intf);
82
83 if (sizeof dev->data < sizeof *info)
84 return -EDOM;
85
86 /* expect strict spec conformance for the descriptors, but
87 * cope with firmware which stores them in the wrong place
88 */
89 if (len == 0 && dev->udev->actconfig->extralen) {
90 /* Motorola SB4100 (and others: Brad Hards says it's
91 * from a Broadcom design) put CDC descriptors here
92 */
93 buf = dev->udev->actconfig->extra;
94 len = dev->udev->actconfig->extralen;
95 if (len)
96 dev_dbg(&intf->dev,
97 "CDC descriptors on config\n");
98 }
99
David Brownell4149b722007-04-29 10:09:47 -0700100 /* Maybe CDC descriptors are after the endpoint? This bug has
101 * been seen on some 2Wire Inc RNDIS-ish products.
102 */
103 if (len == 0) {
104 struct usb_host_endpoint *hep;
105
106 hep = intf->cur_altsetting->endpoint;
107 if (hep) {
108 buf = hep->extra;
109 len = hep->extralen;
110 }
111 if (len)
112 dev_dbg(&intf->dev,
113 "CDC descriptors on endpoint\n");
114 }
115
David Brownell4324fd42005-08-31 09:54:20 -0700116 /* this assumes that if there's a non-RNDIS vendor variant
117 * of cdc-acm, it'll fail RNDIS requests cleanly.
118 */
Joe Perches8e95a202009-12-03 07:58:21 +0000119 rndis = (is_rndis(&intf->cur_altsetting->desc) ||
120 is_activesync(&intf->cur_altsetting->desc) ||
121 is_wireless_rndis(&intf->cur_altsetting->desc));
David Brownell4324fd42005-08-31 09:54:20 -0700122
123 memset(info, 0, sizeof *info);
124 info->control = intf;
125 while (len > 3) {
126 if (buf [1] != USB_DT_CS_INTERFACE)
127 goto next_desc;
128
129 /* use bDescriptorSubType to identify the CDC descriptors.
130 * We expect devices with CDC header and union descriptors.
131 * For CDC Ethernet we need the ethernet descriptor.
132 * For RNDIS, ignore two (pointless) CDC modem descriptors
133 * in favor of a complicated OID-based RPC scheme doing what
134 * CDC Ethernet achieves with a simple descriptor.
135 */
136 switch (buf [2]) {
137 case USB_CDC_HEADER_TYPE:
138 if (info->header) {
139 dev_dbg(&intf->dev, "extra CDC header\n");
140 goto bad_desc;
141 }
142 info->header = (void *) buf;
143 if (info->header->bLength != sizeof *info->header) {
144 dev_dbg(&intf->dev, "CDC header len %u\n",
145 info->header->bLength);
146 goto bad_desc;
147 }
148 break;
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800149 case USB_CDC_ACM_TYPE:
150 /* paranoia: disambiguate a "real" vendor-specific
151 * modem interface from an RNDIS non-modem.
152 */
153 if (rndis) {
David Brownellafaee822007-07-01 11:47:59 -0700154 struct usb_cdc_acm_descriptor *acm;
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800155
David Brownellafaee822007-07-01 11:47:59 -0700156 acm = (void *) buf;
157 if (acm->bmCapabilities) {
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800158 dev_dbg(&intf->dev,
159 "ACM capabilities %02x, "
160 "not really RNDIS?\n",
David Brownellafaee822007-07-01 11:47:59 -0700161 acm->bmCapabilities);
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800162 goto bad_desc;
163 }
164 }
165 break;
David Brownell4324fd42005-08-31 09:54:20 -0700166 case USB_CDC_UNION_TYPE:
167 if (info->u) {
168 dev_dbg(&intf->dev, "extra CDC union\n");
169 goto bad_desc;
170 }
171 info->u = (void *) buf;
172 if (info->u->bLength != sizeof *info->u) {
173 dev_dbg(&intf->dev, "CDC union len %u\n",
174 info->u->bLength);
175 goto bad_desc;
176 }
177
178 /* we need a master/control interface (what we're
179 * probed with) and a slave/data interface; union
180 * descriptors sort this all out.
181 */
182 info->control = usb_ifnum_to_if(dev->udev,
183 info->u->bMasterInterface0);
184 info->data = usb_ifnum_to_if(dev->udev,
185 info->u->bSlaveInterface0);
186 if (!info->control || !info->data) {
187 dev_dbg(&intf->dev,
188 "master #%u/%p slave #%u/%p\n",
189 info->u->bMasterInterface0,
190 info->control,
191 info->u->bSlaveInterface0,
192 info->data);
193 goto bad_desc;
194 }
195 if (info->control != intf) {
196 dev_dbg(&intf->dev, "bogus CDC Union\n");
197 /* Ambit USB Cable Modem (and maybe others)
198 * interchanges master and slave interface.
199 */
200 if (info->data == intf) {
201 info->data = info->control;
202 info->control = intf;
203 } else
204 goto bad_desc;
205 }
206
207 /* a data interface altsetting does the real i/o */
208 d = &info->data->cur_altsetting->desc;
209 if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
210 dev_dbg(&intf->dev, "slave class %u\n",
211 d->bInterfaceClass);
212 goto bad_desc;
213 }
214 break;
215 case USB_CDC_ETHERNET_TYPE:
216 if (info->ether) {
217 dev_dbg(&intf->dev, "extra CDC ether\n");
218 goto bad_desc;
219 }
220 info->ether = (void *) buf;
221 if (info->ether->bLength != sizeof *info->ether) {
222 dev_dbg(&intf->dev, "CDC ether len %u\n",
223 info->ether->bLength);
224 goto bad_desc;
225 }
226 dev->hard_mtu = le16_to_cpu(
227 info->ether->wMaxSegmentSize);
228 /* because of Zaurus, we may be ignoring the host
229 * side link address we were given.
230 */
231 break;
232 }
233next_desc:
234 len -= buf [0]; /* bLength */
235 buf += buf [0];
236 }
237
Bjorge Dijkstra786e3df2008-01-26 00:50:44 +0200238 /* Microsoft ActiveSync based and some regular RNDIS devices lack the
239 * CDC descriptors, so we'll hard-wire the interfaces and not check
240 * for descriptors.
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800241 */
Bjorge Dijkstra786e3df2008-01-26 00:50:44 +0200242 if (rndis && !info->u) {
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800243 info->control = usb_ifnum_to_if(dev->udev, 0);
244 info->data = usb_ifnum_to_if(dev->udev, 1);
245 if (!info->control || !info->data) {
246 dev_dbg(&intf->dev,
Bjorge Dijkstra786e3df2008-01-26 00:50:44 +0200247 "rndis: master #0/%p slave #1/%p\n",
Ole Andre Vadla Ravnasad55d712006-12-14 16:01:28 -0800248 info->control,
249 info->data);
250 goto bad_desc;
251 }
252
253 } else if (!info->header || !info->u || (!rndis && !info->ether)) {
David Brownell4324fd42005-08-31 09:54:20 -0700254 dev_dbg(&intf->dev, "missing cdc %s%s%sdescriptor\n",
255 info->header ? "" : "header ",
256 info->u ? "" : "union ",
257 info->ether ? "" : "ether ");
258 goto bad_desc;
259 }
260
261 /* claim data interface and set it up ... with side effects.
262 * network traffic can't flow until an altsetting is enabled.
263 */
264 status = usb_driver_claim_interface(driver, info->data, dev);
265 if (status < 0)
266 return status;
267 status = usbnet_get_endpoints(dev, info->data);
268 if (status < 0) {
269 /* ensure immediate exit from usbnet_disconnect */
270 usb_set_intfdata(info->data, NULL);
271 usb_driver_release_interface(driver, info->data);
272 return status;
273 }
274
275 /* status endpoint: optional for CDC Ethernet, not RNDIS (or ACM) */
276 dev->status = NULL;
277 if (info->control->cur_altsetting->desc.bNumEndpoints == 1) {
278 struct usb_endpoint_descriptor *desc;
279
280 dev->status = &info->control->cur_altsetting->endpoint [0];
281 desc = &dev->status->desc;
Joe Perches8e95a202009-12-03 07:58:21 +0000282 if (!usb_endpoint_is_int_in(desc) ||
283 (le16_to_cpu(desc->wMaxPacketSize)
284 < sizeof(struct usb_cdc_notification)) ||
285 !desc->bInterval) {
David Brownell4324fd42005-08-31 09:54:20 -0700286 dev_dbg(&intf->dev, "bad notification endpoint\n");
287 dev->status = NULL;
288 }
289 }
290 if (rndis && !dev->status) {
291 dev_dbg(&intf->dev, "missing RNDIS status endpoint\n");
292 usb_set_intfdata(info->data, NULL);
293 usb_driver_release_interface(driver, info->data);
294 return -ENODEV;
295 }
296 return 0;
297
298bad_desc:
299 dev_info(&dev->udev->dev, "bad CDC descriptors\n");
300 return -ENODEV;
301}
302EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);
303
304void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
305{
306 struct cdc_state *info = (void *) &dev->data;
307 struct usb_driver *driver = driver_of(intf);
308
309 /* disconnect master --> disconnect slave */
310 if (intf == info->control && info->data) {
311 /* ensure immediate exit from usbnet_disconnect */
312 usb_set_intfdata(info->data, NULL);
313 usb_driver_release_interface(driver, info->data);
314 info->data = NULL;
315 }
316
317 /* and vice versa (just in case) */
318 else if (intf == info->data && info->control) {
319 /* ensure immediate exit from usbnet_disconnect */
320 usb_set_intfdata(info->control, NULL);
321 usb_driver_release_interface(driver, info->control);
322 info->control = NULL;
323 }
324}
325EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
326
David Brownell4324fd42005-08-31 09:54:20 -0700327/*-------------------------------------------------------------------------
328 *
329 * Communications Device Class, Ethernet Control model
330 *
331 * Takes two interfaces. The DATA interface is inactive till an altsetting
332 * is selected. Configuration data includes class descriptors. There's
333 * an optional status endpoint on the control interface.
334 *
335 * This should interop with whatever the 2.4 "CDCEther.c" driver
336 * (by Brad Hards) talked with, with more functionality.
337 *
338 *-------------------------------------------------------------------------*/
339
340static void dumpspeed(struct usbnet *dev, __le32 *speeds)
341{
Joe Perchesa475f602010-02-17 10:30:24 +0000342 netif_info(dev, timer, dev->net,
343 "link speeds: %u kbps up, %u kbps down\n",
344 __le32_to_cpu(speeds[0]) / 1000,
345 __le32_to_cpu(speeds[1]) / 1000);
David Brownell4324fd42005-08-31 09:54:20 -0700346}
347
348static void cdc_status(struct usbnet *dev, struct urb *urb)
349{
350 struct usb_cdc_notification *event;
351
352 if (urb->actual_length < sizeof *event)
353 return;
354
355 /* SPEED_CHANGE can get split into two 8-byte packets */
356 if (test_and_clear_bit(EVENT_STS_SPLIT, &dev->flags)) {
357 dumpspeed(dev, (__le32 *) urb->transfer_buffer);
358 return;
359 }
360
361 event = urb->transfer_buffer;
362 switch (event->bNotificationType) {
363 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
Joe Perchesa475f602010-02-17 10:30:24 +0000364 netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
365 event->wValue ? "on" : "off");
David Brownell4324fd42005-08-31 09:54:20 -0700366 if (event->wValue)
367 netif_carrier_on(dev->net);
368 else
369 netif_carrier_off(dev->net);
370 break;
371 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
Joe Perchesa475f602010-02-17 10:30:24 +0000372 netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n",
373 urb->actual_length);
David Brownell4324fd42005-08-31 09:54:20 -0700374 if (urb->actual_length != (sizeof *event + 8))
375 set_bit(EVENT_STS_SPLIT, &dev->flags);
376 else
377 dumpspeed(dev, (__le32 *) &event[1]);
378 break;
379 /* USB_CDC_NOTIFY_RESPONSE_AVAILABLE can happen too (e.g. RNDIS),
380 * but there are no standard formats for the response data.
381 */
382 default:
Joe Perches60b86752010-02-17 10:30:23 +0000383 netdev_err(dev->net, "CDC: unexpected notification %02x!\n",
384 event->bNotificationType);
David Brownell4324fd42005-08-31 09:54:20 -0700385 break;
386 }
387}
388
David Brownell4324fd42005-08-31 09:54:20 -0700389static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
390{
391 int status;
392 struct cdc_state *info = (void *) &dev->data;
393
394 status = usbnet_generic_cdc_bind(dev, intf);
395 if (status < 0)
396 return status;
397
Peter Holik03ad0322009-04-18 07:24:17 +0000398 status = usbnet_get_ethernet_addr(dev, info->ether->iMACAddress);
David Brownell4324fd42005-08-31 09:54:20 -0700399 if (status < 0) {
400 usb_set_intfdata(info->data, NULL);
401 usb_driver_release_interface(driver_of(intf), info->data);
402 return status;
403 }
404
405 /* FIXME cdc-ether has some multicast code too, though it complains
406 * in routine cases. info->ether describes the multicast support.
407 * Implement that here, manipulating the cdc filter as needed.
408 */
409 return 0;
410}
411
Oliver Neukum69ee472f2009-12-03 15:31:18 -0800412static int cdc_manage_power(struct usbnet *dev, int on)
413{
414 dev->intf->needs_remote_wakeup = on;
415 return 0;
416}
417
David Brownell4324fd42005-08-31 09:54:20 -0700418static const struct driver_info cdc_info = {
419 .description = "CDC Ethernet Device",
Ben Hutchings71cc1fa2010-01-28 21:37:18 -0800420 .flags = FLAG_ETHER,
David Brownell4324fd42005-08-31 09:54:20 -0700421 // .check_connect = cdc_check_connect,
422 .bind = cdc_bind,
423 .unbind = usbnet_cdc_unbind,
424 .status = cdc_status,
Oliver Neukum69ee472f2009-12-03 15:31:18 -0800425 .manage_power = cdc_manage_power,
David Brownell4324fd42005-08-31 09:54:20 -0700426};
427
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000428static const struct driver_info mbm_info = {
429 .description = "Mobile Broadband Network Device",
430 .flags = FLAG_WWAN,
431 .bind = cdc_bind,
432 .unbind = usbnet_cdc_unbind,
433 .status = cdc_status,
Torgny Johansson55964d72010-04-27 17:07:40 -0700434 .manage_power = cdc_manage_power,
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000435};
436
David Brownell4324fd42005-08-31 09:54:20 -0700437/*-------------------------------------------------------------------------*/
438
439
440static const struct usb_device_id products [] = {
441/*
442 * BLACKLIST !!
443 *
444 * First blacklist any products that are egregiously nonconformant
445 * with the CDC Ethernet specs. Minor braindamage we cope with; when
446 * they're not even trying, needing a separate driver is only the first
447 * of the differences to show up.
448 */
449
450#define ZAURUS_MASTER_INTERFACE \
451 .bInterfaceClass = USB_CLASS_COMM, \
452 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
453 .bInterfaceProtocol = USB_CDC_PROTO_NONE
454
455/* SA-1100 based Sharp Zaurus ("collie"), or compatible;
456 * wire-incompatible with true CDC Ethernet implementations.
457 * (And, it seems, needlessly so...)
458 */
459{
460 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
461 | USB_DEVICE_ID_MATCH_DEVICE,
462 .idVendor = 0x04DD,
463 .idProduct = 0x8004,
464 ZAURUS_MASTER_INTERFACE,
465 .driver_info = 0,
466},
467
468/* PXA-25x based Sharp Zaurii. Note that it seems some of these
469 * (later models especially) may have shipped only with firmware
470 * advertising false "CDC MDLM" compatibility ... but we're not
471 * clear which models did that, so for now let's assume the worst.
472 */
473{
474 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
475 | USB_DEVICE_ID_MATCH_DEVICE,
476 .idVendor = 0x04DD,
477 .idProduct = 0x8005, /* A-300 */
478 ZAURUS_MASTER_INTERFACE,
479 .driver_info = 0,
480}, {
481 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
482 | USB_DEVICE_ID_MATCH_DEVICE,
483 .idVendor = 0x04DD,
484 .idProduct = 0x8006, /* B-500/SL-5600 */
485 ZAURUS_MASTER_INTERFACE,
486 .driver_info = 0,
487}, {
488 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
489 | USB_DEVICE_ID_MATCH_DEVICE,
490 .idVendor = 0x04DD,
491 .idProduct = 0x8007, /* C-700 */
492 ZAURUS_MASTER_INTERFACE,
493 .driver_info = 0,
494}, {
495 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
496 | USB_DEVICE_ID_MATCH_DEVICE,
497 .idVendor = 0x04DD,
498 .idProduct = 0x9031, /* C-750 C-760 */
499 ZAURUS_MASTER_INTERFACE,
500 .driver_info = 0,
501}, {
502 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
503 | USB_DEVICE_ID_MATCH_DEVICE,
504 .idVendor = 0x04DD,
505 .idProduct = 0x9032, /* SL-6000 */
506 ZAURUS_MASTER_INTERFACE,
507 .driver_info = 0,
508}, {
509 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
510 | USB_DEVICE_ID_MATCH_DEVICE,
511 .idVendor = 0x04DD,
512 /* reported with some C860 units */
513 .idProduct = 0x9050, /* C-860 */
514 ZAURUS_MASTER_INTERFACE,
515 .driver_info = 0,
516},
517
David Brownellefcaa202006-05-30 20:49:29 -0700518/* Olympus has some models with a Zaurus-compatible option.
519 * R-1000 uses a FreeScale i.MXL cpu (ARMv4T)
520 */
521{
522 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
523 | USB_DEVICE_ID_MATCH_DEVICE,
524 .idVendor = 0x07B4,
525 .idProduct = 0x0F02, /* R-1000 */
526 ZAURUS_MASTER_INTERFACE,
527 .driver_info = 0,
528},
529
David Brownell4324fd42005-08-31 09:54:20 -0700530/*
531 * WHITELIST!!!
532 *
533 * CDC Ether uses two interfaces, not necessarily consecutive.
534 * We match the main interface, ignoring the optional device
535 * class so we could handle devices that aren't exclusively
536 * CDC ether.
537 *
538 * NOTE: this match must come AFTER entries blacklisting devices
539 * because of bugs/quirks in a given product (like Zaurus, above).
540 */
541{
542 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
543 USB_CDC_PROTO_NONE),
544 .driver_info = (unsigned long) &cdc_info,
Bjørn Morkcac477e2009-02-25 04:33:58 +0000545}, {
546 /* Ericsson F3507g */
547 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
548 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000549 .driver_info = (unsigned long) &mbm_info,
Jonas Sjöquist68924922009-06-18 01:50:52 +0000550}, {
551 /* Ericsson F3507g ver. 2 */
552 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1902, USB_CLASS_COMM,
553 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000554 .driver_info = (unsigned long) &mbm_info,
Jonas Sjöquist68924922009-06-18 01:50:52 +0000555}, {
556 /* Ericsson F3607gw */
557 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1904, USB_CLASS_COMM,
558 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000559 .driver_info = (unsigned long) &mbm_info,
Jonas Sjöquist68924922009-06-18 01:50:52 +0000560}, {
Torgny Johansson3a19d562009-11-04 05:25:02 -0800561 /* Ericsson F3607gw ver 2 */
562 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM,
563 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800564 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800565}, {
566 /* Ericsson F3607gw ver 3 */
Jonas Sjöquist68924922009-06-18 01:50:52 +0000567 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM,
568 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000569 .driver_info = (unsigned long) &mbm_info,
Jonas Sjöquist68924922009-06-18 01:50:52 +0000570}, {
Torgny Johansson3a19d562009-11-04 05:25:02 -0800571 /* Ericsson F3307 */
572 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM,
573 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800574 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800575}, {
576 /* Ericsson F3307 ver 2 */
577 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM,
578 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800579 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800580}, {
581 /* Ericsson C3607w */
582 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM,
583 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800584 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800585}, {
Torgny Johanssoncac43a12010-02-19 01:59:15 +0000586 /* Ericsson C3607w ver 2 */
587 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM,
588 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
589 .driver_info = (unsigned long) &mbm_info,
590}, {
Jonas Sjöquist68924922009-06-18 01:50:52 +0000591 /* Toshiba F3507g */
592 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM,
593 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000594 .driver_info = (unsigned long) &mbm_info,
Jonas Sjöquist68924922009-06-18 01:50:52 +0000595}, {
Torgny Johansson3a19d562009-11-04 05:25:02 -0800596 /* Toshiba F3607gw */
597 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM,
598 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800599 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800600}, {
601 /* Toshiba F3607gw ver 2 */
602 USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM,
603 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800604 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800605}, {
Jonas Sjöquist68924922009-06-18 01:50:52 +0000606 /* Dell F3507g */
607 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM,
608 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
Marcel Holtmanne1e499e2009-10-02 05:15:25 +0000609 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800610}, {
611 /* Dell F3607gw */
612 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM,
613 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800614 .driver_info = (unsigned long) &mbm_info,
Torgny Johansson3a19d562009-11-04 05:25:02 -0800615}, {
616 /* Dell F3607gw ver 2 */
617 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM,
618 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
David S. Miller230f9bb2009-11-06 00:55:55 -0800619 .driver_info = (unsigned long) &mbm_info,
David Brownell4324fd42005-08-31 09:54:20 -0700620},
621 { }, // END
622};
623MODULE_DEVICE_TABLE(usb, products);
624
625static struct usb_driver cdc_driver = {
David Brownell4324fd42005-08-31 09:54:20 -0700626 .name = "cdc_ether",
627 .id_table = products,
628 .probe = usbnet_probe,
629 .disconnect = usbnet_disconnect,
630 .suspend = usbnet_suspend,
631 .resume = usbnet_resume,
Oliver Neukum7f515792009-12-03 11:41:07 +0000632 .reset_resume = usbnet_resume,
Oliver Neukum69ee472f2009-12-03 15:31:18 -0800633 .supports_autosuspend = 1,
David Brownell4324fd42005-08-31 09:54:20 -0700634};
635
636
637static int __init cdc_init(void)
638{
Alexey Dobriyanf8ac2322006-10-08 16:02:00 +0400639 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
David Brownell4324fd42005-08-31 09:54:20 -0700640 < sizeof(struct cdc_state)));
641
642 return usb_register(&cdc_driver);
643}
644module_init(cdc_init);
645
646static void __exit cdc_exit(void)
647{
648 usb_deregister(&cdc_driver);
649}
650module_exit(cdc_exit);
651
652MODULE_AUTHOR("David Brownell");
653MODULE_DESCRIPTION("USB CDC Ethernet devices");
654MODULE_LICENSE("GPL");