Commit 0d05d7d9 authored by Johan Hovold's avatar Johan Hovold
Browse files

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: c2d405aa ("USB: serial: add MaxLinear/Exar USB to Serial driver")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 465d3b3a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);