Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been started

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 12, 2017 at 05:12:10PM +0200, Clemens Gruber wrote:
> The imx_transmit_buffer function should return if TX DMA has already
> been started and not just skip over the buffer PIO write loop. (Which
> did fix the initial problem, but could have unintentional side-effects)
> 
> Tested on an i.MX6Q board with half-duplex RS-485 and with RS-232.
> 
> Cc: Ian Jamison <ian.dev@xxxxxxxxxx>
> Cc: Uwe-Kleine König <u.kleine-koenig@xxxxxxxxxxxxxx>
> Fixes: 514ab34dbad6 ("serial: imx: Prevent TX buffer PIO write when a
> DMA has been started")

AFAIK no newline in the Fixes: line.

> Signed-off-by: Clemens Gruber <clemens.gruber@xxxxxxxxxxxx>
> ---
>  drivers/tty/serial/imx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 80934e7bd67f..fce538eb8c77 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -452,13 +452,14 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
>  		if (sport->dma_is_txing) {
>  			temp |= UCR1_TDMAEN;
>  			writel(temp, sport->port.membase + UCR1);
> +			return;
>  		} else {
>  			writel(temp, sport->port.membase + UCR1);
>  			imx_dma_tx(sport);
>  		}

Shouldn't the return go here?

Did you understand the problem? Can you say why this only hurts in RS485
half-duplex but not (as it seems) in regular rs232 mode?

>  	}
>  
> -	while (!uart_circ_empty(xmit) && !sport->dma_is_txing &&
> +	while (!uart_circ_empty(xmit) &&
>  	       !(readl(sport->port.membase + uts_reg(sport)) & UTS_TXFULL)) {
>  		/* send xmit->buf[xmit->tail]
>  		 * out the port here */

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux