Re: [PATCH v2 2/2] serial: 8250_mid: wait for LSR tx empty before setting termios
From: Andy Shevchenko
Date: Mon Aug 31 2026 - 02:54:26 EST
On Fri, Aug 28, 2026 at 05:57:28PM +0000, Tate Whiteberg wrote:
> If mid8250_set_termios() is called while data is still in transmission,
> the corresponding register updates will corrupt the transmission.
>
> Fix this by locking the port and and waiting for the transmitter to
> empty before performing updates. It is necessary to wait for both
> UART_LSR_THRE and UART_LSR_TEMT to ensure the final character is sent.
> Fixes: d9eda9bab237 ("serial: 8250_pci: Intel MID UART support to its own driver")
Obviously this is not the commit when the problem appeared.
Check the commit f549e94effa1 ("serial: 8250_pci: add Intel Penwell ports").
...
> + uart_port_lock_irq(p);
> +
> p->uartclk = fuart * 16 / ps; /* core uses ps = 16 always */
+ blank line
> + serial8250_wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
>
> writel(ps, p->membase + INTEL_MID_UART_PS); /* set PS */
> writel(mul, p->membase + INTEL_MID_UART_MUL); /* set MUL */
> writel(div, p->membase + INTEL_MID_UART_DIV);
>
> + uart_port_unlock_irq(p);
--
With Best Regards,
Andy Shevchenko