diff options
author | Pali Rohár <pali@kernel.org> | 2021-01-14 15:46:35 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2021-01-27 13:12:51 +0100 |
commit | aea2f721051037ea673a726856bcc15ecebf2389 (patch) | |
tree | a1ee1c768bddd8b29ec0a7f7701235a10ac6ece9 | |
parent | ba8ae03eabfd41ecba5ab8000c54666dc6b9f89e (diff) | |
download | u-boot-aea2f721051037ea673a726856bcc15ecebf2389.zip u-boot-aea2f721051037ea673a726856bcc15ecebf2389.tar.gz u-boot-aea2f721051037ea673a726856bcc15ecebf2389.tar.bz2 |
serial: a3720: Implement pending method for output direction
To check if some output characters are waiting either in Transmitter
Holding Register or Transmitter Shift Register we need to look at
TX_EMPTY bit of UART Status Register.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r-- | drivers/serial/serial_mvebu_a3700.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c index 5a1d40e..8f40487 100644 --- a/drivers/serial/serial_mvebu_a3700.c +++ b/drivers/serial/serial_mvebu_a3700.c @@ -23,6 +23,7 @@ struct mvebu_plat { #define UART_POSSR_REG 0x14 #define UART_STATUS_RX_RDY 0x10 +#define UART_STATUS_TX_EMPTY 0x40 #define UART_STATUS_TXFIFO_FULL 0x800 #define UART_CTRL_RXFIFO_RESET 0x4000 @@ -59,8 +60,13 @@ static int mvebu_serial_pending(struct udevice *dev, bool input) struct mvebu_plat *plat = dev_get_plat(dev); void __iomem *base = plat->base; - if (readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY) - return 1; + if (input) { + if (readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY) + return 1; + } else { + if (!(readl(base + UART_STATUS_REG) & UART_STATUS_TX_EMPTY)) + return 1; + } return 0; } |