Commit 88679739 authored by Ben Dooks's avatar Ben Dooks Committed by Greg Kroah-Hartman

ARM: meson: serial: tx_empty fails to check for transmitter busy

The tx_empty() uart_op should only return empty if both the transmit fifo
and the transmit state-machine are both idle. Add a test for the hardware's
XMIT_BUSY flag.

Note, this is possibly related to an issue where the port is being shutdown
with paritally transmitted characters in it.
Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
Reported-by: default avatarEdward Cragg <edward.cragg@codethink.co.uk>
Tested-by: default avatarCarlo Caione <carlo@endlessm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 00661dd8
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#define AML_UART_RX_EMPTY BIT(20) #define AML_UART_RX_EMPTY BIT(20)
#define AML_UART_TX_FULL BIT(21) #define AML_UART_TX_FULL BIT(21)
#define AML_UART_TX_EMPTY BIT(22) #define AML_UART_TX_EMPTY BIT(22)
#define AML_UART_XMIT_BUSY BIT(25)
#define AML_UART_ERR (AML_UART_PARITY_ERR | \ #define AML_UART_ERR (AML_UART_PARITY_ERR | \
AML_UART_FRAME_ERR | \ AML_UART_FRAME_ERR | \
AML_UART_TX_FIFO_WERR) AML_UART_TX_FIFO_WERR)
...@@ -100,7 +101,8 @@ static unsigned int meson_uart_tx_empty(struct uart_port *port) ...@@ -100,7 +101,8 @@ static unsigned int meson_uart_tx_empty(struct uart_port *port)
u32 val; u32 val;
val = readl(port->membase + AML_UART_STATUS); val = readl(port->membase + AML_UART_STATUS);
return (val & AML_UART_TX_EMPTY) ? TIOCSER_TEMT : 0; val &= (AML_UART_TX_EMPTY | AML_UART_XMIT_BUSY);
return (val == AML_UART_TX_EMPTY) ? TIOCSER_TEMT : 0;
} }
static void meson_uart_stop_tx(struct uart_port *port) static void meson_uart_stop_tx(struct uart_port *port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment