From nobody Sun Jun 28 04:43:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D241BC433F5 for ; Mon, 14 Feb 2022 21:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231372AbiBNVc6 (ORCPT ); Mon, 14 Feb 2022 16:32:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbiBNVaq (ORCPT ); Mon, 14 Feb 2022 16:30:46 -0500 Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6B8214235D for ; Mon, 14 Feb 2022 13:30:36 -0800 (PST) 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=20Mo=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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 k= termios *termios, if (ucr2 & UCR2_CTS) ucr2 |=3D UCR2_CTSC; } - - if (termios->c_cflag & CRTSCTS) + if (!sport->have_ctsgpio && termios->c_cflag & CRTSCTS) ucr2 &=3D ~UCR2_IRTS; if (termios->c_cflag & CSTOPB) ucr2 |=3D UCR2_STPB; @@ -2227,6 +2227,9 @@ static int imx_uart_probe(struct platform_device *pde= v) if (of_get_property(np, "fsl,dte-mode", NULL)) sport->dte_mode =3D 1; =20 + if (of_get_property(np, "cts-gpios", NULL)) + sport->have_ctsgpio =3D 1; + if (of_get_property(np, "rts-gpios", NULL)) sport->have_rtsgpio =3D 1; =20 --=20 2.17.1