* [PATCH v4 0/2] serial: uartps: Add TACTIVE check
@ 2020-03-19 9:44 Shubhrajyoti Datta
2020-03-19 9:44 ` [PATCH v4 1/2] serial: uartps: Remove unconditional wait inside set_termios Shubhrajyoti Datta
2020-03-19 9:44 ` [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function Shubhrajyoti Datta
0 siblings, 2 replies; 4+ messages in thread
From: Shubhrajyoti Datta @ 2020-03-19 9:44 UTC (permalink / raw)
To: linux-serial; +Cc: linux-arm-kernel, gregkh, michal.simek, Shubhrajyoti Datta
The cdns_uart_tx_empty function is currently checking oly for tx_empty
bit of SR. In some environments, it is leading to a corruption in log
because tx_empty does not gaurantee that all the bytes are transmitted
out of the FIFO. So, add TACTIVE bit in the check.
This patch series does the following:
-Remove unconditional wait for tx_empty inside set_termios function
-Add TACTIVE check in cdns_uart_tx_empty function
Changes in v4:
-Split into two patches as suggested by Johan
Raviteja Narayanam (2):
serial: uartps: Remove unconditional wait inside set_termios
serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function
drivers/tty/serial/xilinx_uartps.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
--
2.1.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 1/2] serial: uartps: Remove unconditional wait inside set_termios
2020-03-19 9:44 [PATCH v4 0/2] serial: uartps: Add TACTIVE check Shubhrajyoti Datta
@ 2020-03-19 9:44 ` Shubhrajyoti Datta
2020-03-19 9:44 ` [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function Shubhrajyoti Datta
1 sibling, 0 replies; 4+ messages in thread
From: Shubhrajyoti Datta @ 2020-03-19 9:44 UTC (permalink / raw)
To: linux-serial
Cc: linux-arm-kernel, gregkh, michal.simek, Raviteja Narayanam,
Shubhrajyoti Datta
From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
set_termios function should not wait for the transmit FIFO empty
(CDNS_UART_SR_TXEMPTY) unconditionally. The tty layer takes care
of it based on the parameter passed (TCSANOW/TCSADRAIN/TCSAFLUSH).
Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
drivers/tty/serial/xilinx_uartps.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 30a1425..662b8ab 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -706,20 +706,8 @@ static void cdns_uart_set_termios(struct uart_port *port,
u32 cval = 0;
unsigned int baud, minbaud, maxbaud;
unsigned long flags;
- unsigned int ctrl_reg, mode_reg, val;
- int err;
-
- /* Wait for the transmit FIFO to empty before making changes */
- if (!(readl(port->membase + CDNS_UART_CR) &
- CDNS_UART_CR_TX_DIS)) {
- 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;
- }
- }
+ unsigned int ctrl_reg, mode_reg;
+
spin_lock_irqsave(&port->lock, flags);
/* Disable the TX and RX to set baud rate */
--
2.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function
2020-03-19 9:44 [PATCH v4 0/2] serial: uartps: Add TACTIVE check Shubhrajyoti Datta
2020-03-19 9:44 ` [PATCH v4 1/2] serial: uartps: Remove unconditional wait inside set_termios Shubhrajyoti Datta
@ 2020-03-19 9:44 ` Shubhrajyoti Datta
2020-03-21 10:07 ` Maarten Brock
1 sibling, 1 reply; 4+ messages in thread
From: Shubhrajyoti Datta @ 2020-03-19 9:44 UTC (permalink / raw)
To: linux-serial
Cc: linux-arm-kernel, gregkh, michal.simek, Raviteja Narayanam,
Shubhrajyoti Datta
From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Make sure that all bytes are transmitted out of Uart by monitoring
CDNS_UART_SR_TACTIVE bit as well.
Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
drivers/tty/serial/xilinx_uartps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 662b8ab..38cb76a9 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -663,8 +663,8 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port)
unsigned int status;
status = readl(port->membase + CDNS_UART_SR) &
- CDNS_UART_SR_TXEMPTY;
- return status ? TIOCSER_TEMT : 0;
+ (CDNS_UART_SR_TXEMPTY | CDNS_UART_SR_TACTIVE);
+ return (status == CDNS_UART_SR_TXEMPTY) ? TIOCSER_TEMT : 0;
}
/**
--
2.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function
2020-03-19 9:44 ` [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function Shubhrajyoti Datta
@ 2020-03-21 10:07 ` Maarten Brock
0 siblings, 0 replies; 4+ messages in thread
From: Maarten Brock @ 2020-03-21 10:07 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: linux-serial, linux-arm-kernel, gregkh, michal.simek,
Raviteja Narayanam, linux-serial-owner
On 2020-03-19 10:44, Shubhrajyoti Datta wrote:
> From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
>
> Make sure that all bytes are transmitted out of Uart by monitoring
> CDNS_UART_SR_TACTIVE bit as well.
>
> Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
> drivers/tty/serial/xilinx_uartps.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/xilinx_uartps.c
> b/drivers/tty/serial/xilinx_uartps.c
> index 662b8ab..38cb76a9 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -663,8 +663,8 @@ static unsigned int cdns_uart_tx_empty(struct
> uart_port *port)
> unsigned int status;
>
> status = readl(port->membase + CDNS_UART_SR) &
> - CDNS_UART_SR_TXEMPTY;
> - return status ? TIOCSER_TEMT : 0;
> + (CDNS_UART_SR_TXEMPTY | CDNS_UART_SR_TACTIVE);
> + return (status == CDNS_UART_SR_TXEMPTY) ? TIOCSER_TEMT : 0;
> }
>
> /**
Acked-by: Maarten Brock <m.brock@vanmierlo.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-21 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 9:44 [PATCH v4 0/2] serial: uartps: Add TACTIVE check Shubhrajyoti Datta
2020-03-19 9:44 ` [PATCH v4 1/2] serial: uartps: Remove unconditional wait inside set_termios Shubhrajyoti Datta
2020-03-19 9:44 ` [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function Shubhrajyoti Datta
2020-03-21 10:07 ` Maarten Brock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).