From: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
To: <gregkh@linuxfoundation.org>
Cc: <stefan@agner.ch>, <shawnguo@kernel.org>, <kernel@pengutronix.de>,
<mturquette@baylibre.com>, <sboyd@codeaurora.org>,
<jslaby@suse.com>, <linux-arm-kernel@lists.infradead.org>,
<linux-clk@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-serial@vger.kernel.org>,
"Bhuvanchandra DV" <bhuvanchandra.dv@toradex.com>
Subject: [PATCH RESEND v2 3/8] tty: serial: fsl_lpuart: fix clearing of receive flag
Date: Tue, 19 Jul 2016 13:13:05 +0530 [thread overview]
Message-ID: <20160719074310.16872-4-bhuvanchandra.dv@toradex.com> (raw)
In-Reply-To: <20160719074310.16872-1-bhuvanchandra.dv@toradex.com>
From: Stefan Agner <stefan@agner.ch>
Commit 8e4934c6d6c6 ("tty: serial: fsl_lpuart: clear receive flag on FIFO
flush") implemented clearing of the receive flag by reading the status register
only. It turned out that even though we flush the FIFO afterwards, a explicit
read of the data register is still required.
This leads to a FIFO underrun. To avoid this, follow the advice in the overrun
"Operation section": Unconditionally clear RXUF after using RXFLUSH.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
---
drivers/tty/serial/fsl_lpuart.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 75a2098..97c1fda 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -935,13 +935,16 @@ static void lpuart_setup_watermark(struct lpuart_port *sport)
writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE,
sport->port.membase + UARTPFIFO);
- /* explicitly clear RDRF */
- readb(sport->port.membase + UARTSR1);
-
/* flush Tx and Rx FIFO */
writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH,
sport->port.membase + UARTCFIFO);
+ /* explicitly clear RDRF */
+ if (readb(sport->port.membase + UARTSR1) & UARTSR1_RDRF) {
+ readb(sport->port.membase + UARTDR);
+ writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO);
+ }
+
writeb(0, sport->port.membase + UARTTWFIFO);
writeb(1, sport->port.membase + UARTRWFIFO);
--
2.9.0
next prev parent reply other threads:[~2016-07-19 8:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-19 7:43 [PATCH RESEND v2 0/8] Improve Rx/Tx DMA implementation Bhuvanchandra DV
2016-07-19 7:43 ` [PATCH RESEND v2 1/8] tty: serial: fsl_lpuart: consider TX FIFO too in tx_empty Bhuvanchandra DV
2016-07-19 7:43 ` [PATCH RESEND v2 2/8] tty: serial: fsl_lpuart: support suspend/resume Bhuvanchandra DV
2016-07-19 7:43 ` Bhuvanchandra DV [this message]
2016-07-19 7:43 ` [PATCH RESEND v2 4/8] tty: serial: fsl_lpuart: Fix broken 8m/s1 support Bhuvanchandra DV
2016-07-19 7:43 ` [PATCH RESEND v2 5/8] tty: serial: fsl_lpuart: Use cyclic DMA for Rx Bhuvanchandra DV
2016-07-19 7:43 ` [PATCH RESEND v2 6/8] tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx Bhuvanchandra DV
2016-07-19 7:43 ` [PATCH RESEND v2 7/8] tty: serial: fsl_lpuart: Update suspend/resume for DMA mode Bhuvanchandra DV
2016-07-19 7:43 ` [PATCH RESEND v2 8/8] tty: serial: fsl_lpuart: Add support for RS-485 Bhuvanchandra DV
2016-08-02 7:53 ` [PATCH RESEND v2 0/8] Improve Rx/Tx DMA implementation Bhuvanchandra DV
2016-08-02 15:28 ` Andrew Lunn
2016-08-03 4:39 ` Bhuvanchandra DV
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=20160719074310.16872-4-bhuvanchandra.dv@toradex.com \
--to=bhuvanchandra.dv@toradex.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.org \
--cc=shawnguo@kernel.org \
--cc=stefan@agner.ch \
/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
all inboxes | Powered by JetHome®