kernel/3.18: update to version 3.18.25
[openwrt/openwrt.git] / target / linux / generic / patches-3.18 / 192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch
1 From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
3 Date: Tue, 3 Nov 2015 11:01:42 +0100
4 Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe
5 module
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 It seems like this device has same vendor and product IDs as G2K
11 devices, but it has different number of interfaces(4 vs 5) and also
12 different interface layout which makes it currently unusable:
13
14 usbcore: registered new interface driver qcserial
15 usbserial: USB Serial support registered for Qualcomm USB modem
16 usb 2-1.2: unknown number of interfaces: 5
17
18 lsusb output:
19
20 Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless
21 Device Descriptor:
22 bLength 18
23 bDescriptorType 1
24 bcdUSB 2.00
25 bDeviceClass 0 (Defined at Interface level)
26 bDeviceSubClass 0
27 bDeviceProtocol 0
28 bMaxPacketSize0 64
29 idVendor 0x05c6 Qualcomm, Inc.
30 idProduct 0x9215 Acer Gobi 2000 Wireless Modem
31 bcdDevice 2.32
32 iManufacturer 1 Quectel
33 iProduct 2 Quectel LTE Module
34 iSerial 0
35 bNumConfigurations 1
36 Configuration Descriptor:
37 bLength 9
38 bDescriptorType 2
39 wTotalLength 209
40 bNumInterfaces 5
41 bConfigurationValue 1
42 iConfiguration 0
43 bmAttributes 0xa0
44 (Bus Powered)
45 Remote Wakeup
46 MaxPower 500mA
47
48 Signed-off-by: Petr Štetiar <ynezz@true.cz>
49 ---
50 drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++
51 1 file changed, 39 insertions(+)
52
53 --- a/drivers/usb/serial/qcserial.c
54 +++ b/drivers/usb/serial/qcserial.c
55 @@ -22,6 +22,8 @@
56 #define DRIVER_AUTHOR "Qualcomm Inc"
57 #define DRIVER_DESC "Qualcomm USB Serial driver"
58
59 +#define QUECTEL_EC20_IDPRODUCT 0x9215
60 +
61 /* standard device layouts supported by this driver */
62 enum qcserial_layouts {
63 QCSERIAL_G2K = 0, /* Gobi 2000 */
64 @@ -166,6 +168,38 @@ static const struct usb_device_id id_tab
65 };
66 MODULE_DEVICE_TABLE(usb, id_table);
67
68 +static int handle_quectel_ec20(struct device *dev, int ifnum)
69 +{
70 + int altsetting = 0;
71 +
72 + /*
73 + * Quectel EC20 Mini PCIe LTE module layout:
74 + * 0: DM/DIAG (use libqcdm from ModemManager for communication)
75 + * 1: NMEA
76 + * 2: AT-capable modem port
77 + * 3: Modem interface
78 + * 4: NDIS
79 + */
80 + switch (ifnum) {
81 + case 0:
82 + dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n");
83 + break;
84 + case 1:
85 + dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n");
86 + break;
87 + case 2:
88 + case 3:
89 + dev_dbg(dev, "Quectel EC20 Modem port found\n");
90 + break;
91 + case 4:
92 + /* Don't claim the QMI/net interface */
93 + altsetting = -1;
94 + break;
95 + }
96 +
97 + return altsetting;
98 +}
99 +
100 static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
101 {
102 struct usb_host_interface *intf = serial->interface->cur_altsetting;
103 @@ -234,6 +268,11 @@ static int qcprobe(struct usb_serial *se
104 altsetting = -1;
105 break;
106 case QCSERIAL_G2K:
107 + if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) {
108 + altsetting = handle_quectel_ec20(dev, ifnum);
109 + goto done;
110 + }
111 +
112 /*
113 * Gobi 2K+ USB layout:
114 * 0: QMI/net