linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled
@ 2012-11-22  7:06 Huang Shijie
  2012-11-22  7:06 ` [PATCH 2/2] serial: mxs-auart: unmap the scatter list before we copy the data Huang Shijie
  0 siblings, 1 reply; 2+ messages in thread
From: Huang Shijie @ 2012-11-22  7:06 UTC (permalink / raw)
  To: gregkh; +Cc: alan, linux-serial, linux-kernel, lauri.hintsala, Huang Shijie

When the DMA is enabled, the Receive Timeout interrupt is very easy to be arised
in the 3M baud rate.  The interrupt handler (aka mxs_auart_irq_handle) will call
mxs_auart_rx_chars() to handle the received data. This is not right, we can not
get the correct data from the RXFIFO now, the data have been moved to the
DMA buffer by the DMA engine.

This patch
  (1) disables the Receive Timeout Interrupt when the DMA is enabled,
  (2) and invoke the mxs_auart_rx_chars() only when the DMA is not enabled.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Tested-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> 
---
 drivers/tty/serial/mxs-auart.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index d5b9e30..2342b0d 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -695,7 +695,8 @@ static void mxs_auart_settermios(struct uart_port *u,
 		!test_and_set_bit(MXS_AUART_DMA_RX_READY, &s->flags)) {
 		if (!mxs_auart_dma_prep_rx(s)) {
 			/* Disable the normal RX interrupt. */
-			writel(AUART_INTR_RXIEN, u->membase + AUART_INTR_CLR);
+			writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN,
+					u->membase + AUART_INTR_CLR);
 		} else {
 			mxs_auart_dma_exit(s);
 			dev_err(s->dev, "We can not start up the DMA.\n");
@@ -719,7 +720,8 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
 	}
 
 	if (istat & (AUART_INTR_RTIS | AUART_INTR_RXIS)) {
-		mxs_auart_rx_chars(s);
+		if (!auart_dma_enabled(s))
+			mxs_auart_rx_chars(s);
 		istat &= ~(AUART_INTR_RTIS | AUART_INTR_RXIS);
 	}
 
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] serial: mxs-auart: unmap the scatter list before we copy the data
  2012-11-22  7:06 [PATCH 1/2] serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled Huang Shijie
@ 2012-11-22  7:06 ` Huang Shijie
  0 siblings, 0 replies; 2+ messages in thread
From: Huang Shijie @ 2012-11-22  7:06 UTC (permalink / raw)
  To: gregkh; +Cc: alan, linux-serial, linux-kernel, lauri.hintsala, Huang Shijie

We should first unmap the DMA scatter list for receiving data, and
then copy the data from the DMA buffer.

The old code misses unmap the scatter list for RX. This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Tested-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> 
---
 drivers/tty/serial/mxs-auart.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 2342b0d..6b51448 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -461,6 +461,8 @@ static void dma_rx_callback(void *arg)
 	int count;
 	u32 stat;
 
+	dma_unmap_sg(s->dev, &s->rx_sgl, 1, DMA_FROM_DEVICE);
+
 	stat = readl(s->port.membase + AUART_STAT);
 	stat &= ~(AUART_STAT_OERR | AUART_STAT_BERR |
 			AUART_STAT_PERR | AUART_STAT_FERR);
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-22 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  7:06 [PATCH 1/2] serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled Huang Shijie
2012-11-22  7:06 ` [PATCH 2/2] serial: mxs-auart: unmap the scatter list before we copy the data Huang Shijie

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).