Re: [PATCH v1 04/31] serial: 8250_mxupci: enable auto RTS/CTS flow control
From: Andy Shevchenko
Date: Sun Nov 30 2025 - 12:18:16 EST
On Sun, Nov 30, 2025 at 12:43 PM Crescent Hsieh
<crescentcy.hsieh@xxxxxxxx> wrote:
>
> Implement a custom set_termios() to configure RTS/CTS hardware flow
> control. When CRTSCTS is enabled in termios, the UART_MCR[5] AFE (Auto
> Flow Control Enable) bit is set to allow automatic RTS/CTS signaling.
...
> +static void mxupci8250_set_termios(struct uart_port *port, struct ktermios *new,
> + const struct ktermios *old)
> +{
> + struct uart_8250_port *up = up_to_u8250p(port);
> + struct tty_struct *tty = port->state->port.tty;
> + unsigned int cflag = tty->termios.c_cflag;
> +
> + serial8250_do_set_termios(port, new, old);
> +
> + up->port.status &= ~(UPSTAT_AUTORTS | UPSTAT_AUTOCTS);
> +
> + up->mcr &= ~UART_MCR_AFE;
> +
> + if (cflag & CRTSCTS) {
> + up->mcr |= (UART_MCR_AFE | UART_MCR_RTS);
> + up->port.status |= (UPSTAT_AUTORTS | UPSTAT_AUTOCTS);
> + }
> + serial_out(up, UART_MCR, up->mcr);
> +}
Here I have a déjà vu feeling, i.e. some other drivers may also do the
same or very similar steps to enable it (8250_dw?). Can we create a
helper for all of them? And if this is the case, perhaps add it to
8250_pcilib.c?
--
With Best Regards,
Andy Shevchenko