From: Rickard Andersson <rickaran@axis.com>
To: <linux-serial@vger.kernel.org>, <rickard314.andersson@gmail.com>,
<gregkh@linuxfoundation.org>, <shawnguo@kernel.org>,
<s.hauer@pengutronix.de>, <kernel@pengutronix.de>,
<festevam@gmail.com>, <linux-imx@nxp.com>,
<martin.fuzzey@flowbird.group>, <marex@denx.de>
Cc: <rickaran@axis.com>, <kernel@axis.com>
Subject: [PATCH] tty: serial: imx: Fix broken RS485
Date: Fri, 16 Feb 2024 13:46:01 +0100 [thread overview]
Message-ID: <20240216124601.3752039-1-rickaran@axis.com> (raw)
From: Rickard x Andersson <rickaran@axis.com>
When about to transmit the function imx_uart_start_tx is called and in
some RS485 configurations this function will call imx_uart_stop_rx. The
problem is that imx_uart_stop_rx will enable loopback and when loopback
is enabled transmitted data will just be looped to RX.
This patch fixes the above problem by explicitly disabling loopback in
the case described above.
Signed-off-by: Rickard x Andersson <rickaran@axis.com>
---
drivers/tty/serial/imx.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 4aa72d5aeafb..899e331bdfc8 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -683,8 +683,15 @@ static void imx_uart_start_tx(struct uart_port *port)
imx_uart_writel(sport, ucr2, UCR2);
if (!(port->rs485.flags & SER_RS485_RX_DURING_TX) &&
- !port->rs485_rx_during_tx_gpio)
+ !port->rs485_rx_during_tx_gpio) {
imx_uart_stop_rx(port);
+ /*
+ * The function imx_uart_stop_rx right above
+ * will enable loopback, but since we are just
+ * about to transmit then disable loopback.
+ */
+ imx_uart_disable_loopback_rs485(sport);
+ }
sport->tx_state = WAIT_AFTER_RTS;
--
2.30.2
next reply other threads:[~2024-02-16 12:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 12:46 Rickard Andersson [this message]
2024-02-16 15:17 ` [PATCH] tty: serial: imx: Fix broken RS485 Marek Vasut
2024-02-20 6:07 ` Rickard X Andersson
2024-02-20 6:52 ` Marek Vasut
2024-02-20 8:39 ` Rickard X Andersson
2024-02-20 8:43 ` Marek Vasut
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=20240216124601.3752039-1-rickaran@axis.com \
--to=rickaran@axis.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@axis.com \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-serial@vger.kernel.org \
--cc=marex@denx.de \
--cc=martin.fuzzey@flowbird.group \
--cc=rickard314.andersson@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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