summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-01-21 11:29:21 +0100
committerJohan Hovold <johan@kernel.org>2021-01-26 16:16:56 +0100
commit0d05d7d913892cd093acc5a0ac884ebab9fda67c (patch)
tree61fa11b125f5c3a011b94cf6b557548a8a66ba3c /drivers/usb
parentUSB: serial: xr: fix gpio-mode handling (diff)
downloadlinux-0d05d7d913892cd093acc5a0ac884ebab9fda67c.tar.xz
linux-0d05d7d913892cd093acc5a0ac884ebab9fda67c.zip
USB: serial: xr: fix pin configuration
Make sure that the modem pins are set up correctly when opening the port to avoid leaving, for example, DTR and RTS configured as inputs, which is the device default. This is specifically needed to be able to control DTR and RTS when hardware flow control is disabled. Fixes: c2d405aa86b4 ("USB: serial: add MaxLinear/Exar USB to Serial driver") Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/xr_serial.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c
index 183731cd2ef7..f67e7dba9509 100644
--- a/drivers/usb/serial/xr_serial.c
+++ b/drivers/usb/serial/xr_serial.c
@@ -502,6 +502,7 @@ static void xr_set_termios(struct tty_struct *tty,
static int xr_open(struct tty_struct *tty, struct usb_serial_port *port)
{
+ u8 gpio_dir;
int ret;
ret = xr_uart_enable(port);
@@ -510,6 +511,13 @@ static int xr_open(struct tty_struct *tty, struct usb_serial_port *port)
return ret;
}
+ /*
+ * Configure DTR and RTS as outputs and RI, CD, DSR and CTS as
+ * inputs.
+ */
+ gpio_dir = XR21V141X_UART_MODE_DTR | XR21V141X_UART_MODE_RTS;
+ xr_set_reg_uart(port, XR21V141X_REG_GPIO_DIR, gpio_dir);
+
/* Setup termios */
if (tty)
xr_set_termios(tty, port, NULL);