From patchwork Thu Jan 21 10:29:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 368410 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 C2C57C433DB for ; Thu, 21 Jan 2021 13:03:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EA1E239FD for ; Thu, 21 Jan 2021 13:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731614AbhAUNDj (ORCPT ); Thu, 21 Jan 2021 08:03:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:60230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729297AbhAUKbU (ORCPT ); Thu, 21 Jan 2021 05:31:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D6B7C239E7; 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=1611224970; bh=LB7JmBqWiGACFdERW0/yScBVALQ/zUAt6uErRz6Q0Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbvEIKNKDcVf2nhJ8r5xynsebn/9kNQ84p1/eJlBNBd5yZCJzqHAlYFD9U6BMQ122 EWyQx/nb1IxRdaGrOdEHJ9OK7zBpVNO1aua/YsaD8pfNs00qEv3tyU2oa3NXnaF0n3 To9n6l6JKHAP1REIMo0mZ+/ALfDX0MciawSfbQaPjzhhh/VOMtXrWItU0jr9TXFWrJ MzqhTQP/fbHrRmd/bKG8+3+M9LcY/6nUE4NzeQ73QeQ2xe9yJW08BZ6DZJG/A+lDe4 QU2csgJJEqGYO8jls2EEvQTWYvHAqJkb1m8UAlgcDtqH1NjvhFmt4+BORtrZ+r621D pBR051hjMS98Q== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1l2XDd-0004Yd-8U; 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 08/10] USB: serial: xr: fix gpio-mode handling Date: Thu, 21 Jan 2021 11:29:20 +0100 Message-Id: <20210121102922.17439-10-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 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: a8f54b7bd132 ("USB: serial: add MaxLinear/Exar USB to Serial driver") Signed-off-by: Johan Hovold --- drivers/usb/serial/xr_serial.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c index fc727f4283f2..183731cd2ef7 100644 --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c @@ -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)) {