From 058275197bbd3734e923aaabe58cab61cc291634 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 21 Nov 2015 21:25:54 +0000 Subject: [PATCH] kernel/generic: 3.18, 4.y: Add support for Quectel EC20 Mini PCIe module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * both patches (qcserial/qmi_wwan) were submitted upstream[1,2] * build tested on 3.18 and 4.1 * run tested on imx6 platform with 4.1 1. http://article.gmane.org/gmane.linux.usb.general/132998 2. http://article.gmane.org/gmane.linux.usb.general/133113 Signed-off-by: Petr Štetiar SVN-Revision: 47567 --- ...-support-for-Quectel-EC20-Mini-PCIe-.patch | 119 ++++++++++++++++++ ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 101 +++++++++++++++ ...-support-for-Quectel-EC20-Mini-PCIe-.patch | 119 ++++++++++++++++++ ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 101 +++++++++++++++ ...-support-for-Quectel-EC20-Mini-PCIe-.patch | 119 ++++++++++++++++++ ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 101 +++++++++++++++ 6 files changed, 660 insertions(+) create mode 100644 target/linux/generic/patches-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch create mode 100644 target/linux/generic/patches-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch create mode 100644 target/linux/generic/patches-4.1/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch create mode 100644 target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch create mode 100644 target/linux/generic/patches-4.3/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch create mode 100644 target/linux/generic/patches-4.3/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch diff --git a/target/linux/generic/patches-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch b/target/linux/generic/patches-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch new file mode 100644 index 0000000000..f56941cbb8 --- /dev/null +++ b/target/linux/generic/patches-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch @@ -0,0 +1,119 @@ +From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Tue, 3 Nov 2015 11:01:42 +0100 +Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It seems like this device has same vendor and product IDs as G2K +devices, but it has different number of interfaces(4 vs 5) and also +different interface layout which makes it currently unusable: + + usbcore: registered new interface driver qcserial + usbserial: USB Serial support registered for Qualcomm USB modem + usb 2-1.2: unknown number of interfaces: 5 + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index ebcec8c..d462132 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -22,6 +22,8 @@ + #define DRIVER_AUTHOR "Qualcomm Inc" + #define DRIVER_DESC "Qualcomm USB Serial driver" + ++#define QUECTEL_EC20_IDPRODUCT 0x9215 ++ + /* standard device layouts supported by this driver */ + enum qcserial_layouts { + QCSERIAL_G2K = 0, /* Gobi 2000 */ +@@ -167,6 +169,38 @@ static const struct usb_device_id id_table[] = { + }; + MODULE_DEVICE_TABLE(usb, id_table); + ++static int handle_quectel_ec20(struct device *dev, int ifnum) ++{ ++ int altsetting = 0; ++ ++ /* ++ * Quectel EC20 Mini PCIe LTE module layout: ++ * 0: DM/DIAG (use libqcdm from ModemManager for communication) ++ * 1: NMEA ++ * 2: AT-capable modem port ++ * 3: Modem interface ++ * 4: NDIS ++ */ ++ switch (ifnum) { ++ case 0: ++ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); ++ break; ++ case 1: ++ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); ++ break; ++ case 2: ++ case 3: ++ dev_dbg(dev, "Quectel EC20 Modem port found\n"); ++ break; ++ case 4: ++ /* Don't claim the QMI/net interface */ ++ altsetting = -1; ++ break; ++ } ++ ++ return altsetting; ++} ++ + static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + { + struct usb_host_interface *intf = serial->interface->cur_altsetting; +@@ -235,6 +269,11 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + altsetting = -1; + break; + case QCSERIAL_G2K: ++ if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { ++ altsetting = handle_quectel_ec20(dev, ifnum); ++ goto done; ++ } ++ + /* + * Gobi 2K+ USB layout: + * 0: QMI/net +-- +1.7.9.5 + diff --git a/target/linux/generic/patches-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/patches-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch new file mode 100644 index 0000000000..3b08571361 --- /dev/null +++ b/target/linux/generic/patches-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch @@ -0,0 +1,101 @@ +From fe29727caa7fe434fcb3166df2a62672bc516b54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Wed, 4 Nov 2015 16:23:37 +0100 +Subject: [PATCH 2/2] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This device has same vendor and product IDs as G2K devices, but it has +different number of interfaces(4 vs 5) and also different interface +layout where EC20 has QMI on interface 4 instead of 0. + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/net/usb/qmi_wwan.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 2a7c1be..b81a32c 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -822,6 +822,7 @@ static const struct usb_device_id products[] = { + {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ + {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ ++ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */ + {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ +@@ -853,10 +854,24 @@ static const struct usb_device_id products[] = { + }; + MODULE_DEVICE_TABLE(usb, products); + ++static bool quectel_ec20_detected(struct usb_interface *intf) ++{ ++ struct usb_device *dev = interface_to_usbdev(intf); ++ ++ if (dev->actconfig && ++ le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && ++ le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && ++ dev->actconfig->desc.bNumInterfaces == 5) ++ return true; ++ ++ return false; ++} ++ + static int qmi_wwan_probe(struct usb_interface *intf, + const struct usb_device_id *prod) + { + struct usb_device_id *id = (struct usb_device_id *)prod; ++ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; + + /* Workaround to enable dynamic IDs. This disables usbnet + * blacklisting functionality. Which, if required, can be +@@ -868,6 +883,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, + id->driver_info = (unsigned long)&qmi_wwan_info; + } + ++ /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ ++ if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { ++ dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); ++ return -ENODEV; ++ } ++ + return usbnet_probe(intf, id); + } + +-- +1.7.9.5 + diff --git a/target/linux/generic/patches-4.1/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch b/target/linux/generic/patches-4.1/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch new file mode 100644 index 0000000000..f56941cbb8 --- /dev/null +++ b/target/linux/generic/patches-4.1/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch @@ -0,0 +1,119 @@ +From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Tue, 3 Nov 2015 11:01:42 +0100 +Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It seems like this device has same vendor and product IDs as G2K +devices, but it has different number of interfaces(4 vs 5) and also +different interface layout which makes it currently unusable: + + usbcore: registered new interface driver qcserial + usbserial: USB Serial support registered for Qualcomm USB modem + usb 2-1.2: unknown number of interfaces: 5 + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index ebcec8c..d462132 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -22,6 +22,8 @@ + #define DRIVER_AUTHOR "Qualcomm Inc" + #define DRIVER_DESC "Qualcomm USB Serial driver" + ++#define QUECTEL_EC20_IDPRODUCT 0x9215 ++ + /* standard device layouts supported by this driver */ + enum qcserial_layouts { + QCSERIAL_G2K = 0, /* Gobi 2000 */ +@@ -167,6 +169,38 @@ static const struct usb_device_id id_table[] = { + }; + MODULE_DEVICE_TABLE(usb, id_table); + ++static int handle_quectel_ec20(struct device *dev, int ifnum) ++{ ++ int altsetting = 0; ++ ++ /* ++ * Quectel EC20 Mini PCIe LTE module layout: ++ * 0: DM/DIAG (use libqcdm from ModemManager for communication) ++ * 1: NMEA ++ * 2: AT-capable modem port ++ * 3: Modem interface ++ * 4: NDIS ++ */ ++ switch (ifnum) { ++ case 0: ++ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); ++ break; ++ case 1: ++ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); ++ break; ++ case 2: ++ case 3: ++ dev_dbg(dev, "Quectel EC20 Modem port found\n"); ++ break; ++ case 4: ++ /* Don't claim the QMI/net interface */ ++ altsetting = -1; ++ break; ++ } ++ ++ return altsetting; ++} ++ + static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + { + struct usb_host_interface *intf = serial->interface->cur_altsetting; +@@ -235,6 +269,11 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + altsetting = -1; + break; + case QCSERIAL_G2K: ++ if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { ++ altsetting = handle_quectel_ec20(dev, ifnum); ++ goto done; ++ } ++ + /* + * Gobi 2K+ USB layout: + * 0: QMI/net +-- +1.7.9.5 + diff --git a/target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch new file mode 100644 index 0000000000..3b08571361 --- /dev/null +++ b/target/linux/generic/patches-4.1/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch @@ -0,0 +1,101 @@ +From fe29727caa7fe434fcb3166df2a62672bc516b54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Wed, 4 Nov 2015 16:23:37 +0100 +Subject: [PATCH 2/2] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This device has same vendor and product IDs as G2K devices, but it has +different number of interfaces(4 vs 5) and also different interface +layout where EC20 has QMI on interface 4 instead of 0. + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/net/usb/qmi_wwan.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 2a7c1be..b81a32c 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -822,6 +822,7 @@ static const struct usb_device_id products[] = { + {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ + {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ ++ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */ + {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ +@@ -853,10 +854,24 @@ static const struct usb_device_id products[] = { + }; + MODULE_DEVICE_TABLE(usb, products); + ++static bool quectel_ec20_detected(struct usb_interface *intf) ++{ ++ struct usb_device *dev = interface_to_usbdev(intf); ++ ++ if (dev->actconfig && ++ le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && ++ le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && ++ dev->actconfig->desc.bNumInterfaces == 5) ++ return true; ++ ++ return false; ++} ++ + static int qmi_wwan_probe(struct usb_interface *intf, + const struct usb_device_id *prod) + { + struct usb_device_id *id = (struct usb_device_id *)prod; ++ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; + + /* Workaround to enable dynamic IDs. This disables usbnet + * blacklisting functionality. Which, if required, can be +@@ -868,6 +883,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, + id->driver_info = (unsigned long)&qmi_wwan_info; + } + ++ /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ ++ if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { ++ dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); ++ return -ENODEV; ++ } ++ + return usbnet_probe(intf, id); + } + +-- +1.7.9.5 + diff --git a/target/linux/generic/patches-4.3/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch b/target/linux/generic/patches-4.3/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch new file mode 100644 index 0000000000..f56941cbb8 --- /dev/null +++ b/target/linux/generic/patches-4.3/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch @@ -0,0 +1,119 @@ +From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Tue, 3 Nov 2015 11:01:42 +0100 +Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It seems like this device has same vendor and product IDs as G2K +devices, but it has different number of interfaces(4 vs 5) and also +different interface layout which makes it currently unusable: + + usbcore: registered new interface driver qcserial + usbserial: USB Serial support registered for Qualcomm USB modem + usb 2-1.2: unknown number of interfaces: 5 + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index ebcec8c..d462132 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -22,6 +22,8 @@ + #define DRIVER_AUTHOR "Qualcomm Inc" + #define DRIVER_DESC "Qualcomm USB Serial driver" + ++#define QUECTEL_EC20_IDPRODUCT 0x9215 ++ + /* standard device layouts supported by this driver */ + enum qcserial_layouts { + QCSERIAL_G2K = 0, /* Gobi 2000 */ +@@ -167,6 +169,38 @@ static const struct usb_device_id id_table[] = { + }; + MODULE_DEVICE_TABLE(usb, id_table); + ++static int handle_quectel_ec20(struct device *dev, int ifnum) ++{ ++ int altsetting = 0; ++ ++ /* ++ * Quectel EC20 Mini PCIe LTE module layout: ++ * 0: DM/DIAG (use libqcdm from ModemManager for communication) ++ * 1: NMEA ++ * 2: AT-capable modem port ++ * 3: Modem interface ++ * 4: NDIS ++ */ ++ switch (ifnum) { ++ case 0: ++ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); ++ break; ++ case 1: ++ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); ++ break; ++ case 2: ++ case 3: ++ dev_dbg(dev, "Quectel EC20 Modem port found\n"); ++ break; ++ case 4: ++ /* Don't claim the QMI/net interface */ ++ altsetting = -1; ++ break; ++ } ++ ++ return altsetting; ++} ++ + static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + { + struct usb_host_interface *intf = serial->interface->cur_altsetting; +@@ -235,6 +269,11 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) + altsetting = -1; + break; + case QCSERIAL_G2K: ++ if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { ++ altsetting = handle_quectel_ec20(dev, ifnum); ++ goto done; ++ } ++ + /* + * Gobi 2K+ USB layout: + * 0: QMI/net +-- +1.7.9.5 + diff --git a/target/linux/generic/patches-4.3/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/patches-4.3/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch new file mode 100644 index 0000000000..3b08571361 --- /dev/null +++ b/target/linux/generic/patches-4.3/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch @@ -0,0 +1,101 @@ +From fe29727caa7fe434fcb3166df2a62672bc516b54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Wed, 4 Nov 2015 16:23:37 +0100 +Subject: [PATCH 2/2] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe + module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This device has same vendor and product IDs as G2K devices, but it has +different number of interfaces(4 vs 5) and also different interface +layout where EC20 has QMI on interface 4 instead of 0. + +lsusb output: + + Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 + Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 (Defined at Interface level) + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x05c6 Qualcomm, Inc. + idProduct 0x9215 Acer Gobi 2000 Wireless Modem + bcdDevice 2.32 + iManufacturer 1 Quectel + iProduct 2 Quectel LTE Module + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 209 + bNumInterfaces 5 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xa0 + (Bus Powered) + Remote Wakeup + MaxPower 500mA + +Signed-off-by: Petr Štetiar +--- + drivers/net/usb/qmi_wwan.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 2a7c1be..b81a32c 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -822,6 +822,7 @@ static const struct usb_device_id products[] = { + {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ + {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ ++ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */ + {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ + {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ +@@ -853,10 +854,24 @@ static const struct usb_device_id products[] = { + }; + MODULE_DEVICE_TABLE(usb, products); + ++static bool quectel_ec20_detected(struct usb_interface *intf) ++{ ++ struct usb_device *dev = interface_to_usbdev(intf); ++ ++ if (dev->actconfig && ++ le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && ++ le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && ++ dev->actconfig->desc.bNumInterfaces == 5) ++ return true; ++ ++ return false; ++} ++ + static int qmi_wwan_probe(struct usb_interface *intf, + const struct usb_device_id *prod) + { + struct usb_device_id *id = (struct usb_device_id *)prod; ++ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; + + /* Workaround to enable dynamic IDs. This disables usbnet + * blacklisting functionality. Which, if required, can be +@@ -868,6 +883,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, + id->driver_info = (unsigned long)&qmi_wwan_info; + } + ++ /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ ++ if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { ++ dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); ++ return -ENODEV; ++ } ++ + return usbnet_probe(intf, id); + } + +-- +1.7.9.5 +