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

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

 



Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> writes:

> 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

Sorry, I fail to see how this patch breaks anything here. It just now
correctly does:

> 	(maybe) reactivate RTS to signal being ready again

step, touching nothing else.

Please notice that the line

>> -	old_ucr2 &= (UCR2_TXEN | UCR2_RXEN | UCR2_ATEN);

just changes internal variable, and changed to:

>> +	old_ucr2 &= (UCR2_CTS | UCR2_TXEN | UCR2_RXEN | UCR2_ATEN);

exactly to restore RTS state at exit.

It's then moved down to where it's used, to make code and comments
clearer. I decided it's too much granularity to break this into 2
separate patches.

-- Sergey



[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