[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220214213020.685-1-tharvey@gateworks.com>
Date: Mon, 14 Feb 2022 13:30:20 -0800
From: Tim Harvey <tharvey@...eworks.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
linux-serial@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: Tomasz Moń <tomasz.mon@...lingroup.com>,
Richard Genoud <richard.genoud@...il.com>,
Sergey Organov <sorganov@...il.com>,
Tim Harvey <tharvey@...eworks.com>
Subject: [PATCH] serial: imx: leave IRTS disabled if using modem-control CTS
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 <tharvey@...eworks.com>
---
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;
--
2.17.1
Powered by blists - more mailing lists