mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Clemens Gruber <clemens.gruber@pqgruber.com>
Cc: linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	linux-kernel@vger.kernel.org, Ian Jamison <ian.dev@arkver.com>
Subject: Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been started
Date: Sat, 12 Aug 2017 21:54:51 +0200	[thread overview]
Message-ID: <20170812195451.2g65wifawouz4t7d@pengutronix.de> (raw)
In-Reply-To: <20170812151210.10420-1-clemens.gruber@pqgruber.com>

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@arkver.com>
> Cc: Uwe-Kleine König <u.kleine-koenig@pengutronix.de>
> 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@pqgruber.com>
> ---
>  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/  |

  reply	other threads:[~2017-08-12 19:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-12 15:12 Clemens Gruber
2017-08-12 19:54 ` Uwe Kleine-König [this message]
2017-08-12 22:07   ` Clemens Gruber
2017-08-14  6:51     ` Uwe Kleine-König
2017-08-14 18:38       ` Clemens Gruber
2017-08-14 20:40         ` Uwe Kleine-König
2017-08-14 20:42         ` Ian Jamison

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=20170812195451.2g65wifawouz4t7d@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=clemens.gruber@pqgruber.com \
    --cc=fabio.estevam@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ian.dev@arkver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.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

all inboxes | Powered by JetHome®