+++ /dev/null
-From 277375b864e8147975b064b513f491e2a910e66a Mon Sep 17 00:00:00 2001
-From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
-Date: Fri, 24 May 2019 14:41:29 +0530
-Subject: serial: uartps: Add a timeout to the tx empty wait
-
-From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
-
-commit 277375b864e8147975b064b513f491e2a910e66a upstream.
-
-In case the cable is not connected then the target gets into
-an infinite wait for tx empty.
-Add a timeout to the tx empty wait.
-
-Reported-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
-Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- drivers/tty/serial/xilinx_uartps.c | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
---- a/drivers/tty/serial/xilinx_uartps.c
-+++ b/drivers/tty/serial/xilinx_uartps.c
-@@ -30,6 +30,7 @@
- #include <linux/io.h>
- #include <linux/of.h>
- #include <linux/module.h>
-+#include <linux/iopoll.h>
-
- #define CDNS_UART_TTY_NAME "ttyPS"
- #define CDNS_UART_NAME "xuartps"
-@@ -38,6 +39,7 @@
- #define CDNS_UART_NR_PORTS 2
- #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */
- #define CDNS_UART_REGISTER_SPACE 0x1000
-+#define TX_TIMEOUT 500000
-
- /* Rx Trigger level */
- static int rx_trigger_level = 56;
-@@ -681,16 +683,20 @@ static void cdns_uart_set_termios(struct
- unsigned int cval = 0;
- unsigned int baud, minbaud, maxbaud;
- unsigned long flags;
-- unsigned int ctrl_reg, mode_reg;
-+ unsigned int ctrl_reg, mode_reg, val;
-+ int err;
-
- spin_lock_irqsave(&port->lock, flags);
-
- /* Wait for the transmit FIFO to empty before making changes */
- if (!(readl(port->membase + CDNS_UART_CR) &
- CDNS_UART_CR_TX_DIS)) {
-- while (!(readl(port->membase + CDNS_UART_SR) &
-- CDNS_UART_SR_TXEMPTY)) {
-- cpu_relax();
-+ err = readl_poll_timeout(port->membase + CDNS_UART_SR,
-+ val, (val & CDNS_UART_SR_TXEMPTY),
-+ 1000, TX_TIMEOUT);
-+ if (err) {
-+ dev_err(port->dev, "timed out waiting for tx empty");
-+ return;
- }
- }
-
+++ /dev/null
-From 54340d4d8bd85b2c432243ab4d6e23d954303493 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 Apr 2020 11:56:02 +0530
-Subject: serial: uartps: Wait for tx_empty in console setup
-
-From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
-
-[ Upstream commit 42e11948ddf68b9f799cad8c0ddeab0a39da33e8 ]
-
-On some platforms, the log is corrupted while console is being
-registered. It is observed that when set_termios is called, there
-are still some bytes in the FIFO to be transmitted.
-
-So, wait for tx_empty inside cdns_uart_console_setup before calling
-set_termios.
-
-Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
-Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
-Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/xilinx_uartps.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
---- a/drivers/tty/serial/xilinx_uartps.c
-+++ b/drivers/tty/serial/xilinx_uartps.c
-@@ -1274,6 +1274,7 @@ static int cdns_uart_console_setup(struc
- int bits = 8;
- int parity = 'n';
- int flow = 'n';
-+ unsigned long time_out;
-
- if (co->index < 0 || co->index >= CDNS_UART_NR_PORTS)
- return -EINVAL;
-@@ -1287,6 +1288,13 @@ static int cdns_uart_console_setup(struc
- if (options)
- uart_parse_options(options, &baud, &parity, &bits, &flow);
-
-+ /* Wait for tx_empty before setting up the console */
-+ time_out = jiffies + usecs_to_jiffies(TX_TIMEOUT);
-+
-+ while (time_before(jiffies, time_out) &&
-+ cdns_uart_tx_empty(port) != TIOCSER_TEMT)
-+ cpu_relax();
-+
- return uart_set_options(port, co, baud, parity, bits, flow);
- }
-
alsa-usb-audio-fix-case-when-usb-midi-interface-has-.patch
mm-filemap.c-clear-page-error-before-actual-read.patch
mm-mmap.c-initialize-align_offset-explicitly-for-vm_.patch
-serial-uartps-add-a-timeout-to-the-tx-empty-wait.patch
-serial-uartps-wait-for-tx_empty-in-console-setup.patch
kvm-remove-create_irqchip-set_pit2-race.patch
bdev-reduce-time-holding-bd_mutex-in-sync-in-blkdev_.patch
drivers-char-tlclk.c-avoid-data-race-between-init-an.patch