From: Tim Harvey <tharvey@gateworks.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: "Tomasz Moń" <tomasz.mon@camlingroup.com>,
"Richard Genoud" <richard.genoud@gmail.com>,
"Sergey Organov" <sorganov@gmail.com>,
"Tim Harvey" <tharvey@gateworks.com>
Subject: [PATCH] serial: imx: leave IRTS disabled if using modem-control CTS
Date: Mon, 14 Feb 2022 13:30:20 -0800 [thread overview]
Message-ID: <20220214213020.685-1-tharvey@gateworks.com> (raw)
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@gateworks.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
next reply other threads:[~2022-02-14 21:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 21:30 Tim Harvey [this message]
2022-02-15 6:03 ` Tomasz Moń
2022-02-15 17:26 ` Tim Harvey
2022-02-16 5:45 ` Tomasz Moń
2022-02-17 16:22 ` Tim Harvey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220214213020.685-1-tharvey@gateworks.com \
--to=tharvey@gateworks.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=richard.genoud@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=sorganov@gmail.com \
--cc=tomasz.mon@camlingroup.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®