serial: uartps: Add TACTIVE check
Subsystems (2)
v4 cover serial: uartps: Add TACTIVE check
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(-)
Signature · 1 line
2.1.1
PATCH v4 1/2 serial: uartps: Remove unconditional wait inside set_termios
From: Raviteja Narayanam <[email protected]>
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).
--- drivers/tty/serial/xilinx_uartps.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/tty/serial/xilinx_uartps.c +2 -14
@@ -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 */
Signature · 1 line
2.1.1
PATCH v4 2/2 serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function
In reply to Shubhrajyoti DattaFrom: Raviteja Narayanam <[email protected]>
Make sure that all bytes are transmitted out of Uart by monitoring CDNS_UART_SR_TACTIVE bit as well.
--- drivers/tty/serial/xilinx_uartps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/xilinx_uartps.c +2 -2
@@ -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 ; }/**
Signature · 1 line
2.1.1
Re: [PATCH v4 2/2] serial: uartps: Add TACTIVE check in cdns_uart_tx_empty function
Quoted 27 lines · Shubhrajyoti Datta
From: Raviteja Narayanam <[email protected]>
Make sure that all bytes are transmitted out of Uart by monitoring
CDNS_UART_SR_TACTIVEbit as well.Signed-off-by Raviteja Narayanam <[email protected]>Signed-off-by Shubhrajyoti Datta <[email protected]>--- drivers/tty/serial/xilinx_uartps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/tty/serial/xilinx_uartps.c +2
-2@@ -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 ; }
Quoted 1 line
/**
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel