From: Greg Kroah-Hartman Date: Mon, 8 Jun 2020 11:01:48 +0000 (+0200) Subject: 5.6-stable patches X-Git-Tag: v5.7.2~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0215bed394fd36e3badbae83a8ab5f30ce3b1dd;p=thirdparty%2Fkernel%2Fstable-queue.git 5.6-stable patches added patches: usb-serial-ch341-add-basis-for-quirk-detection.patch usb-serial-ch341-fix-lockup-of-devices-with-limited-prescaler.patch usb-serial-option-add-telit-le910c1-eux-compositions.patch usb-serial-qcserial-add-dw5816e-qdl-support.patch usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch --- diff --git a/queue-5.6/series b/queue-5.6/series index 8384715f3d9..718c68fc15e 100644 --- a/queue-5.6/series +++ b/queue-5.6/series @@ -15,3 +15,8 @@ net-dsa-felix-send-vlans-on-cpu-port-as-egress-tagged.patch mptcp-fix-unblocking-connect.patch net-sched-fix-infinite-loop-in-sch_fq_pie.patch net-mlx5e-replace-einval-in-mlx5e_flower_parse_meta.patch +usb-serial-qcserial-add-dw5816e-qdl-support.patch +usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch +usb-serial-option-add-telit-le910c1-eux-compositions.patch +usb-serial-ch341-add-basis-for-quirk-detection.patch +usb-serial-ch341-fix-lockup-of-devices-with-limited-prescaler.patch diff --git a/queue-5.6/usb-serial-ch341-add-basis-for-quirk-detection.patch b/queue-5.6/usb-serial-ch341-add-basis-for-quirk-detection.patch new file mode 100644 index 00000000000..386c56928a1 --- /dev/null +++ b/queue-5.6/usb-serial-ch341-add-basis-for-quirk-detection.patch @@ -0,0 +1,106 @@ +From c404bf4aa9236cb4d1068e499ae42acf48a6ff97 Mon Sep 17 00:00:00 2001 +From: Michael Hanselmann +Date: Tue, 31 Mar 2020 23:37:18 +0000 +Subject: USB: serial: ch341: add basis for quirk detection + +From: Michael Hanselmann + +commit c404bf4aa9236cb4d1068e499ae42acf48a6ff97 upstream. + +A subset of CH341 devices does not support all features, namely the +prescaler is limited to a reduced precision and there is no support for +sending a RS232 break condition. This patch adds a detection function +which will be extended to set quirk flags as they're implemented. + +The author's affected device has an imprint of "340" on the +turquoise-colored plug, but not all such devices appear to be affected. + +Signed-off-by: Michael Hanselmann +Link: https://lore.kernel.org/r/1e1ae0da6082bb528a44ef323d4e1d3733d38858.1585697281.git.public@hansmi.ch +[ johan: use long type for quirks; rephrase and use port device for + messages; handle short reads; set quirk flags directly in + helper function ] +Cc: stable # 5.5 +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/ch341.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 53 insertions(+) + +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -87,6 +87,7 @@ struct ch341_private { + u8 mcr; + u8 msr; + u8 lcr; ++ unsigned long quirks; + }; + + static void ch341_set_termios(struct tty_struct *tty, +@@ -308,6 +309,53 @@ out: kfree(buffer); + return r; + } + ++static int ch341_detect_quirks(struct usb_serial_port *port) ++{ ++ struct ch341_private *priv = usb_get_serial_port_data(port); ++ struct usb_device *udev = port->serial->dev; ++ const unsigned int size = 2; ++ unsigned long quirks = 0; ++ char *buffer; ++ int r; ++ ++ buffer = kmalloc(size, GFP_KERNEL); ++ if (!buffer) ++ return -ENOMEM; ++ ++ /* ++ * A subset of CH34x devices does not support all features. The ++ * prescaler is limited and there is no support for sending a RS232 ++ * break condition. A read failure when trying to set up the latter is ++ * used to detect these devices. ++ */ ++ r = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), CH341_REQ_READ_REG, ++ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, ++ CH341_REG_BREAK, 0, buffer, size, DEFAULT_TIMEOUT); ++ if (r == -EPIPE) { ++ dev_dbg(&port->dev, "break control not supported\n"); ++ r = 0; ++ goto out; ++ } ++ ++ if (r != size) { ++ if (r >= 0) ++ r = -EIO; ++ dev_err(&port->dev, "failed to read break control: %d\n", r); ++ goto out; ++ } ++ ++ r = 0; ++out: ++ kfree(buffer); ++ ++ if (quirks) { ++ dev_dbg(&port->dev, "enabling quirk flags: 0x%02lx\n", quirks); ++ priv->quirks |= quirks; ++ } ++ ++ return r; ++} ++ + static int ch341_port_probe(struct usb_serial_port *port) + { + struct ch341_private *priv; +@@ -330,6 +378,11 @@ static int ch341_port_probe(struct usb_s + goto error; + + usb_set_serial_port_data(port, priv); ++ ++ r = ch341_detect_quirks(port); ++ if (r < 0) ++ goto error; ++ + return 0; + + error: kfree(priv); diff --git a/queue-5.6/usb-serial-ch341-fix-lockup-of-devices-with-limited-prescaler.patch b/queue-5.6/usb-serial-ch341-fix-lockup-of-devices-with-limited-prescaler.patch new file mode 100644 index 00000000000..4f008e13d40 --- /dev/null +++ b/queue-5.6/usb-serial-ch341-fix-lockup-of-devices-with-limited-prescaler.patch @@ -0,0 +1,87 @@ +From c432df155919582a3cefa35a8f86256c830fa9a4 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 14 May 2020 11:36:45 +0200 +Subject: USB: serial: ch341: fix lockup of devices with limited prescaler + +From: Johan Hovold + +commit c432df155919582a3cefa35a8f86256c830fa9a4 upstream. + +Michael Hanselmann reports that + + [a] subset of all CH341 devices stop responding to bulk + transfers, usually after the third byte, when the highest + prescaler bit (0b100) is set. There is one exception, namely a + prescaler of exactly 0b111 (fact=1, ps=3). + +Fix this by forcing a lower base clock (fact = 0) whenever needed. + +This specifically makes the standard rates 110, 134 and 200 bps work +again with these devices. + +Fixes: 35714565089e ("USB: serial: ch341: reimplement line-speed handling") +Cc: stable # 5.5 +Reported-by: Michael Hanselmann +Link: https://lore.kernel.org/r/20200514141743.GE25962@localhost +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/ch341.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -73,6 +73,8 @@ + #define CH341_LCR_CS6 0x01 + #define CH341_LCR_CS5 0x00 + ++#define CH341_QUIRK_LIMITED_PRESCALER BIT(0) ++ + static const struct usb_device_id id_table[] = { + { USB_DEVICE(0x4348, 0x5523) }, + { USB_DEVICE(0x1a86, 0x7523) }, +@@ -160,9 +162,11 @@ static const speed_t ch341_min_rates[] = + * 2 <= div <= 256 if fact = 0, or + * 9 <= div <= 256 if fact = 1 + */ +-static int ch341_get_divisor(speed_t speed) ++static int ch341_get_divisor(struct ch341_private *priv) + { + unsigned int fact, div, clk_div; ++ speed_t speed = priv->baud_rate; ++ bool force_fact0 = false; + int ps; + + /* +@@ -188,8 +192,12 @@ static int ch341_get_divisor(speed_t spe + clk_div = CH341_CLK_DIV(ps, fact); + div = CH341_CLKRATE / (clk_div * speed); + ++ /* Some devices require a lower base clock if ps < 3. */ ++ if (ps < 3 && (priv->quirks & CH341_QUIRK_LIMITED_PRESCALER)) ++ force_fact0 = true; ++ + /* Halve base clock (fact = 0) if required. */ +- if (div < 9 || div > 255) { ++ if (div < 9 || div > 255 || force_fact0) { + div /= 2; + clk_div *= 2; + fact = 0; +@@ -228,7 +236,7 @@ static int ch341_set_baudrate_lcr(struct + if (!priv->baud_rate) + return -EINVAL; + +- val = ch341_get_divisor(priv->baud_rate); ++ val = ch341_get_divisor(priv); + if (val < 0) + return -EINVAL; + +@@ -333,6 +341,7 @@ static int ch341_detect_quirks(struct us + CH341_REG_BREAK, 0, buffer, size, DEFAULT_TIMEOUT); + if (r == -EPIPE) { + dev_dbg(&port->dev, "break control not supported\n"); ++ quirks = CH341_QUIRK_LIMITED_PRESCALER; + r = 0; + goto out; + } diff --git a/queue-5.6/usb-serial-option-add-telit-le910c1-eux-compositions.patch b/queue-5.6/usb-serial-option-add-telit-le910c1-eux-compositions.patch new file mode 100644 index 00000000000..93433b71b67 --- /dev/null +++ b/queue-5.6/usb-serial-option-add-telit-le910c1-eux-compositions.patch @@ -0,0 +1,37 @@ +From 399ad9477c523f721f8e51d4f824bdf7267f120c Mon Sep 17 00:00:00 2001 +From: Daniele Palmas +Date: Mon, 25 May 2020 23:11:06 +0200 +Subject: USB: serial: option: add Telit LE910C1-EUX compositions + +From: Daniele Palmas + +commit 399ad9477c523f721f8e51d4f824bdf7267f120c upstream. + +Add Telit LE910C1-EUX compositions: + + 0x1031: tty, tty, tty, rmnet + 0x1033: tty, tty, tty, ecm + +Signed-off-by: Daniele Palmas +Link: https://lore.kernel.org/r/20200525211106.27338-1-dnlplm@gmail.com +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/option.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1157,6 +1157,10 @@ static const struct usb_device_id option + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1031, 0xff), /* Telit LE910C1-EUX */ ++ .driver_info = NCTRL(0) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1033, 0xff), /* Telit LE910C1-EUX (ECM) */ ++ .driver_info = NCTRL(0) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0), + .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1), diff --git a/queue-5.6/usb-serial-qcserial-add-dw5816e-qdl-support.patch b/queue-5.6/usb-serial-qcserial-add-dw5816e-qdl-support.patch new file mode 100644 index 00000000000..cbcee93e56d --- /dev/null +++ b/queue-5.6/usb-serial-qcserial-add-dw5816e-qdl-support.patch @@ -0,0 +1,33 @@ +From 3429444abdd9dbd5faebd9bee552ec6162b17ad6 Mon Sep 17 00:00:00 2001 +From: Matt Jolly +Date: Thu, 21 May 2020 10:43:58 +1000 +Subject: USB: serial: qcserial: add DW5816e QDL support + +From: Matt Jolly + +commit 3429444abdd9dbd5faebd9bee552ec6162b17ad6 upstream. + +Add support for Dell Wireless 5816e Download Mode (AKA boot & hold mode / +QDL download mode) to drivers/usb/serial/qcserial.c + +This is required to update device firmware. + +Signed-off-by: Matt Jolly +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/qcserial.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -173,6 +173,7 @@ static const struct usb_device_id id_tab + {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ + {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */ + {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */ ++ {DEVICE_SWI(0x413c, 0x81cb)}, /* Dell Wireless 5816e QDL */ + {DEVICE_SWI(0x413c, 0x81cc)}, /* Dell Wireless 5816e */ + {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */ + {DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */ diff --git a/queue-5.6/usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch b/queue-5.6/usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch new file mode 100644 index 00000000000..1e1cb01bce9 --- /dev/null +++ b/queue-5.6/usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch @@ -0,0 +1,36 @@ +From 986c1748c84d7727defeaeca74a73b37f7d5cce1 Mon Sep 17 00:00:00 2001 +From: Bin Liu +Date: Wed, 13 May 2020 16:36:46 -0500 +Subject: USB: serial: usb_wwan: do not resubmit rx urb on fatal errors + +From: Bin Liu + +commit 986c1748c84d7727defeaeca74a73b37f7d5cce1 upstream. + +usb_wwan_indat_callback() shouldn't resubmit rx urb if the previous urb +status is a fatal error. Or the usb controller would keep processing the +new urbs then run into interrupt storm, and has no chance to recover. + +Fixes: 6c1ee66a0b2b ("USB-Serial: Fix error handling of usb_wwan") +Cc: stable@vger.kernel.org +Signed-off-by: Bin Liu +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/usb_wwan.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/serial/usb_wwan.c ++++ b/drivers/usb/serial/usb_wwan.c +@@ -270,6 +270,10 @@ static void usb_wwan_indat_callback(stru + if (status) { + dev_dbg(dev, "%s: nonzero status: %d on endpoint %02x.\n", + __func__, status, endpoint); ++ ++ /* don't resubmit on fatal errors */ ++ if (status == -ESHUTDOWN || status == -ENOENT) ++ return; + } else { + if (urb->actual_length) { + tty_insert_flip_string(&port->port, data,