Re: [PATCH 1/8] serial: imx: fix DTR inversion

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

 



On Thu, May 30, 2019 at 06:29:43PM +0300, Sergey Organov wrote:
> imx_set_mctrl() had TIOCM_DTR meaning inverted
> 
> Signed-off-by: Sergey Organov <sorganov@xxxxxxxxx>
> ---
>  drivers/tty/serial/imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index dff75dc..e9e812a 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -974,7 +974,7 @@ static void imx_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
>  	}
>  
>  	ucr3 = imx_uart_readl(sport, UCR3) & ~UCR3_DSR;
> -	if (!(mctrl & TIOCM_DTR))
> +	if (mctrl & TIOCM_DTR)
>  		ucr3 |= UCR3_DSR;
>  	imx_uart_writel(sport, ucr3, UCR3);

I'm not sure this is right and your commit log is too short to convince
me otherwise.

In the past I had several customers that used handshaking on an imx UART
so I'd be surprised if such a bug would have stayed unnoticed until now.

The i.MX25 Reference manual states:

	This bit [UCR3_DSR] used by software to control the DSR/DTR output pin
	for the modem interface. In DCE mode it applies to DSR and in DTE mode
	it applies to DTR.

		0 DSR/ DTR pin is logic zero
		1 DSR/ DTR pin is logic one


Semantically if TIOCM_DTR is set in .set_mctrl, the DTR output should
become active (i.e. low). Without testing I'm not sure if "active"
corresponds to "logic one" which would make your patch correct.

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