Re: [PATCH v4 05/14] serial: 8250_mxpcie: offload XON/XOFF flow control to MUEx50 hardware
Jiri Slaby <[email protected]> Thu, 30 Jul 2026 07:49:43 +0200
| Newsgroups | org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 29. 07. 26, 8:05, Crescent Hsieh wrote: > The MUEx50 UART can handle in-band software flow control (XON/XOFF) > directly in hardware. > > Program the on-chip XON/XOFF characters from termios settings and enable > the corresponding MUEx50 flow control modes when IXON or IXOFF is > requested. Provide throttle and unthrottle callbacks so RX can be > stopped and resumed cleanly. > > Signed-off-by: Crescent Hsieh <[email protected]> > --- > drivers/tty/serial/8250/8250_mxpcie.c | 55 +++++++++++++++++++++++++-- > 1 file changed, 52 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c > index 1124c7d951b3..0517caaf2d26 100644 > --- a/drivers/tty/serial/8250/8250_mxpcie.c > +++ b/drivers/tty/serial/8250/8250_mxpcie.c ...> @@ -172,6 +184,23 @@ static void mxpcie8250_set_termios(struct uart_port *port, > efr |= (MOXA_PUART_EFR_AUTO_RTS | MOXA_PUART_EFR_AUTO_CTS); > up->port.status |= (UPSTAT_AUTORTS | UPSTAT_AUTOCTS); > } > + /* Set on-chip software flow control character */ > + serial_out(up, MOXA_PUART_XON1, START_CHAR(tty)); > + serial_out(up, MOXA_PUART_XON2, START_CHAR(tty)); > + serial_out(up, MOXA_PUART_XOFF1, STOP_CHAR(tty)); > + serial_out(up, MOXA_PUART_XOFF2, STOP_CHAR(tty)); > + > + efr &= ~(MOXA_PUART_EFR_RX_FLOW_MASK | MOXA_PUART_EFR_TX_FLOW_MASK); This is not needed, as you use FIELD_MODIFY(), right? > + val = I_IXON(tty) ? MOXA_PUART_EFR_RX_FLOW_XON1_XOFF1 : MOXA_PUART_EFR_RX_FLOW_DISABLED; > + efr = FIELD_MODIFY(MOXA_PUART_EFR_RX_FLOW_MASK, &efr, val); > + > + val = I_IXOFF(tty) ? MOXA_PUART_EFR_TX_FLOW_XON1_XOFF1 : MOXA_PUART_EFR_TX_FLOW_DISABLED; > + efr = FIELD_MODIFY(MOXA_PUART_EFR_TX_FLOW_MASK, &efr, val); Assigning back to efr is unnecessary. The reg is updated in-place. thanks, -- js suse labs