192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch 3.3 KB

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