From patchwork Mon Feb 14 21:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 12746173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68A12C433F5 for ; Mon, 14 Feb 2022 21:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=S4jHqButiy4kEFvnN92DO52MWCxRT6ec0AyakiaX+jI=; b=f5YMnTrRn8Q0Mt 5hxDrNws5j9pz13GFB2Vk1AiArCYwr5x8l8B2cQvSZlz6gt84dC853BnuIowsEZ7iynMxqS+le0Bw FxUAhSiwgTzAjVnxlhk5+DndHcC1KtDdlEujpMEI+kxEQc1uDEnR2bNo2v66LvmjA+3MAmkFEw2jZ IXMjbHwtcURdwebH/cXD4AL74nAHBipFkCvp4hL531Ab1X0QUoA/P21lNEBmtZ/bHChnnKSGKBkbz R/TnJHFKRzS34kfe6goHBGZi03K5ZGAz6MOoUv1zy/2EFhuFBBIzK7c3nW3Q2vFy27flRea6/eMgj AY2w7pJnQV+4l7qaExrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJj8m-00H6oV-0G; Mon, 14 Feb 2022 21:44:12 +0000 Received: from finn.gateworks.com ([108.161.129.64] helo=finn.localdomain) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJiva-00H1kQ-EC for linux-arm-kernel@lists.infradead.org; Mon, 14 Feb 2022 21:30:35 +0000 Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1nJivO-00AkGx-Ej; Mon, 14 Feb 2022 21:30:22 +0000 From: Tim Harvey To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Tomasz_Mo=C5=84?= , Richard Genoud , Sergey Organov , Tim Harvey Subject: [PATCH] serial: imx: leave IRTS disabled if using modem-control CTS Date: Mon, 14 Feb 2022 13:30:20 -0800 Message-Id: <20220214213020.685-1-tharvey@gateworks.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220214_133034_534859_8D0E56BE X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If using modem-control gpios for CTS we must leave IRTS disabled as otherwise the hardware will only transmit based on the internal RTS pin routed to it. This allows hardware flow control to be used with cts-gpios. Signed-off-by: Tim Harvey --- drivers/tty/serial/imx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index df8a0c8b8b29..bf2bb987a51f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -201,6 +201,7 @@ struct imx_port { unsigned int old_status; unsigned int have_rtscts:1; unsigned int have_rtsgpio:1; + unsigned int have_ctsgpio:1; unsigned int dte_mode:1; unsigned int inverted_tx:1; unsigned int inverted_rx:1; @@ -1674,8 +1675,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, if (ucr2 & UCR2_CTS) ucr2 |= UCR2_CTSC; } - - if (termios->c_cflag & CRTSCTS) + if (!sport->have_ctsgpio && termios->c_cflag & CRTSCTS) ucr2 &= ~UCR2_IRTS; if (termios->c_cflag & CSTOPB) ucr2 |= UCR2_STPB; @@ -2227,6 +2227,9 @@ static int imx_uart_probe(struct platform_device *pdev) if (of_get_property(np, "fsl,dte-mode", NULL)) sport->dte_mode = 1; + if (of_get_property(np, "cts-gpios", NULL)) + sport->have_ctsgpio = 1; + if (of_get_property(np, "rts-gpios", NULL)) sport->have_rtsgpio = 1;