From bf63a07c546ceed3d2c3d203d75e87001144423f Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 20 Jun 2017 20:36:32 -0300 Subject: [PATCH 2/2] serial: imx: Disable DMA for RS485 Currently DMA support for half-duplex RS-485 does not work on i.MX6 as instead 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). Disable DMA for the RS485 case until a proper fix is found. Reported-by: Clemens Gruber Signed-off-by: Fabio Estevam --- drivers/tty/serial/imx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 90f8a5d..4812e11 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -213,6 +213,7 @@ struct imx_port { struct clk *clk_ipg; struct clk *clk_per; const struct imx_uart_data *devdata; + bool rs485_enabled_at_boot; struct mctrl_gpios *gpios; @@ -1278,7 +1279,8 @@ 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) + if (!uart_console(port) && !sport->dma_is_inited && + !sport->rs485_enabled_at_boot) imx_uart_dma_init(sport); spin_lock_irqsave(&sport->port.lock, flags); @@ -2087,6 +2089,7 @@ static void serial_imx_probe_pdata(struct imx_port *sport, static int serial_imx_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; struct imx_port *sport; void __iomem *base; int ret = 0, reg; @@ -2123,8 +2126,10 @@ static int serial_imx_probe(struct platform_device *pdev) sport->port.rs485_config = imx_rs485_config; sport->port.rs485.flags = SER_RS485_RTS_ON_SEND | SER_RS485_RX_DURING_TX; - if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL)) + if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL)) { sport->port.rs485.flags |= SER_RS485_ENABLED; + sport->rs485_enabled_at_boot = true; + } sport->port.flags = UPF_BOOT_AUTOCONF; init_timer(&sport->timer); -- 2.7.4