2 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * version 2 as published by the Free Software Foundation.
9 #include <linux/module.h>
10 #include <linux/netdevice.h>
11 #include <linux/ethtool.h>
12 #include <linux/etherdevice.h>
13 #include <linux/mii.h>
14 #include <linux/usb.h>
15 #include <linux/usb/cdc.h>
16 #include <linux/usb/usbnet.h>
17 #include <linux/usb/cdc-wdm.h>
19 /* The name of the CDC Device Management driver */
20 #define DM_DRIVER "cdc_wdm"
23 * This driver supports wwan (3G/LTE/?) devices using a vendor
24 * specific management protocol called Qualcomm MSM Interface (QMI) -
25 * in addition to the more common AT commands over serial interface
28 * QMI is wrapped in CDC, using CDC encapsulated commands on the
29 * control ("master") interface of a two-interface CDC Union
30 * resembling standard CDC ECM. The devices do not use the control
31 * interface for any other CDC messages. Most likely because the
32 * management protocol is used in place of the standard CDC
33 * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
35 * Handling a protocol like QMI is out of the scope for any driver.
36 * It can be exported as a character device using the cdc-wdm driver,
37 * which will enable userspace applications ("modem managers") to
38 * handle it. This may be required to use the network interface
39 * provided by the driver.
41 * These devices may alternatively/additionally be configured using AT
42 * commands on any of the serial interfaces driven by the option driver
44 * This driver binds only to the data ("slave") interface to enable
45 * the cdc-wdm driver to bind to the control interface. It still
46 * parses the CDC functional descriptors on the control interface to
47 * a) verify that this is indeed a handled interface (CDC Union
48 * header lists it as slave)
49 * b) get MAC address and other ethernet config from the CDC Ethernet
51 * c) enable user bind requests against the control interface, which
52 * is the common way to bind to CDC Ethernet Control Model type
54 * d) provide a hint to the user about which interface is the
55 * corresponding management interface
58 static int qmi_wwan_bind(struct usbnet
*dev
, struct usb_interface
*intf
)
61 struct usb_interface
*control
= NULL
;
62 u8
*buf
= intf
->cur_altsetting
->extra
;
63 int len
= intf
->cur_altsetting
->extralen
;
64 struct usb_interface_descriptor
*desc
= &intf
->cur_altsetting
->desc
;
65 struct usb_cdc_union_desc
*cdc_union
= NULL
;
66 struct usb_cdc_ether_desc
*cdc_ether
= NULL
;
67 u32 required
= 1 << USB_CDC_HEADER_TYPE
| 1 << USB_CDC_UNION_TYPE
;
69 atomic_t
*pmcount
= (void *)&dev
->data
[1];
71 atomic_set(pmcount
, 0);
74 * assume a data interface has no additional descriptors and
75 * that the control and data interface are numbered
76 * consecutively - this holds for the Huawei device at least
78 if (len
== 0 && desc
->bInterfaceNumber
> 0) {
79 control
= usb_ifnum_to_if(dev
->udev
, desc
->bInterfaceNumber
- 1);
83 buf
= control
->cur_altsetting
->extra
;
84 len
= control
->cur_altsetting
->extralen
;
85 dev_dbg(&intf
->dev
, "guessing \"control\" => %s, \"data\" => this\n",
86 dev_name(&control
->dev
));
90 struct usb_descriptor_header
*h
= (void *)buf
;
92 /* ignore any misplaced descriptors */
93 if (h
->bDescriptorType
!= USB_DT_CS_INTERFACE
)
96 /* buf[2] is CDC descriptor subtype */
98 case USB_CDC_HEADER_TYPE
:
99 if (found
& 1 << USB_CDC_HEADER_TYPE
) {
100 dev_dbg(&intf
->dev
, "extra CDC header\n");
103 if (h
->bLength
!= sizeof(struct usb_cdc_header_desc
)) {
104 dev_dbg(&intf
->dev
, "CDC header len %u\n", h
->bLength
);
108 case USB_CDC_UNION_TYPE
:
109 if (found
& 1 << USB_CDC_UNION_TYPE
) {
110 dev_dbg(&intf
->dev
, "extra CDC union\n");
113 if (h
->bLength
!= sizeof(struct usb_cdc_union_desc
)) {
114 dev_dbg(&intf
->dev
, "CDC union len %u\n", h
->bLength
);
117 cdc_union
= (struct usb_cdc_union_desc
*)buf
;
119 case USB_CDC_ETHERNET_TYPE
:
120 if (found
& 1 << USB_CDC_ETHERNET_TYPE
) {
121 dev_dbg(&intf
->dev
, "extra CDC ether\n");
124 if (h
->bLength
!= sizeof(struct usb_cdc_ether_desc
)) {
125 dev_dbg(&intf
->dev
, "CDC ether len %u\n", h
->bLength
);
128 cdc_ether
= (struct usb_cdc_ether_desc
*)buf
;
133 * Remember which CDC functional descriptors we've seen. Works
134 * for all types we care about, of which USB_CDC_ETHERNET_TYPE
135 * (0x0f) is the highest numbered
138 found
|= 1 << buf
[2];
145 /* did we find all the required ones? */
146 if ((found
& required
) != required
) {
147 dev_err(&intf
->dev
, "CDC functional descriptors missing\n");
151 /* give the user a helpful hint if trying to bind to the wrong interface */
152 if (cdc_union
&& desc
->bInterfaceNumber
== cdc_union
->bMasterInterface0
) {
153 dev_err(&intf
->dev
, "leaving \"control\" interface for " DM_DRIVER
" - try binding to %s instead!\n",
154 dev_name(&usb_ifnum_to_if(dev
->udev
, cdc_union
->bSlaveInterface0
)->dev
));
158 /* errors aren't fatal - we can live with the dynamic address */
160 dev
->hard_mtu
= le16_to_cpu(cdc_ether
->wMaxSegmentSize
);
161 usbnet_get_ethernet_addr(dev
, cdc_ether
->iMACAddress
);
164 /* success! point the user to the management interface */
166 dev_info(&intf
->dev
, "Use \"" DM_DRIVER
"\" for QMI interface %s\n",
167 dev_name(&control
->dev
));
169 /* XXX: add a sysfs symlink somewhere to help management applications find it? */
171 /* collect bulk endpoints now that we know intf == "data" interface */
172 status
= usbnet_get_endpoints(dev
, intf
);
178 /* default ethernet address used by the modem */
179 static const u8 default_modem_addr
[ETH_ALEN
] = {0x02, 0x50, 0xf3};
181 /* Make up an ethernet header if the packet doesn't have one.
183 * A firmware bug common among several devices cause them to send raw
184 * IP packets under some circumstances. There is no way for the
185 * driver/host to know when this will happen. And even when the bug
186 * hits, some packets will still arrive with an intact header.
188 * The supported devices are only capably of sending IPv4, IPv6 and
189 * ARP packets on a point-to-point link. Any packet with an ethernet
190 * header will have either our address or a broadcast/multicast
191 * address as destination. ARP packets will always have a header.
193 * This means that this function will reliably add the appropriate
194 * header iff necessary, provided our hardware address does not start
197 * Another common firmware bug results in all packets being addressed
198 * to 00:a0:c6:00:00:00 despite the host address being different.
199 * This function will also fixup such packets.
201 static int qmi_wwan_rx_fixup(struct usbnet
*dev
, struct sk_buff
*skb
)
205 /* This check is no longer done by usbnet */
206 if (skb
->len
< dev
->net
->hard_header_len
)
209 switch (skb
->data
[0] & 0xf0) {
211 proto
= htons(ETH_P_IP
);
214 proto
= htons(ETH_P_IPV6
);
217 if (is_multicast_ether_addr(skb
->data
))
219 /* possibly bogus destination - rewrite just in case */
220 skb_reset_mac_header(skb
);
223 /* pass along other packets without modifications */
226 if (skb_headroom(skb
) < ETH_HLEN
)
228 skb_push(skb
, ETH_HLEN
);
229 skb_reset_mac_header(skb
);
230 eth_hdr(skb
)->h_proto
= proto
;
231 memset(eth_hdr(skb
)->h_source
, 0, ETH_ALEN
);
233 memcpy(eth_hdr(skb
)->h_dest
, dev
->net
->dev_addr
, ETH_ALEN
);
237 /* very simplistic detection of IPv4 or IPv6 headers */
238 static bool possibly_iphdr(const char *data
)
240 return (data
[0] & 0xd0) == 0x40;
243 /* disallow addresses which may be confused with IP headers */
244 static int qmi_wwan_mac_addr(struct net_device
*dev
, void *p
)
246 struct sockaddr
*addr
= p
;
248 if (!is_valid_ether_addr(addr
->sa_data
) ||
249 possibly_iphdr(addr
->sa_data
))
250 return -EADDRNOTAVAIL
;
251 memcpy(dev
->dev_addr
, addr
->sa_data
, ETH_ALEN
);
255 static const struct net_device_ops qmi_wwan_netdev_ops
= {
256 .ndo_open
= usbnet_open
,
257 .ndo_stop
= usbnet_stop
,
258 .ndo_start_xmit
= usbnet_start_xmit
,
259 .ndo_tx_timeout
= usbnet_tx_timeout
,
260 .ndo_change_mtu
= usbnet_change_mtu
,
261 .ndo_set_mac_address
= qmi_wwan_mac_addr
,
262 .ndo_validate_addr
= eth_validate_addr
,
265 /* using a counter to merge subdriver requests with our own into a combined state */
266 static int qmi_wwan_manage_power(struct usbnet
*dev
, int on
)
268 atomic_t
*pmcount
= (void *)&dev
->data
[1];
271 dev_dbg(&dev
->intf
->dev
, "%s() pmcount=%d, on=%d\n", __func__
, atomic_read(pmcount
), on
);
273 if ((on
&& atomic_add_return(1, pmcount
) == 1) || (!on
&& atomic_dec_and_test(pmcount
))) {
274 /* need autopm_get/put here to ensure the usbcore sees the new value */
275 rv
= usb_autopm_get_interface(dev
->intf
);
278 dev
->intf
->needs_remote_wakeup
= on
;
279 usb_autopm_put_interface(dev
->intf
);
285 static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface
*intf
, int on
)
287 struct usbnet
*dev
= usb_get_intfdata(intf
);
289 /* can be called while disconnecting */
292 return qmi_wwan_manage_power(dev
, on
);
295 /* Some devices combine the "control" and "data" functions into a
296 * single interface with all three endpoints: interrupt + bulk in and
299 * Setting up cdc-wdm as a subdriver owning the interrupt endpoint
300 * will let it provide userspace access to the encapsulated QMI
301 * protocol without interfering with the usbnet operations.
303 static int qmi_wwan_bind_shared(struct usbnet
*dev
, struct usb_interface
*intf
)
306 struct usb_driver
*subdriver
= NULL
;
307 atomic_t
*pmcount
= (void *)&dev
->data
[1];
309 /* ZTE makes devices where the interface descriptors and endpoint
310 * configurations of two or more interfaces are identical, even
311 * though the functions are completely different. If set, then
312 * driver_info->data is a bitmap of acceptable interface numbers
313 * allowing us to bind to one such interface without binding to
316 if (dev
->driver_info
->data
&&
317 !test_bit(intf
->cur_altsetting
->desc
.bInterfaceNumber
, &dev
->driver_info
->data
)) {
318 dev_info(&intf
->dev
, "not on our whitelist - ignored");
323 atomic_set(pmcount
, 0);
325 /* collect all three endpoints */
326 rv
= usbnet_get_endpoints(dev
, intf
);
330 /* require interrupt endpoint for subdriver */
336 subdriver
= usb_cdc_wdm_register(intf
, &dev
->status
->desc
, 512, &qmi_wwan_cdc_wdm_manage_power
);
337 if (IS_ERR(subdriver
)) {
338 rv
= PTR_ERR(subdriver
);
342 /* can't let usbnet use the interrupt endpoint */
345 /* save subdriver struct for suspend/resume wrappers */
346 dev
->data
[0] = (unsigned long)subdriver
;
348 /* Never use the same address on both ends of the link, even
349 * if the buggy firmware told us to.
351 if (!compare_ether_addr(dev
->net
->dev_addr
, default_modem_addr
))
352 eth_hw_addr_random(dev
->net
);
354 /* make MAC addr easily distinguishable from an IP header */
355 if (possibly_iphdr(dev
->net
->dev_addr
)) {
356 dev
->net
->dev_addr
[0] |= 0x02; /* set local assignment bit */
357 dev
->net
->dev_addr
[0] &= 0xbf; /* clear "IP" bit */
359 dev
->net
->netdev_ops
= &qmi_wwan_netdev_ops
;
364 static void qmi_wwan_unbind_shared(struct usbnet
*dev
, struct usb_interface
*intf
)
366 struct usb_driver
*subdriver
= (void *)dev
->data
[0];
368 if (subdriver
&& subdriver
->disconnect
)
369 subdriver
->disconnect(intf
);
371 dev
->data
[0] = (unsigned long)NULL
;
374 /* suspend/resume wrappers calling both usbnet and the cdc-wdm
375 * subdriver if present.
377 * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
378 * wrappers for those without adding usbnet reset support first.
380 static int qmi_wwan_suspend(struct usb_interface
*intf
, pm_message_t message
)
382 struct usbnet
*dev
= usb_get_intfdata(intf
);
383 struct usb_driver
*subdriver
= (void *)dev
->data
[0];
386 ret
= usbnet_suspend(intf
, message
);
390 if (subdriver
&& subdriver
->suspend
)
391 ret
= subdriver
->suspend(intf
, message
);
398 static int qmi_wwan_resume(struct usb_interface
*intf
)
400 struct usbnet
*dev
= usb_get_intfdata(intf
);
401 struct usb_driver
*subdriver
= (void *)dev
->data
[0];
404 if (subdriver
&& subdriver
->resume
)
405 ret
= subdriver
->resume(intf
);
408 ret
= usbnet_resume(intf
);
409 if (ret
< 0 && subdriver
&& subdriver
->resume
&& subdriver
->suspend
)
410 subdriver
->suspend(intf
, PMSG_SUSPEND
);
416 static const struct driver_info qmi_wwan_info
= {
417 .description
= "QMI speaking wwan device",
419 .bind
= qmi_wwan_bind
,
420 .manage_power
= qmi_wwan_manage_power
,
423 static const struct driver_info qmi_wwan_shared
= {
424 .description
= "QMI speaking wwan device with combined interface",
426 .bind
= qmi_wwan_bind_shared
,
427 .unbind
= qmi_wwan_unbind_shared
,
428 .manage_power
= qmi_wwan_manage_power
,
429 .rx_fixup
= qmi_wwan_rx_fixup
,
432 static const struct driver_info qmi_wwan_force_int0
= {
433 .description
= "Qualcomm WWAN/QMI device",
435 .bind
= qmi_wwan_bind_shared
,
436 .unbind
= qmi_wwan_unbind_shared
,
437 .manage_power
= qmi_wwan_manage_power
,
438 .data
= BIT(0), /* interface whitelist bitmap */
441 static const struct driver_info qmi_wwan_force_int1
= {
442 .description
= "Qualcomm WWAN/QMI device",
444 .bind
= qmi_wwan_bind_shared
,
445 .unbind
= qmi_wwan_unbind_shared
,
446 .manage_power
= qmi_wwan_manage_power
,
447 .data
= BIT(1), /* interface whitelist bitmap */
450 static const struct driver_info qmi_wwan_force_int2
= {
451 .description
= "Qualcomm WWAN/QMI device",
453 .bind
= qmi_wwan_bind_shared
,
454 .unbind
= qmi_wwan_unbind_shared
,
455 .manage_power
= qmi_wwan_manage_power
,
456 .data
= BIT(2), /* interface whitelist bitmap */
459 static const struct driver_info qmi_wwan_force_int3
= {
460 .description
= "Qualcomm WWAN/QMI device",
462 .bind
= qmi_wwan_bind_shared
,
463 .unbind
= qmi_wwan_unbind_shared
,
464 .manage_power
= qmi_wwan_manage_power
,
465 .data
= BIT(3), /* interface whitelist bitmap */
468 static const struct driver_info qmi_wwan_force_int4
= {
469 .description
= "Qualcomm WWAN/QMI device",
471 .bind
= qmi_wwan_bind_shared
,
472 .unbind
= qmi_wwan_unbind_shared
,
473 .manage_power
= qmi_wwan_manage_power
,
474 .data
= BIT(4), /* interface whitelist bitmap */
477 /* Sierra Wireless provide equally useless interface descriptors
478 * Devices in QMI mode can be switched between two different
480 * a) USB interface #8 is QMI/wwan
481 * b) USB interfaces #8, #19 and #20 are QMI/wwan
483 * Both configurations provide a number of other interfaces (serial++),
484 * some of which have the same endpoint configuration as we expect, so
485 * a whitelist or blacklist is necessary.
487 * FIXME: The below whitelist should include BIT(20). It does not
488 * because I cannot get it to work...
490 static const struct driver_info qmi_wwan_sierra
= {
491 .description
= "Sierra Wireless wwan/QMI device",
493 .bind
= qmi_wwan_bind_shared
,
494 .unbind
= qmi_wwan_unbind_shared
,
495 .manage_power
= qmi_wwan_manage_power
,
496 .data
= BIT(8) | BIT(19), /* interface whitelist bitmap */
499 #define HUAWEI_VENDOR_ID 0x12D1
501 /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
502 #define QMI_GOBI1K_DEVICE(vend, prod) \
503 USB_DEVICE(vend, prod), \
504 .driver_info = (unsigned long)&qmi_wwan_force_int3
506 /* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */
507 #define QMI_GOBI_DEVICE(vend, prod) \
508 USB_DEVICE(vend, prod), \
509 .driver_info = (unsigned long)&qmi_wwan_force_int0
511 static const struct usb_device_id products
[] = {
512 { /* Huawei E392, E398 and possibly others sharing both device id and more... */
513 .match_flags
= USB_DEVICE_ID_MATCH_VENDOR
| USB_DEVICE_ID_MATCH_INT_INFO
,
514 .idVendor
= HUAWEI_VENDOR_ID
,
515 .bInterfaceClass
= USB_CLASS_VENDOR_SPEC
,
516 .bInterfaceSubClass
= 1,
517 .bInterfaceProtocol
= 8, /* NOTE: This is the *slave* interface of the CDC Union! */
518 .driver_info
= (unsigned long)&qmi_wwan_info
,
520 { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
521 .match_flags
= USB_DEVICE_ID_MATCH_VENDOR
| USB_DEVICE_ID_MATCH_INT_INFO
,
522 .idVendor
= HUAWEI_VENDOR_ID
,
523 .bInterfaceClass
= USB_CLASS_VENDOR_SPEC
,
524 .bInterfaceSubClass
= 1,
525 .bInterfaceProtocol
= 56, /* NOTE: This is the *slave* interface of the CDC Union! */
526 .driver_info
= (unsigned long)&qmi_wwan_info
,
528 { /* Huawei E392, E398 and possibly others in "Windows mode"
529 * using a combined control and data interface without any CDC
530 * functional descriptors
532 .match_flags
= USB_DEVICE_ID_MATCH_VENDOR
| USB_DEVICE_ID_MATCH_INT_INFO
,
533 .idVendor
= HUAWEI_VENDOR_ID
,
534 .bInterfaceClass
= USB_CLASS_VENDOR_SPEC
,
535 .bInterfaceSubClass
= 1,
536 .bInterfaceProtocol
= 17,
537 .driver_info
= (unsigned long)&qmi_wwan_shared
,
539 { /* Pantech UML290 */
540 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
543 .bInterfaceClass
= 0xff,
544 .bInterfaceSubClass
= 0xf0,
545 .bInterfaceProtocol
= 0xff,
546 .driver_info
= (unsigned long)&qmi_wwan_shared
,
548 { /* Pantech UML290 - newer firmware */
549 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
552 .bInterfaceClass
= 0xff,
553 .bInterfaceSubClass
= 0xf1,
554 .bInterfaceProtocol
= 0xff,
555 .driver_info
= (unsigned long)&qmi_wwan_shared
,
558 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
561 .bInterfaceClass
= 0xff,
562 .bInterfaceSubClass
= 0xff,
563 .bInterfaceProtocol
= 0xff,
564 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
567 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
570 .bInterfaceClass
= 0xff,
571 .bInterfaceSubClass
= 0xff,
572 .bInterfaceProtocol
= 0xff,
573 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
575 { /* ZTE (Vodafone) K3520-Z */
576 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
579 .bInterfaceClass
= 0xff,
580 .bInterfaceSubClass
= 0xff,
581 .bInterfaceProtocol
= 0xff,
582 .driver_info
= (unsigned long)&qmi_wwan_force_int1
,
584 { /* ZTE (Vodafone) K3565-Z */
585 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
588 .bInterfaceClass
= 0xff,
589 .bInterfaceSubClass
= 0xff,
590 .bInterfaceProtocol
= 0xff,
591 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
593 { /* ZTE (Vodafone) K3570-Z */
594 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
597 .bInterfaceClass
= 0xff,
598 .bInterfaceSubClass
= 0xff,
599 .bInterfaceProtocol
= 0xff,
600 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
602 { /* ZTE (Vodafone) K3571-Z */
603 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
606 .bInterfaceClass
= 0xff,
607 .bInterfaceSubClass
= 0xff,
608 .bInterfaceProtocol
= 0xff,
609 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
611 { /* ZTE (Vodafone) K3765-Z */
612 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
615 .bInterfaceClass
= 0xff,
616 .bInterfaceSubClass
= 0xff,
617 .bInterfaceProtocol
= 0xff,
618 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
620 { /* ZTE (Vodafone) K4505-Z */
621 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
624 .bInterfaceClass
= 0xff,
625 .bInterfaceSubClass
= 0xff,
626 .bInterfaceProtocol
= 0xff,
627 .driver_info
= (unsigned long)&qmi_wwan_force_int4
,
629 { /* ZTE (Vodafone) K5006-Z */
630 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
633 .bInterfaceClass
= 0xff,
634 .bInterfaceSubClass
= 0xff,
635 .bInterfaceProtocol
= 0xff,
636 .driver_info
= (unsigned long)&qmi_wwan_force_int3
,
639 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
642 .bInterfaceClass
= 0xff,
643 .bInterfaceSubClass
= 0xff,
644 .bInterfaceProtocol
= 0xff,
645 .driver_info
= (unsigned long)&qmi_wwan_force_int2
,
647 { /* Sierra Wireless MC77xx in QMI mode */
648 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
651 .bInterfaceClass
= 0xff,
652 .bInterfaceSubClass
= 0xff,
653 .bInterfaceProtocol
= 0xff,
654 .driver_info
= (unsigned long)&qmi_wwan_sierra
,
656 { /* Sierra Wireless MC7700 */
657 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
660 .bInterfaceClass
= 0xff,
661 .bInterfaceSubClass
= 0xff,
662 .bInterfaceProtocol
= 0xff,
663 .driver_info
= (unsigned long)&qmi_wwan_sierra
,
665 { /* Sierra Wireless MC7750 */
666 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
669 .bInterfaceClass
= 0xff,
670 .bInterfaceSubClass
= 0xff,
671 .bInterfaceProtocol
= 0xff,
672 .driver_info
= (unsigned long)&qmi_wwan_sierra
,
674 { /* Sierra Wireless EM7700 */
675 .match_flags
= USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO
,
678 .bInterfaceClass
= 0xff,
679 .bInterfaceSubClass
= 0xff,
680 .bInterfaceProtocol
= 0xff,
681 .driver_info
= (unsigned long)&qmi_wwan_sierra
,
684 /* Gobi 1000 devices */
685 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
686 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
687 {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
688 {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
689 {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
690 {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
691 {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
692 {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
693 {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
694 {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
695 {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
696 {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
697 {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
698 {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
700 /* Gobi 2000 and 3000 devices */
701 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
702 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
703 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
704 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
705 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
706 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
707 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
708 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
709 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
710 {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */
711 {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */
712 {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
713 {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
714 {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
715 {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
716 {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
717 {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
718 {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
719 {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
720 {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
721 {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
722 {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
723 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
724 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
725 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
726 {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
727 {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
728 {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
732 MODULE_DEVICE_TABLE(usb
, products
);
734 static struct usb_driver qmi_wwan_driver
= {
736 .id_table
= products
,
737 .probe
= usbnet_probe
,
738 .disconnect
= usbnet_disconnect
,
739 .suspend
= qmi_wwan_suspend
,
740 .resume
= qmi_wwan_resume
,
741 .reset_resume
= qmi_wwan_resume
,
742 .supports_autosuspend
= 1,
745 static int __init
qmi_wwan_init(void)
747 return usb_register(&qmi_wwan_driver
);
749 module_init(qmi_wwan_init
);
751 static void __exit
qmi_wwan_exit(void)
753 usb_deregister(&qmi_wwan_driver
);
755 module_exit(qmi_wwan_exit
);
757 MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
758 MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
759 MODULE_LICENSE("GPL");