Re: [PATCH v5 04/14] serial: 8250_mxpcie: enable automatic RTS/CTS flow control
Andy Shevchenko <[email protected]> Sun, 2 Aug 2026 11:58:00 +0300
| Newsgroups | org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAHp75Vdfd+6wbDKJhxPOsXRZ9YssGAHZ15kqWs9=whX+0wJaBw@mail.gmail.com> |
On Fri, Jul 31, 2026 at 10:49=E2=80=AFAM Crescent Hsieh <[email protected]> wrote: > > The MUEx50 UART supports automatic RTS/CTS flow control via the enhanced > feature register. > > Implement a mxpcie-specific set_termios() callback that enables MUEx50 > auto-RTS/auto-CTS when CRTSCTS is requested and disables it otherwise. > Keep the 8250 port status flags in sync with the hardware configuration. ... > +static void mxpcie8250_set_termios(struct uart_port *port, > + struct ktermios *new, > + const struct ktermios *old) > +{ > + struct uart_8250_port *up =3D up_to_u8250p(port); > + struct tty_struct *tty =3D port->state->port.tty; > + unsigned int cflag =3D tty->termios.c_cflag; > + u8 efr; > + > + serial8250_do_set_termios(port, new, old); > + up->port.status &=3D ~(UPSTAT_AUTORTS | UPSTAT_AUTOCTS); > + > + efr =3D serial_in(up, MOXA_PUART_EFR); > + efr &=3D ~(MOXA_PUART_EFR_AUTO_RTS | MOXA_PUART_EFR_AUTO_CTS); > + > + if (cflag & CRTSCTS) { > + efr |=3D (MOXA_PUART_EFR_AUTO_RTS | MOXA_PUART_EFR_AUTO_C= TS); > + up->port.status |=3D (UPSTAT_AUTORTS | UPSTAT_AUTOCTS); Don't you want to use FIELD_MODIFY() at least for efr value? Also if-else looks better, no? if (..) { FIELD_MODIFY(&efr); up->port.status ... } else { ... } > + } > + serial_out(up, MOXA_PUART_EFR, efr); > +} --=20 With Best Regards, Andy Shevchenko