From patchwork Thu Jan 21 10:29:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12036087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 600B8C433E0 for ; Thu, 21 Jan 2021 13:03:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BE6E239FD for ; Thu, 21 Jan 2021 13:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731590AbhAUND3 (ORCPT ); Thu, 21 Jan 2021 08:03:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:60224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729276AbhAUKbU (ORCPT ); Thu, 21 Jan 2021 05:31:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C80CA2399A; Thu, 21 Jan 2021 10:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611224969; bh=DEeqkkmfzEshOH9YcHBTh0nZBMY1kefvozqEmVaGwrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HoZVQnIfaIcftewG35mfdBs0Y22w215QvhpVz0YmxMvmWz7iSdBHXcsWmdvDvmygT E02t+4D74xIYR8BAMctLk1QRdYnS85gkaD6dpYcVlm6pdu9aCj3KU58Go9tOBw7jVs jJahfNOiZ7/+xahSl8lvGI27B71E5UEe9WAg7wWPFHhwi9jIq/b3qYdO8tEUr2nwAv vBhMjZtsbma0Y3zTv/I8fjId3oyF5PwE+2xWsq8IU35cjzdDHAmBesu8I6ruaB62B0 taFq1SNw3dcWLPzXhU2NqLAKK3zD+RlnRJJF1gDlGov0/F498uwZGbd4qSK666an7v xzS0NTBcKNbnw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1l2XDd-0004Yg-C6; Thu, 21 Jan 2021 11:29:37 +0100 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Manivannan Sadhasivam , linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 09/10] USB: serial: xr: fix pin configuration Date: Thu, 21 Jan 2021 11:29:21 +0100 Message-Id: <20210121102922.17439-11-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210121102922.17439-1-johan@kernel.org> References: <20210121102922.17439-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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: a8f54b7bd132 ("USB: serial: add MaxLinear/Exar USB to Serial driver") Signed-off-by: Johan Hovold --- drivers/usb/serial/xr_serial.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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);