Re: [PATCH v2 2/7] serial: 8250_dw: Avoid unnecessary LCR writes
From: Andy Shevchenko
Date: Wed Jan 28 2026 - 08:36:16 EST
On Wed, Jan 28, 2026 at 12:52:56PM +0200, Ilpo Järvinen wrote:
> When DW UART is configured with BUSY flag, LCR writes may not always
> succeed which can make any LCR write complex and very expensive.
> Performing write directly can trigger IRQ and the driver has to perform
> complex and distruptive sequence while retrying the write.
>
> Therefore, it's better to avoid doing LCR write that would not change
> the value of the LCR register. Add LCR write avoidance code into the
> 8250_dw driver's .serial_out() functions.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
...
> +static bool dw8250_can_skip_reg_write(struct uart_port *p, unsigned int offset, u32 value)
> +{
> + struct dw8250_data *d = to_dw8250_data(p->private_data);
> + u32 lcr;
> +
> + if (offset != UART_LCR || d->uart_16550_compatible)
> + return false;
> +
> + lcr = serial_port_in(p, offset);
> + return lcr == value;
I don't expect the side-effects, but strictly speaking this compares
the 32-bit values, while in some callbacks the only part of that
is being used (often lowest 8 bits).
> +}
--
With Best Regards,
Andy Shevchenko