From: Ben Dooks <ben.dooks@codethink.co.uk>
To: edward.cragg@codethink.co.uk
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-meson@googlegroups.com, linux-kernel@codethink.co.uk,
Ben Dooks <ben.dooks@codethink.co.uk>,
linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.com>,
carlo@caione.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/9] ARM: meson: serial: tx_empty fails to check for transmitter busy
Date: Wed, 18 Nov 2015 14:41:13 +0000 [thread overview]
Message-ID: <1447857679-30158-4-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1447857679-30158-1-git-send-email-ben.dooks@codethink.co.uk>
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: Ben Dooks <ben.dooks@codethink.co.uk>
Reported-by: Edward Cragg <edward.cragg@codethink.co.uk>
---
drivers/tty/serial/meson_uart.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index b87eb97..54d1b95 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -57,6 +57,7 @@
#define AML_UART_RX_EMPTY BIT(20)
#define AML_UART_TX_FULL BIT(21)
#define AML_UART_TX_EMPTY BIT(22)
+#define AML_UART_XMIT_BUSY BIT(25)
#define AML_UART_ERR (AML_UART_PARITY_ERR | \
AML_UART_FRAME_ERR | \
AML_UART_TX_FIFO_WERR)
@@ -100,7 +101,8 @@ static unsigned int meson_uart_tx_empty(struct uart_port *port)
u32 val;
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)
--
2.6.2
next prev parent reply other threads:[~2015-11-18 14:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 14:41 AMLogic Meson serial driver fixes Ben Dooks
2015-11-18 14:41 ` [PATCH 1/9] ARM: meson: serial: release region on port release Ben Dooks
2015-11-18 14:41 ` [PATCH 2/9] ARM: meson: serial: don't reset port on uart startup Ben Dooks
2015-11-18 14:41 ` Ben Dooks [this message]
2015-11-18 14:41 ` [PATCH 4/9] ARM: meson: serial: ensure console port uart enabled Ben Dooks
2015-11-18 14:41 ` [PATCH 5/9] ARM: meson: serial: only disable tx irq on stop Ben Dooks
2015-11-18 14:41 ` [PATCH 6/9] ARM: meson: serial: use meson_uart_tx_empty() to wait for empty Ben Dooks
2015-11-18 14:41 ` [PATCH 7/9] ARM: meson: serial: disable rx/tx irqs during console write Ben Dooks
2015-11-18 14:41 ` [PATCH 8/9] ARM: meson: serial: ensure tx irq on if more work to do Ben Dooks
2015-11-18 14:41 ` [PATCH 9/9] ARM: meson: serial: check for tx-irq enabled in irq code Ben Dooks
2015-11-23 11:52 ` [linux-meson] AMLogic Meson serial driver fixes Carlo Caione
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447857679-30158-4-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=carlo@caione.org \
--cc=edward.cragg@codethink.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@codethink.co.uk \
--cc=linux-meson@googlegroups.com \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).