]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2024 14:09:20 +0000 (16:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2024 14:09:20 +0000 (16:09 +0200)
added patches:
revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch
serial-8250_omap-implementation-of-errata-i2310.patch
serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch
serial-core-introduce-uart_port_tx_limited_flags.patch
serial-imx-set-receiver-level-before-starting-uart.patch
tty-serial-8250-fix-port-count-mismatch-with-the-device.patch

queue-6.9/revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch [new file with mode: 0644]
queue-6.9/serial-8250_omap-implementation-of-errata-i2310.patch [new file with mode: 0644]
queue-6.9/serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch [new file with mode: 0644]
queue-6.9/serial-core-introduce-uart_port_tx_limited_flags.patch [new file with mode: 0644]
queue-6.9/serial-imx-set-receiver-level-before-starting-uart.patch [new file with mode: 0644]
queue-6.9/series
queue-6.9/tty-serial-8250-fix-port-count-mismatch-with-the-device.patch [new file with mode: 0644]

diff --git a/queue-6.9/revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch b/queue-6.9/revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch
new file mode 100644 (file)
index 0000000..c56c4fa
--- /dev/null
@@ -0,0 +1,37 @@
+From c5603e2a621dac10c5e21cc430848ebcfa6c7e01 Mon Sep 17 00:00:00 2001
+From: Doug Brown <doug@schmorgal.com>
+Date: Thu, 6 Jun 2024 12:56:31 -0700
+Subject: Revert "serial: core: only stop transmit when HW fifo is empty"
+
+From: Doug Brown <doug@schmorgal.com>
+
+commit c5603e2a621dac10c5e21cc430848ebcfa6c7e01 upstream.
+
+This reverts commit 7bfb915a597a301abb892f620fe5c283a9fdbd77.
+
+This commit broke pxa and omap-serial, because it inhibited them from
+calling stop_tx() if their TX FIFOs weren't completely empty. This
+resulted in these two drivers hanging during transmits because the TX
+interrupt would stay enabled, and a new TX interrupt would never fire.
+
+Cc: stable@vger.kernel.org
+Fixes: 7bfb915a597a ("serial: core: only stop transmit when HW fifo is empty")
+Signed-off-by: Doug Brown <doug@schmorgal.com>
+Link: https://lore.kernel.org/r/20240606195632.173255-2-doug@schmorgal.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/serial_core.h |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -789,8 +789,7 @@ enum UART_TX_FLAGS {
+       if (pending < WAKEUP_CHARS) {                                         \
+               uart_write_wakeup(__port);                                    \
+                                                                             \
+-              if (!((flags) & UART_TX_NOSTOP) && pending == 0 &&            \
+-                  __port->ops->tx_empty(__port))                            \
++              if (!((flags) & UART_TX_NOSTOP) && pending == 0)              \
+                       __port->ops->stop_tx(__port);                         \
+       }                                                                     \
+                                                                             \
diff --git a/queue-6.9/serial-8250_omap-implementation-of-errata-i2310.patch b/queue-6.9/serial-8250_omap-implementation-of-errata-i2310.patch
new file mode 100644 (file)
index 0000000..53085e6
--- /dev/null
@@ -0,0 +1,67 @@
+From 9d141c1e615795eeb93cd35501ad144ee997a826 Mon Sep 17 00:00:00 2001
+From: Udit Kumar <u-kumar1@ti.com>
+Date: Wed, 19 Jun 2024 16:29:03 +0530
+Subject: serial: 8250_omap: Implementation of Errata i2310
+
+From: Udit Kumar <u-kumar1@ti.com>
+
+commit 9d141c1e615795eeb93cd35501ad144ee997a826 upstream.
+
+As per Errata i2310[0], Erroneous timeout can be triggered,
+if this Erroneous interrupt is not cleared then it may leads
+to storm of interrupts, therefore apply Errata i2310 solution.
+
+[0] https://www.ti.com/lit/pdf/sprz536 page 23
+
+Fixes: b67e830d38fa ("serial: 8250: 8250_omap: Fix possible interrupt storm on K3 SoCs")
+Cc: stable@vger.kernel.org
+Signed-off-by: Udit Kumar <u-kumar1@ti.com>
+Link: https://lore.kernel.org/r/20240619105903.165434-1-u-kumar1@ti.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/8250/8250_omap.c |   25 ++++++++++++++++++++-----
+ 1 file changed, 20 insertions(+), 5 deletions(-)
+
+--- a/drivers/tty/serial/8250/8250_omap.c
++++ b/drivers/tty/serial/8250/8250_omap.c
+@@ -116,6 +116,10 @@
+ /* RX FIFO occupancy indicator */
+ #define UART_OMAP_RX_LVL              0x19
++/* Timeout low and High */
++#define UART_OMAP_TO_L                 0x26
++#define UART_OMAP_TO_H                 0x27
++
+ /*
+  * Copy of the genpd flags for the console.
+  * Only used if console suspend is disabled
+@@ -664,13 +668,24 @@ static irqreturn_t omap8250_irq(int irq,
+       /*
+        * On K3 SoCs, it is observed that RX TIMEOUT is signalled after
+-       * FIFO has been drained, in which case a dummy read of RX FIFO
+-       * is required to clear RX TIMEOUT condition.
++       * FIFO has been drained or erroneously.
++       * So apply solution of Errata i2310 as mentioned in
++       * https://www.ti.com/lit/pdf/sprz536
+        */
+       if (priv->habit & UART_RX_TIMEOUT_QUIRK &&
+-          (iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT &&
+-          serial_port_in(port, UART_OMAP_RX_LVL) == 0) {
+-              serial_port_in(port, UART_RX);
++              (iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) {
++              unsigned char efr2, timeout_h, timeout_l;
++
++              efr2 = serial_in(up, UART_OMAP_EFR2);
++              timeout_h = serial_in(up, UART_OMAP_TO_H);
++              timeout_l = serial_in(up, UART_OMAP_TO_L);
++              serial_out(up, UART_OMAP_TO_H, 0xFF);
++              serial_out(up, UART_OMAP_TO_L, 0xFF);
++              serial_out(up, UART_OMAP_EFR2, UART_OMAP_EFR2_TIMEOUT_BEHAVE);
++              serial_in(up, UART_IIR);
++              serial_out(up, UART_OMAP_EFR2, efr2);
++              serial_out(up, UART_OMAP_TO_H, timeout_h);
++              serial_out(up, UART_OMAP_TO_L, timeout_l);
+       }
+       /* Stop processing interrupts on input overrun */
diff --git a/queue-6.9/serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch b/queue-6.9/serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch
new file mode 100644 (file)
index 0000000..e774cb4
--- /dev/null
@@ -0,0 +1,48 @@
+From ea55c65dedf40e9c1911dc1e63e26bc9a59692b9 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski@gmail.com>
+Date: Thu, 6 Jun 2024 12:56:33 -0700
+Subject: serial: bcm63xx-uart: fix tx after conversion to uart_port_tx_limited()
+
+From: Jonas Gorski <jonas.gorski@gmail.com>
+
+commit ea55c65dedf40e9c1911dc1e63e26bc9a59692b9 upstream.
+
+When bcm63xx-uart was converted to uart_port_tx_limited(), it implicitly
+added a call to stop_tx(). This causes garbage to be put out on the
+serial console. To fix this, pass UART_TX_NOSTOP in flags, and manually
+call stop_tx() ourselves analogue to how a similar issue was fixed in
+commit 7be50f2e8f20 ("serial: mxs-auart: fix tx").
+
+Fixes: d11cc8c3c4b6 ("tty: serial: use uart_port_tx_limited()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+Signed-off-by: Doug Brown <doug@schmorgal.com>
+Link: https://lore.kernel.org/r/20240606195632.173255-4-doug@schmorgal.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/bcm63xx_uart.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/serial/bcm63xx_uart.c
++++ b/drivers/tty/serial/bcm63xx_uart.c
+@@ -308,8 +308,8 @@ static void bcm_uart_do_tx(struct uart_p
+       val = bcm_uart_readl(port, UART_MCTL_REG);
+       val = (val & UART_MCTL_TXFIFOFILL_MASK) >> UART_MCTL_TXFIFOFILL_SHIFT;
+-
+-      pending = uart_port_tx_limited(port, ch, port->fifosize - val,
++      pending = uart_port_tx_limited_flags(port, ch, UART_TX_NOSTOP,
++              port->fifosize - val,
+               true,
+               bcm_uart_writel(port, ch, UART_FIFO_REG),
+               ({}));
+@@ -320,6 +320,9 @@ static void bcm_uart_do_tx(struct uart_p
+       val = bcm_uart_readl(port, UART_IR_REG);
+       val &= ~UART_TX_INT_MASK;
+       bcm_uart_writel(port, val, UART_IR_REG);
++
++      if (uart_tx_stopped(port))
++              bcm_uart_stop_tx(port);
+ }
+ /*
diff --git a/queue-6.9/serial-core-introduce-uart_port_tx_limited_flags.patch b/queue-6.9/serial-core-introduce-uart_port_tx_limited_flags.patch
new file mode 100644 (file)
index 0000000..2a04527
--- /dev/null
@@ -0,0 +1,50 @@
+From 9bb43b9e8d9a288a214e9b17acc9e46fda3977cf Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski@gmail.com>
+Date: Thu, 6 Jun 2024 12:56:32 -0700
+Subject: serial: core: introduce uart_port_tx_limited_flags()
+
+From: Jonas Gorski <jonas.gorski@gmail.com>
+
+commit 9bb43b9e8d9a288a214e9b17acc9e46fda3977cf upstream.
+
+Analogue to uart_port_tx_flags() introduced in commit 3ee07964d407
+("serial: core: introduce uart_port_tx_flags()"), add a _flags variant
+for uart_port_tx_limited().
+
+Fixes: d11cc8c3c4b6 ("tty: serial: use uart_port_tx_limited()")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+Signed-off-by: Doug Brown <doug@schmorgal.com>
+Link: https://lore.kernel.org/r/20240606195632.173255-3-doug@schmorgal.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/serial_core.h |   18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -829,6 +829,24 @@ enum UART_TX_FLAGS {
+ })
+ /**
++ * uart_port_tx_limited_flags -- transmit helper for uart_port with count limiting with flags
++ * @port: uart port
++ * @ch: variable to store a character to be written to the HW
++ * @flags: %UART_TX_NOSTOP or similar
++ * @count: a limit of characters to send
++ * @tx_ready: can HW accept more data function
++ * @put_char: function to write a character
++ * @tx_done: function to call after the loop is done
++ *
++ * See uart_port_tx_limited() for more details.
++ */
++#define uart_port_tx_limited_flags(port, ch, flags, count, tx_ready, put_char, tx_done) ({ \
++      unsigned int __count = (count);                                                    \
++      __uart_port_tx(port, ch, flags, tx_ready, put_char, tx_done, __count,              \
++                      __count--);                                                        \
++})
++
++/**
+  * uart_port_tx -- transmit helper for uart_port
+  * @port: uart port
+  * @ch: variable to store a character to be written to the HW
diff --git a/queue-6.9/serial-imx-set-receiver-level-before-starting-uart.patch b/queue-6.9/serial-imx-set-receiver-level-before-starting-uart.patch
new file mode 100644 (file)
index 0000000..6598cbf
--- /dev/null
@@ -0,0 +1,37 @@
+From a81dbd0463eca317eee44985a66aa6cc2ce5c101 Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 21 Jun 2024 17:37:49 +0200
+Subject: serial: imx: set receiver level before starting uart
+
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+
+commit a81dbd0463eca317eee44985a66aa6cc2ce5c101 upstream.
+
+Set the receiver level to something > 0 before calling imx_uart_start_rx
+in rs485_config. This is necessary to avoid an interrupt storm that
+might prevent the system from booting. This was seen on an i.MX7 device
+when the rs485-rts-active-low property was active in the device tree.
+
+Fixes: 6d215f83e5fc ("serial: imx: warn user when using unsupported configuration")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Link: https://lore.kernel.org/r/20240621153829.183780-1-eichest@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/imx.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/imx.c
++++ b/drivers/tty/serial/imx.c
+@@ -1960,8 +1960,10 @@ static int imx_uart_rs485_config(struct
+       /* Make sure Rx is enabled in case Tx is active with Rx disabled */
+       if (!(rs485conf->flags & SER_RS485_ENABLED) ||
+-          rs485conf->flags & SER_RS485_RX_DURING_TX)
++          rs485conf->flags & SER_RS485_RX_DURING_TX) {
++              imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT);
+               imx_uart_start_rx(port);
++      }
+       return 0;
+ }
index 913c627fa48685f988116d970f658f943ea58f4d..d0a25ef86fb4b673f4a81e0632d9ed4eafd219c3 100644 (file)
@@ -153,3 +153,9 @@ revert-usb-gadget-u_ether-re-attach-netif-device-to-mirror-detachment.patch
 revert-usb-gadget-u_ether-replace-netif_stop_queue-with-netif_device_detach.patch
 usb-ucsi-stm32-fix-command-completion-handling.patch
 usb-dwc3-core-workaround-for-csr-read-timeout.patch
+revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch
+tty-serial-8250-fix-port-count-mismatch-with-the-device.patch
+serial-8250_omap-implementation-of-errata-i2310.patch
+serial-imx-set-receiver-level-before-starting-uart.patch
+serial-core-introduce-uart_port_tx_limited_flags.patch
+serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch
diff --git a/queue-6.9/tty-serial-8250-fix-port-count-mismatch-with-the-device.patch b/queue-6.9/tty-serial-8250-fix-port-count-mismatch-with-the-device.patch
new file mode 100644 (file)
index 0000000..669b680
--- /dev/null
@@ -0,0 +1,58 @@
+From 0ac18dac43103ab1df6d26ec9a781c0126f83ced Mon Sep 17 00:00:00 2001
+From: Crescent Hsieh <crescentcy.hsieh@moxa.com>
+Date: Mon, 17 Jun 2024 14:30:58 +0800
+Subject: tty: serial: 8250: Fix port count mismatch with the device
+
+From: Crescent Hsieh <crescentcy.hsieh@moxa.com>
+
+commit 0ac18dac43103ab1df6d26ec9a781c0126f83ced upstream.
+
+Normally, the number of ports is indicated by the third digit of the
+device ID on Moxa PCI serial boards. For example, `0x1121` indicates a
+device with 2 ports.
+
+However, `CP116E_A_A` and `CP116E_A_B` are exceptions; they have 8
+ports, but the third digit of the device ID is `6`.
+
+This patch introduces a function to retrieve the number of ports on Moxa
+PCI serial boards, addressing the issue described above.
+
+Fixes: 37058fd5d239 ("tty: serial: 8250: Add support for MOXA Mini PCIe boards")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Link: https://lore.kernel.org/r/20240617063058.18866-1-crescentcy.hsieh@moxa.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/8250/8250_pci.c |   13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/8250/8250_pci.c
++++ b/drivers/tty/serial/8250/8250_pci.c
+@@ -1985,6 +1985,17 @@ enum {
+       MOXA_SUPP_RS485 = BIT(2),
+ };
++static unsigned short moxa_get_nports(unsigned short device)
++{
++      switch (device) {
++      case PCI_DEVICE_ID_MOXA_CP116E_A_A:
++      case PCI_DEVICE_ID_MOXA_CP116E_A_B:
++              return 8;
++      }
++
++      return FIELD_GET(0x00F0, device);
++}
++
+ static bool pci_moxa_is_mini_pcie(unsigned short device)
+ {
+       if (device == PCI_DEVICE_ID_MOXA_CP102N ||
+@@ -2038,7 +2049,7 @@ static int pci_moxa_init(struct pci_dev
+ {
+       unsigned short device = dev->device;
+       resource_size_t iobar_addr = pci_resource_start(dev, 2);
+-      unsigned int num_ports = (device & 0x00F0) >> 4, i;
++      unsigned int i, num_ports = moxa_get_nports(device);
+       u8 val, init_mode = MOXA_RS232;
+       if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {