Re: [PATCH v2 1/3] serial: 8250: Handle UART without interrupt on TEMT using em485

From: Andy Shevchenko
Date: Fri Oct 01 2021 - 07:48:52 EST


On Thu, Feb 04, 2021 at 11:11:56AM -0500, Eric Tremblay wrote:
> The patch introduce the UART_CAP_NOTEMT capability. The capability

s/The patch//

> indicate that the UART doesn't have an interrupt available on TEMT.

indicates

> In the case where the device does not support it, we calculate the
> maximum time it could take for the transmitter to empty the
> shift register. When we get in the situation where we get the
> THRE interrupt, we check if the TEMT bit is set. If it's not, we start
> the a timer and recall __stop_tx() after the delay.
>
> The transmit sequence is a bit modified when the capability is set. The
> new timer is used between the last interrupt(THRE) and a potential
> stop_tx timer.

> Signed-off-by: Giulio Benetti <giulio.benetti@xxxxxxxxxxxxxxxx>
> [moved to use added UART_CAP_TEMT]
> Signed-off-by: Heiko Stuebner <heiko.stuebner@xxxxxxxxxxxxxxxxxxxxx>
> [moved to use added UART_CAP_NOTEMT, improve timeout]
> Signed-off-by: Eric Tremblay <etremblay@xxxxxxxxxxxxxxxxxxxx>

Does it need Co-developed-by tag(s)?

...

> +#define UART_CAP_NOTEMT (1 << 18) /* UART without interrupt on TEMT available*/

Missed space in the comment .

...

> +static inline void serial8250_em485_update_temt_delay(struct uart_8250_port *p,
> + unsigned int cflag, unsigned int baud)
> +{
> + unsigned int bits;
> +
> + if (!p->em485)
> + return;
> +
> + bits = uart_get_byte_size(cflag);

Should be rebased. We have tty_get_frame_size() for a while.

> + p->em485->no_temt_delay = bits * NSEC_PER_SEC / baud;
> +}

--
With Best Regards,
Andy Shevchenko