From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-serial@vger.kernel.org
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>,
Sascha Hauer <s.hauer@pengutronix.de>,
Sergey Organov <sorganov@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] serial: imx: use UPF_AUTO_CTS
Date: Wed, 26 Jun 2019 12:15:57 +0200 [thread overview]
Message-ID: <20190626101557.26299-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190626101557.26299-1-s.hauer@pengutronix.de>
The i.MX driver doesn't set the UPF_AUTO_CTS flag which means that
uart_handle_cts_change() will stop/start the receiver on CTS changes.
This is completely unnecessary as the hardware will handle CTS
changes automatically.
With UPF_AUTO_CTS enabled uart_handle_cts_change() boils down to
increasing the CTS statistic counter. For clarity inline increasing
the counter instead of calling uart_handle_cts_change().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/tty/serial/imx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 0419a084c0ed..82f987dab066 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -703,13 +703,11 @@ static void imx_uart_start_tx(struct uart_port *port)
static irqreturn_t imx_uart_rtsint(int irq, void *dev_id)
{
struct imx_port *sport = dev_id;
- u32 usr1;
spin_lock(&sport->port.lock);
imx_uart_writel(sport, USR1_RTSD, USR1);
- usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS;
- uart_handle_cts_change(&sport->port, !!usr1);
+ sport->port.icount.cts++;
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
spin_unlock(&sport->port.lock);
@@ -1588,6 +1586,9 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
} else if (termios->c_cflag & CRTSCTS) {
if (ucr2 & UCR2_CTS)
ucr2 |= UCR2_CTSC;
+ port->status |= UPSTAT_AUTOCTS;
+ } else {
+ port->status &= ~UPSTAT_AUTOCTS;
}
if (termios->c_cflag & CRTSCTS)
@@ -1706,6 +1707,9 @@ static void imx_uart_config_port(struct uart_port *port, int flags)
if (flags & UART_CONFIG_TYPE)
sport->port.type = PORT_IMX;
+
+ if (sport->have_rtscts)
+ sport->port.flags |= UPF_AUTO_CTS;
}
/*
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-06-26 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 10:15 [PATCH 0/2] serial: imx: use UPF_AUTO_CTS Sascha Hauer
2019-06-26 10:15 ` [PATCH 1/2] serial: imx: remove duplicate handling of CTS change Sascha Hauer
2019-06-27 6:16 ` Uwe Kleine-König
2019-06-27 7:59 ` Sascha Hauer
2019-06-26 10:15 ` Sascha Hauer [this message]
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=20190626101557.26299-3-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-serial@vger.kernel.org \
--cc=sorganov@gmail.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;
as well as URLs for NNTP newsgroup(s).