Re: [PATCH v5 07/14] serial: 8250_mxpcie: speed up RX using memory-mapped FIFO window

From: Andy Shevchenko

Date: Sun Aug 02 2026 - 05:05:25 EST


On Fri, Jul 31, 2026 at 10:49 AM Crescent Hsieh
<crescentcy.hsieh@xxxxxxxx> wrote:
>
> The MUEx50 UART provides a memory-mapped RX FIFO data window along with
> an RX FIFO byte counter.
>
> When no break or error conditions are present, read received data in
> bulk via the MMIO FIFO window and push it to the tty layer in one
> operation. Fall back to the generic 8250 RX path for break and error
> handling.

...

> +static void mxpcie8250_rx_chars(struct uart_8250_port *up)
> +{
> + struct uart_port *port = &up->port;
> + struct tty_port *tport = &port->state->port;
> + unsigned int count;
> + u8 *buf;
> +
> + count = serial_in(up, MOXA_PUART_RX_FIFO_CNT);
> + count = min(count, port->fifosize);

You want to include minmax.h for this.

> + count = tty_prepare_flip_string(tport, &buf, count);
> + if (!count)
> + return;
> +
> + for (unsigned int i = 0; i < count; ++i)

i++ should be sufficient.

> + buf[i] = serial_in(up, MOXA_PUART_RX_FIFO_MEM + i);
> +
> + port->icount.rx += count;
> + tty_flip_buffer_push(tport);
> +}

--
With Best Regards,
Andy Shevchenko