f56941cbb8fc724d3829bca9aa94d06988e34349
[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 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
54 index ebcec8c..d462132 100644
55 --- a/drivers/usb/serial/qcserial.c
56 +++ b/drivers/usb/serial/qcserial.c
57 @@ -22,6 +22,8 @@
58 #define DRIVER_AUTHOR "Qualcomm Inc"
59 #define DRIVER_DESC "Qualcomm USB Serial driver"
60
61 +#define QUECTEL_EC20_IDPRODUCT 0x9215
62 +
63 /* standard device layouts supported by this driver */
64 enum qcserial_layouts {
65 QCSERIAL_G2K = 0, /* Gobi 2000 */
66 @@ -167,6 +169,38 @@ static const struct usb_device_id id_table[] = {
67 };
68 MODULE_DEVICE_TABLE(usb, id_table);
69
70 +static int handle_quectel_ec20(struct device *dev, int ifnum)
71 +{
72 + int altsetting = 0;
73 +
74 + /*
75 + * Quectel EC20 Mini PCIe LTE module layout:
76 + * 0: DM/DIAG (use libqcdm from ModemManager for communication)
77 + * 1: NMEA
78 + * 2: AT-capable modem port
79 + * 3: Modem interface
80 + * 4: NDIS
81 + */
82 + switch (ifnum) {
83 + case 0:
84 + dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n");
85 + break;
86 + case 1:
87 + dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n");
88 + break;
89 + case 2:
90 + case 3:
91 + dev_dbg(dev, "Quectel EC20 Modem port found\n");
92 + break;
93 + case 4:
94 + /* Don't claim the QMI/net interface */
95 + altsetting = -1;
96 + break;
97 + }
98 +
99 + return altsetting;
100 +}
101 +
102 static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
103 {
104 struct usb_host_interface *intf = serial->interface->cur_altsetting;
105 @@ -235,6 +269,11 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
106 altsetting = -1;
107 break;
108 case QCSERIAL_G2K:
109 + if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) {
110 + altsetting = handle_quectel_ec20(dev, ifnum);
111 + goto done;
112 + }
113 +
114 /*
115 * Gobi 2K+ USB layout:
116 * 0: QMI/net
117 --
118 1.7.9.5
119