Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

qmi_wwan: add support for Quectel EC21 and EC25

The Quectel EC21 and EC25 need the same "set DTR" request as devices
based on the MDM9230 chipset, but has no USB3 support. Our best guess
is that the "set DTR" functionality depends on chipset and/or
baseband firmware generation. But USB3 is still an optional feature.

Since we cannot enable this unconditionally for all older devices, and
there doesn't appear to be anything we can use in the USB descriptors
to identify these chips, we are forced to use a device specific quirk
flag.

Reported-and-tested-by: Sebastian Sjoholm <sebastian.sjoholm@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Bjørn Mork and committed by
David S. Miller
9a765881 4013bee5

+28 -2
+28 -2
drivers/net/usb/qmi_wwan.c
··· 59 59 QMI_WWAN_FLAG_RAWIP = 1 << 0, 60 60 }; 61 61 62 + enum qmi_wwan_quirks { 63 + QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */ 64 + }; 65 + 62 66 static void qmi_wwan_netdev_setup(struct net_device *net) 63 67 { 64 68 struct usbnet *dev = netdev_priv(net); ··· 415 411 * clearing out state the clients might need. 416 412 * 417 413 * MDM9x30 is the first QMI chipset with USB3 support. Abuse 418 - * this fact to enable the quirk. 414 + * this fact to enable the quirk for all USB3 devices. 415 + * 416 + * There are also chipsets with the same "set DTR" requirement 417 + * but without USB3 support. Devices based on these chips 418 + * need a quirk flag in the device ID table. 419 419 */ 420 - if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) { 420 + if (dev->driver_info->data & QMI_WWAN_QUIRK_DTR || 421 + le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) { 421 422 qmi_wwan_manage_power(dev, 1); 422 423 qmi_wwan_change_dtr(dev, true); 423 424 } ··· 535 526 .rx_fixup = qmi_wwan_rx_fixup, 536 527 }; 537 528 529 + static const struct driver_info qmi_wwan_info_quirk_dtr = { 530 + .description = "WWAN/QMI device", 531 + .flags = FLAG_WWAN, 532 + .bind = qmi_wwan_bind, 533 + .unbind = qmi_wwan_unbind, 534 + .manage_power = qmi_wwan_manage_power, 535 + .rx_fixup = qmi_wwan_rx_fixup, 536 + .data = QMI_WWAN_QUIRK_DTR, 537 + }; 538 + 538 539 #define HUAWEI_VENDOR_ID 0x12D1 539 540 540 541 /* map QMI/wwan function by a fixed interface number */ 541 542 #define QMI_FIXED_INTF(vend, prod, num) \ 542 543 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ 543 544 .driver_info = (unsigned long)&qmi_wwan_info 545 + 546 + /* devices requiring "set DTR" quirk */ 547 + #define QMI_QUIRK_SET_DTR(vend, prod, num) \ 548 + USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ 549 + .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr 544 550 545 551 /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ 546 552 #define QMI_GOBI1K_DEVICE(vend, prod) \ ··· 919 895 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ 920 896 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ 921 897 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ 898 + {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ 899 + {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */ 922 900 923 901 /* 4. Gobi 1000 devices */ 924 902 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */