The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Crescent Hsieh <crescentcy.hsieh@moxa.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: FangpingFP.Cheng@moxa.com, Epson.Chiang@moxa.com,
	EddieSY.Lin@moxa.com, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH v4 05/14] serial: 8250_mxpcie: offload XON/XOFF flow control to MUEx50 hardware
Date: Thu, 30 Jul 2026 07:49:43 +0200	[thread overview]
Message-ID: <82cb09bd-7f95-4cb8-9cd9-634dbcf38729@kernel.org> (raw)
In-Reply-To: <20260729060602.492430-6-crescentcy.hsieh@moxa.com>

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 <crescentcy.hsieh@moxa.com>
> ---
>   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

  reply	other threads:[~2026-07-30  5:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  6:05 [PATCH v4 00/14] serial: 8250: add Moxa MUEx50 PCIe board support Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 01/14] serial: 8250: split Moxa PCIe serial board support out of 8250_pci Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 02/14] serial: 8250: add Moxa MUEx50 UART port type Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 03/14] serial: 8250_mxpcie: enable enhanced mode and program FIFO trigger levels Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 04/14] serial: 8250_mxpcie: enable automatic RTS/CTS flow control Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 05/14] serial: 8250_mxpcie: offload XON/XOFF flow control to MUEx50 hardware Crescent Hsieh
2026-07-30  5:49   ` Jiri Slaby [this message]
2026-07-31  2:18     ` Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 06/14] serial: 8250_mxpcie: add custom handle_irq callback Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 07/14] serial: 8250_mxpcie: speed up RX using memory-mapped FIFO window Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 08/14] serial: 8250_mxpcie: speed up TX " Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 09/14] serial: 8250_mxpcie: support serial interface mode switching Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 10/14] serial: 8250: allow low-level drivers to override break control Crescent Hsieh
2026-07-29  6:05 ` [PATCH v4 11/14] serial: 8250_mxpcie: add break support for RS485 using MUEx50 features Crescent Hsieh
2026-07-30  6:01   ` Jiri Slaby
2026-07-29  6:06 ` [PATCH v4 12/14] serial: 8250: allow UART drivers to override rx_trig_bytes handling Crescent Hsieh
2026-07-29  6:06 ` [PATCH v4 13/14] serial: 8250_mxpcie: introduce per-port private data structure Crescent Hsieh
2026-07-29  6:06 ` [PATCH v4 14/14] serial: 8250_mxpcie: implement rx_trig_bytes callbacks via MUEx50 RTL Crescent Hsieh
2026-07-30  6:05 ` [PATCH v4 00/14] serial: 8250: add Moxa MUEx50 PCIe board support Jiri Slaby
2026-07-30 14:43   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82cb09bd-7f95-4cb8-9cd9-634dbcf38729@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=EddieSY.Lin@moxa.com \
    --cc=Epson.Chiang@moxa.com \
    --cc=FangpingFP.Cheng@moxa.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=crescentcy.hsieh@moxa.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox