* [PATCH v2] tty: serial: imx: Fix broken RS485
@ 2024-02-20 6:12 Rickard Andersson
2024-02-20 6:53 ` Marek Vasut
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Rickard Andersson @ 2024-02-20 6:12 UTC (permalink / raw)
To: linux-serial, rickard314.andersson, gregkh, shawnguo, s.hauer,
kernel, festevam, linux-imx, martin.fuzzey, marex
Cc: rickaran, kernel
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.
Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tty: serial: imx: Fix broken RS485
2024-02-20 6:12 [PATCH v2] tty: serial: imx: Fix broken RS485 Rickard Andersson
@ 2024-02-20 6:53 ` Marek Vasut
2024-02-20 6:53 ` Greg KH
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2024-02-20 6:53 UTC (permalink / raw)
To: Rickard Andersson, linux-serial, rickard314.andersson, gregkh,
shawnguo, s.hauer, kernel, festevam, linux-imx, martin.fuzzey
Cc: kernel, Christoph Niedermaier
On 2/20/24 07:12, Rickard Andersson wrote:
> 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.
>
> Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
> 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;
>
+CC Christoph, I suspect he will comment on this soon-ish, we had an
off-list discussion about this yesterday.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tty: serial: imx: Fix broken RS485
2024-02-20 6:12 [PATCH v2] tty: serial: imx: Fix broken RS485 Rickard Andersson
2024-02-20 6:53 ` Marek Vasut
@ 2024-02-20 6:53 ` Greg KH
2024-02-20 6:53 ` Greg KH
2024-02-20 9:55 ` [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX Christoph Niedermaier
3 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2024-02-20 6:53 UTC (permalink / raw)
To: Rickard Andersson
Cc: linux-serial, rickard314.andersson, shawnguo, s.hauer, kernel,
festevam, linux-imx, martin.fuzzey, marex, kernel
On Tue, Feb 20, 2024 at 07:12:43AM +0100, Rickard Andersson wrote:
> 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.
>
> Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
> Signed-off-by: Rickard x Andersson <rickaran@axis.com>
> ---
> drivers/tty/serial/imx.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/process/submitting-patches.rst for what
needs to be done here to properly describe this.
- You sent a patch that has been sent multiple times in the past few
days, and is identical to ones that has been recently rejected.
Please always look at the mailing list traffic to determine if you are
duplicating other people's work.
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tty: serial: imx: Fix broken RS485
2024-02-20 6:12 [PATCH v2] tty: serial: imx: Fix broken RS485 Rickard Andersson
2024-02-20 6:53 ` Marek Vasut
2024-02-20 6:53 ` Greg KH
@ 2024-02-20 6:53 ` Greg KH
2024-02-20 9:55 ` [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX Christoph Niedermaier
3 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2024-02-20 6:53 UTC (permalink / raw)
To: Rickard Andersson
Cc: linux-serial, rickard314.andersson, shawnguo, s.hauer, kernel,
festevam, linux-imx, martin.fuzzey, marex, kernel
On Tue, Feb 20, 2024 at 07:12:43AM +0100, Rickard Andersson wrote:
> 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.
>
> Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
> 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
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX
2024-02-20 6:12 [PATCH v2] tty: serial: imx: Fix broken RS485 Rickard Andersson
` (2 preceding siblings ...)
2024-02-20 6:53 ` Greg KH
@ 2024-02-20 9:55 ` Christoph Niedermaier
2024-02-20 10:57 ` Christoph Niedermaier
3 siblings, 1 reply; 9+ messages in thread
From: Christoph Niedermaier @ 2024-02-20 9:55 UTC (permalink / raw)
To: linux-serial
Cc: Christoph Niedermaier, Greg Kroah-Hartman, Jiri Slaby, Shawn Guo,
Marek Vasut, Fabio Estevam, Sascha Hauer, Pengutronix Kernel Team,
NXP Linux Team, Sergey Organov, Uwe Kleine-König,
Rob Herring, Ilpo Järvinen, Tom Rix, Thomas Gleixner,
Lukas Wunner
I have made a patch that does not enable the loopback when
the RX_DURING_TX flag is disabled. Would you be so kind to
test my patch to see if it also solves your problem.
Regards
Christoph
Commit 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
activated the loopback mode for RS485 controlled by UART CTS_B when the
function imx_uart_stop_rx() is called. But through that changes the RS485
flag RX_DURING_TX isn’t able to turn off the receiver anymore. If the flag
RX_DURING_TX is disabled everything that was sent will be received due to
the active loopback. To turn off the receiver in this case the function
imx_uart_stop_rx() is extended by a wrapper function
imx_uart_stop_rx_with_loopback_rs485_ctrl() for the use of RS485 with
disabled flag RX_DURING_TX, where the receiver is turn off. For all other
cases there aren’t a functional change.
When the receiver is turned off the UART CTS_B signal is always high. To
ensure that the RS485 bus won’t blocked by a disabled receiver caused by a
high UART CTS_B signal the function imx_uart_shutdown() is extended. So in
RS485 loopback mode the receiver is always on after shutdown the device.
Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
---
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Sergey Organov <sorganov@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Rob Herring <robh@kernel.org>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Tom Rix <trix@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Lukas Wunner <lukas@wunner.de>
To: linux-serial@vger.kernel.org
---
drivers/tty/serial/imx.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 4aa72d5aeafb..222e2c929bd7 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -463,7 +463,8 @@ static void imx_uart_stop_tx(struct uart_port *port)
}
/* called with port.lock taken and irqs off */
-static void imx_uart_stop_rx(struct uart_port *port)
+static void imx_uart_stop_rx_with_loopback_rs485_ctrl(struct uart_port *port,
+ bool loopback_rs485_enable)
{
struct imx_port *sport = (struct imx_port *)port;
u32 ucr1, ucr2, ucr4, uts;
@@ -483,7 +484,7 @@ static void imx_uart_stop_rx(struct uart_port *port)
imx_uart_writel(sport, ucr4, UCR4);
/* See SER_RS485_ENABLED/UTS_LOOP comment in imx_uart_probe() */
- if (port->rs485.flags & SER_RS485_ENABLED &&
+ if (port->rs485.flags & SER_RS485_ENABLED && loopback_rs485_enable &&
port->rs485.flags & SER_RS485_RTS_ON_SEND &&
sport->have_rtscts && !sport->have_rtsgpio) {
uts = imx_uart_readl(sport, imx_uart_uts_reg(sport));
@@ -498,6 +499,12 @@ static void imx_uart_stop_rx(struct uart_port *port)
}
/* called with port.lock taken and irqs off */
+static void imx_uart_stop_rx(struct uart_port *port)
+{
+ imx_uart_stop_rx_with_loopback_rs485_ctrl(port, 1);
+}
+
+/* called with port.lock taken and irqs off */
static void imx_uart_enable_ms(struct uart_port *port)
{
struct imx_port *sport = (struct imx_port *)port;
@@ -684,7 +691,7 @@ static void imx_uart_start_tx(struct uart_port *port)
if (!(port->rs485.flags & SER_RS485_RX_DURING_TX) &&
!port->rs485_rx_during_tx_gpio)
- imx_uart_stop_rx(port);
+ imx_uart_stop_rx_with_loopback_rs485_ctrl(port, 0);
sport->tx_state = WAIT_AFTER_RTS;
@@ -1596,6 +1603,9 @@ static void imx_uart_shutdown(struct uart_port *port)
uts = imx_uart_readl(sport, imx_uart_uts_reg(sport));
uts |= UTS_LOOP;
imx_uart_writel(sport, uts, imx_uart_uts_reg(sport));
+ ucr2 = imx_uart_readl(sport, UCR2);
+ ucr2 |= UCR2_RXEN;
+ imx_uart_writel(sport, ucr2, UCR2);
ucr1 |= UCR1_UARTEN;
} else {
ucr1 &= ~UCR1_UARTEN;
--
2.11.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX
2024-02-20 9:55 ` [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX Christoph Niedermaier
@ 2024-02-20 10:57 ` Christoph Niedermaier
2024-03-07 11:07 ` Tobias Jakobi (Compleo)
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Niedermaier @ 2024-02-20 10:57 UTC (permalink / raw)
To: linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman, Jiri Slaby, Shawn Guo, Marek Vasut,
Fabio Estevam, Sascha Hauer, Pengutronix Kernel Team,
NXP Linux Team, Sergey Organov, Uwe Kleine-König,
Rob Herring, Ilpo Järvinen, Tom Rix, Thomas Gleixner,
Lukas Wunner, Rickard X Andersson, rickard314.andersson@gmail.com
> From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
> Sent: Tuesday, February 20, 2024 10:56 AM
> To: linux-serial@vger.kernel.org
> Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Jiri Slaby <jirislaby@kernel.org>; Shawn Guo
> <shawnguo@kernel.org>; Marek Vasut <marex@denx.de>; Fabio Estevam <festevam@denx.de>;
> Sascha Hauer <s.hauer@pengutronix.de>; Pengutronix Kernel Team <kernel@pengutronix.de>;
> NXP Linux Team <linux-imx@nxp.com>; Sergey Organov <sorganov@gmail.com>; Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de>; Rob Herring <robh@kernel.org>; Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com>; Tom Rix <trix@redhat.com>; Thomas Gleixner
> <tglx@linutronix.de>; Lukas Wunner <lukas@wunner.de>
> Subject: [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX
>
> I have made a patch that does not enable the loopback when
> the RX_DURING_TX flag is disabled. Would you be so kind to
> test my patch to see if it also solves your problem.
>
> Regards
> Christoph
+CC Rickard X Andersson, because missed to add him.
>
>
> Commit 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
> activated the loopback mode for RS485 controlled by UART CTS_B when the
> function imx_uart_stop_rx() is called. But through that changes the RS485
> flag RX_DURING_TX isn’t able to turn off the receiver anymore. If the flag
> RX_DURING_TX is disabled everything that was sent will be received due to
> the active loopback. To turn off the receiver in this case the function
> imx_uart_stop_rx() is extended by a wrapper function
> imx_uart_stop_rx_with_loopback_rs485_ctrl() for the use of RS485 with
> disabled flag RX_DURING_TX, where the receiver is turn off. For all other
> cases there aren’t a functional change.
>
> When the receiver is turned off the UART CTS_B signal is always high. To
> ensure that the RS485 bus won’t blocked by a disabled receiver caused by a
> high UART CTS_B signal the function imx_uart_shutdown() is extended. So in
> RS485 loopback mode the receiver is always on after shutdown the device.
>
> Fixes: 79d0224f6bf2 ("tty: serial: imx: Handle RS485 DE signal active high")
> Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
> ---
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jirislaby@kernel.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Fabio Estevam <festevam@denx.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Sergey Organov <sorganov@gmail.com>
> Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> Cc: Rob Herring <robh@kernel.org>
> Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
> Cc: Tom Rix <trix@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Lukas Wunner <lukas@wunner.de>
> To: linux-serial@vger.kernel.org
> ---
> drivers/tty/serial/imx.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 4aa72d5aeafb..222e2c929bd7 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -463,7 +463,8 @@ static void imx_uart_stop_tx(struct uart_port *port)
> }
>
> /* called with port.lock taken and irqs off */
> -static void imx_uart_stop_rx(struct uart_port *port)
> +static void imx_uart_stop_rx_with_loopback_rs485_ctrl(struct uart_port *port,
> + bool loopback_rs485_enable)
> {
> struct imx_port *sport = (struct imx_port *)port;
> u32 ucr1, ucr2, ucr4, uts;
> @@ -483,7 +484,7 @@ static void imx_uart_stop_rx(struct uart_port *port)
> imx_uart_writel(sport, ucr4, UCR4);
>
> /* See SER_RS485_ENABLED/UTS_LOOP comment in imx_uart_probe() */
> - if (port->rs485.flags & SER_RS485_ENABLED &&
> + if (port->rs485.flags & SER_RS485_ENABLED && loopback_rs485_enable &&
> port->rs485.flags & SER_RS485_RTS_ON_SEND &&
> sport->have_rtscts && !sport->have_rtsgpio) {
> uts = imx_uart_readl(sport, imx_uart_uts_reg(sport));
> @@ -498,6 +499,12 @@ static void imx_uart_stop_rx(struct uart_port *port)
> }
>
> /* called with port.lock taken and irqs off */
> +static void imx_uart_stop_rx(struct uart_port *port)
> +{
> + imx_uart_stop_rx_with_loopback_rs485_ctrl(port, 1);
> +}
> +
> +/* called with port.lock taken and irqs off */
> static void imx_uart_enable_ms(struct uart_port *port)
> {
> struct imx_port *sport = (struct imx_port *)port;
> @@ -684,7 +691,7 @@ static void imx_uart_start_tx(struct uart_port *port)
>
> if (!(port->rs485.flags & SER_RS485_RX_DURING_TX) &&
> !port->rs485_rx_during_tx_gpio)
> - imx_uart_stop_rx(port);
> + imx_uart_stop_rx_with_loopback_rs485_ctrl(port, 0);
>
> sport->tx_state = WAIT_AFTER_RTS;
>
> @@ -1596,6 +1603,9 @@ static void imx_uart_shutdown(struct uart_port *port)
> uts = imx_uart_readl(sport, imx_uart_uts_reg(sport));
> uts |= UTS_LOOP;
> imx_uart_writel(sport, uts, imx_uart_uts_reg(sport));
> + ucr2 = imx_uart_readl(sport, UCR2);
> + ucr2 |= UCR2_RXEN;
> + imx_uart_writel(sport, ucr2, UCR2);
> ucr1 |= UCR1_UARTEN;
> } else {
> ucr1 &= ~UCR1_UARTEN;
> --
> 2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX
2024-02-20 10:57 ` Christoph Niedermaier
@ 2024-03-07 11:07 ` Tobias Jakobi (Compleo)
2024-03-07 12:38 ` Christoph Niedermaier
0 siblings, 1 reply; 9+ messages in thread
From: Tobias Jakobi (Compleo) @ 2024-03-07 11:07 UTC (permalink / raw)
To: cniedermaier
Cc: Rickard.Andersson, festevam, gregkh, ilpo.jarvinen, jirislaby,
kernel, linux-imx, linux-serial, lukas, marex,
rickard314.andersson, robh, s.hauer, shawnguo, sorganov, tglx,
trix, u.kleine-koenig
Hello,
I also noticed last year that RS485 was problematic on i.MX hardware. We
use a i.MX7 SoC located on a SoM by manufacturer Toradex. The SoM itself
is plugged into a proprietary board that features a Renesas ISL8xxx
RS485 transceiver. We talk ModBus RTU over the RS485 link. The SoC is
the ModBus master, the slave is a insulation monitoring device.
Since we source the i.MX through Toradex, I opened a thread on their
community forum last year:
https://community.toradex.com/t/fixing-native-rs485-de-toggling-on-uart6/20573
I also realized very quickly that the newly introduced loopback logic
was the culprit. My solution currently consists of a new DT property
that effectively disables the toggling of the loopback mode:
https://gitlab.freedesktop.org/tobiasjakobi.compleo/linux-toradex/-/commit/98397c9436f48a149e2da0b2969a2d1d2d88c611
Anyway, I have tested Christoph's patch and can confirm that the patch
(also) fixes the problems we are seeing. Test was done by applying the
patch to 6.1.80. I haven't tested Rickard's patch so far.
Would be nice if this could later be backported to the 6.1.x kernel
(this is the kernel we currently use on our hardware).
With best wishes,
Tobias
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX
2024-03-07 11:07 ` Tobias Jakobi (Compleo)
@ 2024-03-07 12:38 ` Christoph Niedermaier
2024-03-07 14:10 ` Tobias Jakobi (Compleo)
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Niedermaier @ 2024-03-07 12:38 UTC (permalink / raw)
To: Tobias Jakobi (Compleo)
Cc: Rickard.Andersson@axis.com, festevam@denx.de,
gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com,
jirislaby@kernel.org, kernel@pengutronix.de, linux-imx@nxp.com,
linux-serial@vger.kernel.org, lukas@wunner.de, marex@denx.de,
rickard314.andersson@gmail.com, robh@kernel.org,
s.hauer@pengutronix.de, shawnguo@kernel.org, sorganov@gmail.com,
tglx@linutronix.de, trix@redhat.com,
u.kleine-koenig@pengutronix.de
From: Tobias Jakobi (Compleo) <tobias.jakobi.compleo@gmail.com>
Sent: Thursday, March 7, 2024 12:07 PM
>
> Hello,
>
> I also noticed last year that RS485 was problematic on i.MX hardware. We
> use a i.MX7 SoC located on a SoM by manufacturer Toradex. The SoM itself
> is plugged into a proprietary board that features a Renesas ISL8xxx
> RS485 transceiver. We talk ModBus RTU over the RS485 link. The SoC is
> the ModBus master, the slave is a insulation monitoring device.
>
> Since we source the i.MX through Toradex, I opened a thread on their
> community forum last year:
> https://community.toradex.com/t/fixing-native-rs485-de-toggling-on-uart6/20573
>
> I also realized very quickly that the newly introduced loopback logic
> was the culprit. My solution currently consists of a new DT property
> that effectively disables the toggling of the loopback mode:
> https://gitlab.freedesktop.org/tobiasjakobi.compleo/linux-toradex/-
> /commit/98397c9436f48a149e2da0b2969a2d1d2d88c611
>
> Anyway, I have tested Christoph's patch and can confirm that the patch
> (also) fixes the problems we are seeing. Test was done by applying the
> patch to 6.1.80. I haven't tested Rickard's patch so far.
>
> Would be nice if this could later be backported to the 6.1.x kernel
> (this is the kernel we currently use on our hardware).
Rickard's patch in version 3 solved the same problem, so it should also
fix the problem on your side. It has already been accepted and is already
available in the next Kernel. It has a Fixes tag on it, so it should normally
be backported to the 6.1.x Kernel soon.
Regards
Christo1ph
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX
2024-03-07 12:38 ` Christoph Niedermaier
@ 2024-03-07 14:10 ` Tobias Jakobi (Compleo)
0 siblings, 0 replies; 9+ messages in thread
From: Tobias Jakobi (Compleo) @ 2024-03-07 14:10 UTC (permalink / raw)
To: Christoph Niedermaier
Cc: Rickard.Andersson@axis.com, festevam@denx.de,
gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com,
jirislaby@kernel.org, kernel@pengutronix.de, linux-imx@nxp.com,
linux-serial@vger.kernel.org, lukas@wunner.de, marex@denx.de,
rickard314.andersson@gmail.com, robh@kernel.org,
s.hauer@pengutronix.de, shawnguo@kernel.org, sorganov@gmail.com,
tglx@linutronix.de, trix@redhat.com,
u.kleine-koenig@pengutronix.de
On 07.03.24 13:38, Christoph Niedermaier wrote:
> Rickard's patch in version 3 solved the same problem, so it should also
> fix the problem on your side. It has already been accepted and is already
> available in the next Kernel. It has a Fixes tag on it, so it should normally
> be backported to the 6.1.x Kernel soon.
Sounds good! Going to keep an eye open when it lands in the stable tree.
With best wishes,
Tobias
>
> Regards
> Christo1ph
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-03-07 14:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 6:12 [PATCH v2] tty: serial: imx: Fix broken RS485 Rickard Andersson
2024-02-20 6:53 ` Marek Vasut
2024-02-20 6:53 ` Greg KH
2024-02-20 6:53 ` Greg KH
2024-02-20 9:55 ` [RFC][PATCH] serial: imx: Fix RS485 behaviour on disabled RX_DURING_TX Christoph Niedermaier
2024-02-20 10:57 ` Christoph Niedermaier
2024-03-07 11:07 ` Tobias Jakobi (Compleo)
2024-03-07 12:38 ` Christoph Niedermaier
2024-03-07 14:10 ` Tobias Jakobi (Compleo)
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).