Re: 0d2fd5b99c95 - main - ns8250: use LSR_THRE instead of LSR_TEMT for checking tx flush

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Thu, 22 May 2025 08:02:24 UTC
On 22/05/2025 09:37, mmel@FreeBSD.org wrote:
 > I wrote:
>> Maybe I don't understand the code, but UART_FLUSH_RECEIVER in ns8250_bus_attach
>> looks strange to me. It's one thing to flush data while in the loop-back mode,
>> but I think that in ns8250_bus_attach the hardware is fully set up to receive
>> data from the outside world. So, how can we hope to drain all of it and to
>> reliably detect whether FIFO flushing works. I mean that something on the other
>> end could be continuously transmitting.
>>
> I'm not sure if I understand you exactly, but in loop-back mode the RX input is 
> internally connected to the TX output (i.e. disconnected from the outside 
> world). So from that perspective, the FIFO detection and flush seems fine to me.
Right. Loop-back mode is used in probe, but in attach the UART is in normal mode 
as far as I can tell.

-- 
Andriy Gapon