USB: serial: xr: fix gpio-mode handling
authorJohan Hovold <johan@kernel.org>
Thu, 21 Jan 2021 10:29:20 +0000 (11:29 +0100)
committerJohan Hovold <johan@kernel.org>
Tue, 26 Jan 2021 15:16:50 +0000 (16:16 +0100)
Fix the gpio-mode handling so that all the pins are under driver control
(i.e. in gpio mode) when hardware flow control is disabled.

This is specifically needed to be able to control RTS.

Fixes: c2d405aa86b4 ("USB: serial: add MaxLinear/Exar USB to Serial driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/xr_serial.c

index fc727f4283f2598736d3b57d0cc0184e1673807a..183731cd2ef74e99d79d20c3592c77ea2c4baec0 100644 (file)
@@ -408,14 +408,11 @@ static void xr_set_flow_mode(struct tty_struct *tty,
        if (ret)
                return;
 
+       /* Set GPIO mode for controlling the pins manually by default. */
+       gpio_mode &= ~XR21V141X_UART_MODE_GPIO_MASK;
+
        if (C_CRTSCTS(tty)) {
                dev_dbg(&port->dev, "Enabling hardware flow ctrl\n");
-
-               /*
-                * RTS/CTS is the default flow control mode, so set GPIO mode
-                * for controlling the pins manually by default.
-                */
-               gpio_mode &= ~XR21V141X_UART_MODE_GPIO_MASK;
                gpio_mode |= XR21V141X_UART_MODE_RTS_CTS;
                flow = XR21V141X_UART_FLOW_MODE_HW;
        } else if (I_IXON(tty)) {