From: Greg Kroah-Hartman Date: Mon, 1 Jul 2024 14:09:08 +0000 (+0200) Subject: 6.6-stable patches X-Git-Tag: v4.19.317~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f9b8a8434f02cbbfd735de053f68440ef3f2f7d;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches 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 --- diff --git a/queue-6.6/revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch b/queue-6.6/revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch new file mode 100644 index 00000000000..271740fe29c --- /dev/null +++ b/queue-6.6/revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.patch @@ -0,0 +1,37 @@ +From c5603e2a621dac10c5e21cc430848ebcfa6c7e01 Mon Sep 17 00:00:00 2001 +From: Doug Brown +Date: Thu, 6 Jun 2024 12:56:31 -0700 +Subject: Revert "serial: core: only stop transmit when HW fifo is empty" + +From: Doug Brown + +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 +Link: https://lore.kernel.org/r/20240606195632.173255-2-doug@schmorgal.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -787,8 +787,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.6/serial-8250_omap-implementation-of-errata-i2310.patch b/queue-6.6/serial-8250_omap-implementation-of-errata-i2310.patch new file mode 100644 index 00000000000..4879dd8cbce --- /dev/null +++ b/queue-6.6/serial-8250_omap-implementation-of-errata-i2310.patch @@ -0,0 +1,67 @@ +From 9d141c1e615795eeb93cd35501ad144ee997a826 Mon Sep 17 00:00:00 2001 +From: Udit Kumar +Date: Wed, 19 Jun 2024 16:29:03 +0530 +Subject: serial: 8250_omap: Implementation of Errata i2310 + +From: Udit Kumar + +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 +Link: https://lore.kernel.org/r/20240619105903.165434-1-u-kumar1@ti.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -165,6 +165,10 @@ static u32 uart_read(struct omap8250_pri + return readl(priv->membase + (reg << OMAP_UART_REGSHIFT)); + } + ++/* Timeout low and High */ ++#define UART_OMAP_TO_L 0x26 ++#define UART_OMAP_TO_H 0x27 ++ + /* + * Called on runtime PM resume path from omap8250_restore_regs(), and + * omap8250_set_mctrl(). +@@ -646,13 +650,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.6/serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch b/queue-6.6/serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch new file mode 100644 index 00000000000..d4372c61dbf --- /dev/null +++ b/queue-6.6/serial-bcm63xx-uart-fix-tx-after-conversion-to-uart_port_tx_limited.patch @@ -0,0 +1,48 @@ +From ea55c65dedf40e9c1911dc1e63e26bc9a59692b9 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +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 + +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 +Signed-off-by: Doug Brown +Link: https://lore.kernel.org/r/20240606195632.173255-4-doug@schmorgal.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -309,8 +309,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), + ({})); +@@ -321,6 +321,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.6/serial-core-introduce-uart_port_tx_limited_flags.patch b/queue-6.6/serial-core-introduce-uart_port_tx_limited_flags.patch new file mode 100644 index 00000000000..8d4b12cda7f --- /dev/null +++ b/queue-6.6/serial-core-introduce-uart_port_tx_limited_flags.patch @@ -0,0 +1,50 @@ +From 9bb43b9e8d9a288a214e9b17acc9e46fda3977cf Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Thu, 6 Jun 2024 12:56:32 -0700 +Subject: serial: core: introduce uart_port_tx_limited_flags() + +From: Jonas Gorski + +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 +Signed-off-by: Doug Brown +Link: https://lore.kernel.org/r/20240606195632.173255-3-doug@schmorgal.com +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/serial_core.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -827,6 +827,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.6/serial-imx-set-receiver-level-before-starting-uart.patch b/queue-6.6/serial-imx-set-receiver-level-before-starting-uart.patch new file mode 100644 index 00000000000..a8390f1f523 --- /dev/null +++ b/queue-6.6/serial-imx-set-receiver-level-before-starting-uart.patch @@ -0,0 +1,37 @@ +From a81dbd0463eca317eee44985a66aa6cc2ce5c101 Mon Sep 17 00:00:00 2001 +From: Stefan Eichenberger +Date: Fri, 21 Jun 2024 17:37:49 +0200 +Subject: serial: imx: set receiver level before starting uart + +From: Stefan Eichenberger + +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 +Signed-off-by: Stefan Eichenberger +Link: https://lore.kernel.org/r/20240621153829.183780-1-eichest@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -1959,8 +1959,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; + } diff --git a/queue-6.6/series b/queue-6.6/series index de367422a94..2204ec1a4a7 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -113,3 +113,8 @@ usb-typec-ucsi-glink-fix-child-node-release-in-probe-function.patch usb-ucsi-stm32-fix-command-completion-handling.patch usb-dwc3-core-add-dwc31-version-2.00a-controller.patch usb-dwc3-core-workaround-for-csr-read-timeout.patch +revert-serial-core-only-stop-transmit-when-hw-fifo-is-empty.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