From: ZhangXiao <xiao.zhang@windriver.com>
To: linux-serial@vger.kernel.org
Cc: xiao.zhang@windriver.com, Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: Output character lost with 8250 UART driver
Date: Wed, 25 Jun 2008 16:06:42 +0800 [thread overview]
Message-ID: <1214381202.6938.76.camel@xzhang1-desktop> (raw)
Hi,
When I boot one of my target I find the UART(8250) works improperly.
Sometimes lost output characters. When I dig in the 8250.c I find
something strange in function transmit_chars.
Below is the very piece of this function:
...
1 count = up->tx_loadsz;
2 do {
3 serial_out(up, UART_TX, xmit->buf[xmit->tail]);
4 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
5 up->port.icount.tx++;
6 if (uart_circ_empty(xmit))
7 break;
8 } while (--count > 0);
...
Based on theses lines, characters should be written to the THR
continuous, no matter if it had already move the character to the TSR. I
think it is not safe in some cases so I add a line
wait_for_xmitr(up, UART_LSR_THRE);
before line 3. And then the issue in my target was disappeared. This is
a static function that was already exist in the same file. It just check
and wait until the THR was empty.
I noticed that in the same file (8250.c), in console part, all data
written to THR was protected by the "wait_for_xmitr". So for the
function "transmit_chars", does that a bug and should be resolved? Or
there are any reasons that it needn't this protection?
Thanks a lot
Xiao
next reply other threads:[~2008-06-25 8:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-25 8:06 ZhangXiao [this message]
2008-06-25 14:00 ` Output character lost with 8250 UART driver Chris Doré
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=1214381202.6938.76.camel@xzhang1-desktop \
--to=xiao.zhang@windriver.com \
--cc=linux-serial@vger.kernel.org \
--cc=paul.gortmaker@windriver.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