Re: [PATCH 3/8] serial: imx: preserve RTS state over termios change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 30, 2019 at 06:29:45PM +0300, Sergey Organov wrote:
> imx_set_mctrl() cleared RTS on every call


> 
> Signed-off-by: Sergey Organov <sorganov@xxxxxxxxx>
> ---
>  drivers/tty/serial/imx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 6577552..13face9 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1648,7 +1648,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
>  
>  	/* then, disable everything */
>  	imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2);
> -	old_ucr2 &= (UCR2_TXEN | UCR2_RXEN | UCR2_ATEN);
>  
>  	/* custom-baudrate handling */
>  	div = sport->port.uartclk / (baud * 16);
> @@ -1686,7 +1685,8 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
>  
>  	imx_uart_writel(sport, old_ucr1, UCR1);
>  
> -	/* set the parity, stop bits and data size */
> +	/* Set parity, stop bits, data size, etc. Keep bits we don't compute. */
> +	old_ucr2 &= (UCR2_CTS | UCR2_TXEN | UCR2_RXEN | UCR2_ATEN);

I wonder if that fixes a certain usecase and breaks another.

If I change the baud rate of the UART the sequence I actually want to
have is:

	clear RTS (to not encourage the other side to send data)
	disable receiver
	reconfigure requested settings
	reenable receiver
	(maybe) reactivate RTS to signal being ready again

So I think your approach is too simple.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux