All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: imx: disable DMA for RS-485 on i.MX6 SMP
@ 2017-06-20 15:37 Clemens Gruber
  2017-06-20 16:13 ` Fabio Estevam
  2017-06-23  9:26 ` AW: [Customers.Eckelmann] " Schenk, Gavin
  0 siblings, 2 replies; 12+ messages in thread
From: Clemens Gruber @ 2017-06-20 15:37 UTC (permalink / raw)
  To: linux-serial
  Cc: Greg Kroah-Hartman, Fabio Estevam, u.kleine-koenig, linux-kernel,
	Clemens Gruber, stable

DMA support for half-duplex RS-485 never worked correctly on i.MX6Q/D
due to an undiscovered SMP-related bug, instead of the real data being
sent out, the rest of the transmit buffer is sent (xmit->tail jumps over
xmit->head in imx_transmit_buffer and UART_XMIT_SIZE bytes are sent out)
More details: https://lkml.org/lkml/2017/1/4/579

Disable it for that configuration until the bug is found and fixed.

We need to know at probe time if we can enable DMA. (RS-485 could be
enabled after that). Let's therefore only enable DMA if it is not an
i.MX6Q/D UART with uart-has-rtscts in the DT and CONFIG_SMP enabled.

Fixes: 17b8f2a3fdca ("serial: imx: add support for half duplex rs485")
Cc: <stable@vger.kernel.org>
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 drivers/tty/serial/imx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index bbefddd92bfe..000949f686a4 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1277,8 +1277,14 @@ static int imx_startup(struct uart_port *port)
 
 	writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
 
-	/* Can we enable the DMA support? */
-	if (!uart_console(port) && !sport->dma_is_inited)
+	/*
+	 * Can we enable the DMA support?
+	 * RS-485 DMA is broken on i.MX6D/Q SMP systems. Do not use DMA on
+	 * UARTs with RTS/CTS to prevent misbehavior until the bug is fixed.
+	 */
+	if (!uart_console(port) && !sport->dma_is_inited &&
+	    !(sport->have_rtscts && is_imx6q_uart(sport) &&
+	      IS_ENABLED(CONFIG_SMP)))
 		imx_uart_dma_init(sport);
 
 	spin_lock_irqsave(&sport->port.lock, flags);
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-07-17 11:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-20 15:37 [PATCH] serial: imx: disable DMA for RS-485 on i.MX6 SMP Clemens Gruber
2017-06-20 16:13 ` Fabio Estevam
2017-06-20 23:49   ` Fabio Estevam
2017-07-02 20:47     ` Clemens Gruber
2017-07-02 23:09       ` Fabio Estevam
2017-06-21 14:05   ` [PATCH] " Clemens Gruber
2017-06-21 14:12     ` Fabio Estevam
2017-06-30 12:15       ` Fabio Estevam
2017-07-02 20:17         ` Clemens Gruber
2017-07-02 20:17           ` Clemens Gruber
2017-06-23  9:26 ` AW: [Customers.Eckelmann] " Schenk, Gavin
2017-07-17 11:34   ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.