From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>, Magnus Damm <magnus.damm@gmail.com>
Cc: linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 3/4] serial: sh-sci: Clear RX, error, and break flags during reset
Date: Thu, 26 May 2016 20:18:37 +0200 [thread overview]
Message-ID: <1464286718-10745-4-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1464286718-10745-1-git-send-email-geert+renesas@glider.be>
Setting the FIFO reset bits is not sufficient to reset the RX FIFO.
After this the status register's RDF flag bit may still be set, causing
the reception of one stale byte of data.
To fix this, clear all status flag bits related to reception, error, and
break handling, cfr. the initialization flowchart in the datasheet.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/tty/serial/sh-sci.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 4d2f916f45277e20..549d799cb18fafe7 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2052,6 +2052,10 @@ static void sci_reset(struct uart_port *port)
reg = sci_getreg(port, SCFCR);
if (reg->size)
serial_port_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
+
+ sci_clear_SCxSR(port,
+ SCxSR_RDxF_CLEAR(port) & SCxSR_ERROR_CLEAR(port) &
+ SCxSR_BREAK_CLEAR(port));
}
static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
--
1.9.1
next prev parent reply other threads:[~2016-05-26 18:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 18:18 [PATCH 0/4] serial: sh-sci: FIFO initialization fixes Geert Uytterhoeven
2016-05-26 18:18 ` [PATCH 1/4] serial: sh-sci: Do not start transfers from sci_startup() Geert Uytterhoeven
2016-05-26 18:18 ` [PATCH 2/4] serial: sh-sci: Stop transfers in sci_shutdown() Geert Uytterhoeven
2016-06-21 7:35 ` Yoshihiro Shimoda
2016-06-21 14:52 ` Geert Uytterhoeven
2016-06-23 10:42 ` Yoshihiro Shimoda
2016-06-23 11:20 ` Geert Uytterhoeven
2016-05-26 18:18 ` Geert Uytterhoeven [this message]
2016-05-26 18:18 ` [PATCH 4/4] serial: sh-sci: Clear (H)SCIF timeout and overrun during reset Geert Uytterhoeven
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=1464286718-10745-4-git-send-email-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/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).