193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From fe29727caa7fe434fcb3166df2a62672bc516b54 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
  3. Date: Wed, 4 Nov 2015 16:23:37 +0100
  4. Subject: [PATCH 2/2] USB: qmi_wwan: Add quirk 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. This device has same vendor and product IDs as G2K devices, but it has
  10. different number of interfaces(4 vs 5) and also different interface
  11. layout where EC20 has QMI on interface 4 instead of 0.
  12. lsusb output:
  13. Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000
  14. Device Descriptor:
  15. bLength 18
  16. bDescriptorType 1
  17. bcdUSB 2.00
  18. bDeviceClass 0 (Defined at Interface level)
  19. bDeviceSubClass 0
  20. bDeviceProtocol 0
  21. bMaxPacketSize0 64
  22. idVendor 0x05c6 Qualcomm, Inc.
  23. idProduct 0x9215 Acer Gobi 2000 Wireless Modem
  24. bcdDevice 2.32
  25. iManufacturer 1 Quectel
  26. iProduct 2 Quectel LTE Module
  27. iSerial 0
  28. bNumConfigurations 1
  29. Configuration Descriptor:
  30. bLength 9
  31. bDescriptorType 2
  32. wTotalLength 209
  33. bNumInterfaces 5
  34. bConfigurationValue 1
  35. iConfiguration 0
  36. bmAttributes 0xa0
  37. (Bus Powered)
  38. Remote Wakeup
  39. MaxPower 500mA
  40. Signed-off-by: Petr Štetiar <ynezz@true.cz>
  41. ---
  42. drivers/net/usb/qmi_wwan.c | 21 +++++++++++++++++++++
  43. 1 file changed, 21 insertions(+)
  44. --- a/drivers/net/usb/qmi_wwan.c
  45. +++ b/drivers/net/usb/qmi_wwan.c
  46. @@ -822,6 +822,7 @@ static const struct usb_device_id produc
  47. {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
  48. {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
  49. {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
  50. + {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */
  51. {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
  52. {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
  53. {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
  54. @@ -853,10 +854,24 @@ static const struct usb_device_id produc
  55. };
  56. MODULE_DEVICE_TABLE(usb, products);
  57. +static bool quectel_ec20_detected(struct usb_interface *intf)
  58. +{
  59. + struct usb_device *dev = interface_to_usbdev(intf);
  60. +
  61. + if (dev->actconfig &&
  62. + le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 &&
  63. + le16_to_cpu(dev->descriptor.idProduct) == 0x9215 &&
  64. + dev->actconfig->desc.bNumInterfaces == 5)
  65. + return true;
  66. +
  67. + return false;
  68. +}
  69. +
  70. static int qmi_wwan_probe(struct usb_interface *intf,
  71. const struct usb_device_id *prod)
  72. {
  73. struct usb_device_id *id = (struct usb_device_id *)prod;
  74. + struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
  75. /* Workaround to enable dynamic IDs. This disables usbnet
  76. * blacklisting functionality. Which, if required, can be
  77. @@ -868,6 +883,12 @@ static int qmi_wwan_probe(struct usb_int
  78. id->driver_info = (unsigned long)&qmi_wwan_info;
  79. }
  80. + /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */
  81. + if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) {
  82. + dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n");
  83. + return -ENODEV;
  84. + }
  85. +
  86. return usbnet_probe(intf, id);
  87. }