From: Vignesh R <vigneshr@ti.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>,
Peter Hurley <peter@hurleysoftware.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org, Vignesh R <vigneshr@ti.com>
Subject: [PATCH 1/3] serial: 8250: omap: pause DMA only if DMA transfer in progress
Date: Fri, 13 Jan 2017 13:31:59 +0530 [thread overview]
Message-ID: <20170113080201.6515-2-vigneshr@ti.com> (raw)
In-Reply-To: <20170113080201.6515-1-vigneshr@ti.com>
It is possible that DMA transfer is already complete but, completion
handler is yet to be called, when dmaengine_pause() is called in case of
error condition(like break/rx timeout). This leads to dmaengine_pause()
API to return EINVAL (as descriptor is already NULL) causing
rx_dma_broken flag to be set and effectively disabling RX DMA.
Fix this by calling dmaengine_pause() only when transfer is in progress.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/tty/serial/8250/8250_omap.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 61ad6c3b20a0..4ad1934ef6ed 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -790,6 +790,7 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
{
struct omap8250_priv *priv = p->port.private_data;
struct uart_8250_dma *dma = p->dma;
+ struct dma_tx_state state;
unsigned long flags;
int ret;
@@ -800,10 +801,12 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
return;
}
- ret = dmaengine_pause(dma->rxchan);
- if (WARN_ON_ONCE(ret))
- priv->rx_dma_broken = true;
-
+ ret = dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
+ if (ret == DMA_IN_PROGRESS) {
+ ret = dmaengine_pause(dma->rxchan);
+ if (WARN_ON_ONCE(ret))
+ priv->rx_dma_broken = true;
+ }
spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
__dma_rx_do_complete(p);
--
2.11.0
next prev parent reply other threads:[~2017-01-13 8:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 8:01 [PATCH 0/3] tty: serial: 8250_omap: Enable DMA support Vignesh R
2017-01-13 8:01 ` Vignesh R [this message]
2017-01-13 8:02 ` [PATCH 2/3] tty: serial: 8250_omap: Add OMAP_DMA_TX_KICK quirk for AM437x Vignesh R
2017-01-13 8:02 ` [PATCH 3/3] tty: serial: 8250_omap: Remove rx_dma_broken flag Vignesh R
2017-01-13 18:20 ` [PATCH 0/3] tty: serial: 8250_omap: Enable DMA support Tony Lindgren
2017-01-17 6:06 ` Vignesh R
2017-01-17 10:05 ` Vignesh R
2017-01-17 23:25 ` Tony Lindgren
2017-01-18 12:04 ` Vignesh R
2017-01-18 17:07 ` Tony Lindgren
2017-01-19 13:24 ` Greg Kroah-Hartman
2017-01-19 14:54 ` Tony Lindgren
2017-01-19 15:35 ` Greg Kroah-Hartman
2017-01-20 8:22 ` Vignesh R
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=20170113080201.6515-2-vigneshr@ti.com \
--to=vigneshr@ti.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=peter@hurleysoftware.com \
/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;
as well as URLs for NNTP newsgroup(s).