Re: [PATCH v4 11/14] serial: 8250_mxpcie: add break support for RS485 using MUEx50 features

Jiri Slaby <[email protected]> Thu, 30 Jul 2026 08:01:49 +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:
> On MUEx50, break signaling under RS485 requires a driver-specific
> sequence and cannot be handled correctly by the generic 8250 break
> implementation alone.
> 
> Implement a mxpcie break_ctl callback that performs MUEx50-specific
> break handling when RS485 is enabled and fall back to the default 8250
> break handling for other modes.
> 
> Signed-off-by: Crescent Hsieh <[email protected]>
> ---
>   drivers/tty/serial/8250/8250_mxpcie.c | 49 +++++++++++++++++++++++++++
>   1 file changed, 49 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c
> index 927615f2d724..878fc64c4451 100644
> --- a/drivers/tty/serial/8250/8250_mxpcie.c
> +++ b/drivers/tty/serial/8250/8250_mxpcie.c
> @@ -54,6 +54,7 @@
>   
>   /* Special Function Register (SFR) */
>   #define MOXA_PUART_SFR		0x07
> +#define MOXA_PUART_SFR_FORCE_TX	BIT(0)
>   #define MOXA_PUART_SFR_950	BIT(5)
>   
>   /* Enhanced Function Register (EFR) */
> @@ -384,6 +385,53 @@ static int mxpcie8250_handle_irq(struct uart_port *port)
>   	return 1;
>   }
>   
> +static void mxpcie8250_software_break_ctl(struct uart_port *port, int break_state)
> +{
> +	struct uart_8250_port *up = up_to_u8250p(port);
> +	struct tty_struct *tty = port->state->port.tty;
> +	unsigned char tx_byte = 0x01;

Do you actually need the variable? If so, it should be u8, given you 
call byte and use it as such.

> +	unsigned int baud, quot;
> +	u8 sfr;
> +
> +	guard(uart_port_lock_irqsave)(port);
> +
> +	if (break_state == -1) {
> +		serial_out(up, UART_LCR, up->lcr | UART_LCR_DLAB);
> +		serial_dl_write(up, 0);
> +		serial_out(up, UART_LCR, up->lcr);
> +
> +		serial_out(up, MOXA_PUART_TX_FIFO_MEM, tx_byte);

thanks,
-- 
js
suse labs