Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1710394

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

From Clemens Gruber <clemens.gruber@pqgruber.com>
Newsgroups linux.kernel
Subject Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been started
Date 2017-08-13 00:10 +0200
Message-ID <udMLx-6KV-41@gated-at.bofh.it> (permalink)
References <udGwp-2xl-3@gated-at.bofh.it> <udKJI-5f3-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Aug 12, 2017 at 09:54:51PM +0200, Uwe Kleine-König wrote:
> 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.

Thanks. A checkpatch warning for this would be great.

> 
> > 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?

Yes, it can also go here (and probably should). The problem of
xmit->tail jumping over xmit->head occurs only if we are already DMA
txing and then go into the PIO loop, but not the first time after
calling imx_dma_tx. That's why the v1 passed the tests too.
I'll have to conduct a few more tests and if they succeed I'll send a
v2 where we return in both cases (already txing and starting to).

> 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?

I am not sure anyone understands (yet) why it a) only hurts RS-485 and
b) only occurs on SMP systems.
If you have more insight, please share it. :)

Cheers,
Clemens

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] serial: imx: Improve PIO prevention if TX DMA has been started Clemens Gruber <clemens.gruber@pqgruber.com> - 2017-08-12 17:30 +0200
  Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been  started Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-08-12 22:00 +0200
    Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been  started Clemens Gruber <clemens.gruber@pqgruber.com> - 2017-08-13 00:10 +0200
      Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been  started Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-08-14 09:00 +0200
        Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been  started Clemens Gruber <clemens.gruber@pqgruber.com> - 2017-08-14 20:40 +0200
          Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been  started Uwe Kleine-König          <u.kleine-koenig@pengutronix.de> - 2017-08-14 22:50 +0200
          Re: [PATCH] serial: imx: Improve PIO prevention if TX DMA has been  started Ian Jamison <ian@arkver.com> - 2017-08-14 23:40 +0200

csiph-web