Re: [PATCH RESEND 1/5] USB: serial: cp210x: Fixed RTS mode setting by the CRTSCTS flag.

From: Johan Hovold
Date: Mon Apr 25 2016 - 06:11:09 EST


On Sun, Apr 24, 2016 at 12:08:55PM -0500, Konstantin Shkolnyy wrote:
> A bug in the CRTSCT handling caused RTS to alternate between
> CRTSCTS=0 => "RTS transmits active signal" and
> CRTSCTS=1 => "RTS receives flow control"
> instead of
> CRTSCTS=0 => "RTS is statically active" and
> CRTSCTS=1 => "RTS receives flow control"

Perhaps you should mention that this only happens after first having
enabled CRTSCTS.

> Signed-off-by: Konstantin Shkolnyy <konstantin.shkolnyy@xxxxxxxxx>
> ---
> drivers/usb/serial/cp210x.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
> index c740592..de1606f 100644
> --- a/drivers/usb/serial/cp210x.c
> +++ b/drivers/usb/serial/cp210x.c
> @@ -955,16 +955,12 @@ static void cp210x_set_termios(struct tty_struct *tty,
> modem_ctl[0] &= ~0x7B;
> modem_ctl[0] |= 0x09;
> modem_ctl[4] = 0x80;
> - /* FIXME - why clear reserved bits just read? */
> - modem_ctl[5] = 0;
> - modem_ctl[6] = 0;

This is an unrelated chunk. Perhaps include it when addressing the
XOFF_CONTINUE bit.

> modem_ctl[7] = 0;
> dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
> } else {
> modem_ctl[0] &= ~0x7B;
> modem_ctl[0] |= 0x01;
> - /* FIXME - OR here instead of assignment looks wrong */
> - modem_ctl[4] |= 0x40;
> + modem_ctl[4] = 0x40;
> dev_dbg(dev, "%s - flow control = NONE\n", __func__);
> }

Ideally modifying the RTS mask should not clear unrelated flags as break
char insertion. But as we don't use these currently so this would be
fine as a fix for now.

Thanks,
Johan