* Output character lost with 8250 UART driver
@ 2008-06-25 8:06 ZhangXiao
2008-06-25 14:00 ` Chris Doré
0 siblings, 1 reply; 2+ messages in thread
From: ZhangXiao @ 2008-06-25 8:06 UTC (permalink / raw)
To: linux-serial; +Cc: xiao.zhang, Paul Gortmaker
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: Output character lost with 8250 UART driver
2008-06-25 8:06 Output character lost with 8250 UART driver ZhangXiao
@ 2008-06-25 14:00 ` Chris Doré
0 siblings, 0 replies; 2+ messages in thread
From: Chris Doré @ 2008-06-25 14:00 UTC (permalink / raw)
To: linux-serial; +Cc: 'Paul Gortmaker'
> -----Original Message-----
> From: ZhangXiao
> Sent: June 25, 2008 4:07 AM
>
> 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.
Do you have the FIFO's disabled, but transmit_chars() thinks they are
enabled?
Sounds to me like that might be your problem and without the
wait_for_xmitr() call you are overrunning the transmitter. In other words,
if you have FIFOs disabled, up->tx_loadsz should be 1.
What UART are you using?
..Chris
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-25 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 8:06 Output character lost with 8250 UART driver ZhangXiao
2008-06-25 14:00 ` Chris Doré
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox