Re: [PATCH v2 4/7] serial: 8250: Handle implementations not having TEMT interrupt using em485

From: Andy Shevchenko
Date: Mon Mar 30 2020 - 10:52:42 EST


On Thu, Mar 26, 2020 at 12:14:19AM +0100, Heiko Stuebner wrote:
> From: Giulio Benetti <giulio.benetti@xxxxxxxxxxxxxxxx>
>
> Some 8250 ports have a TEMT interrupt but it's not a part of the 8250
> standard, instead only available on some implementations.
>
> The current em485 implementation does not work on ports without it.
> The only chance to make it work is to loop-read on LSR register.
>
> So add UART_CAP_TEMT to mark 8250 uarts having this interrupt,
> update all current em485 users with that capability and make
> the stop_tx function loop-read on uarts not having it.

> + if (p->capabilities & UART_CAP_TEMT) {
> + if ((lsr & BOTH_EMPTY) != BOTH_EMPTY)
> + return;
> + } else {
> + int lsr;
> +

> + if (readx_poll_timeout(__get_lsr, p, lsr,
> + (lsr & BOTH_EMPTY) == BOTH_EMPTY,
> + 0, 10000) < 0)

ret = readx_poll_timeout(...);
if (ret)
...

will look better.

> + pr_warn("%s: timeout waiting for fifos to empty\n",
> + p->port.name);
> + }

--
With Best Regards,
Andy Shevchenko