linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IMX/SDMA : save the real count for one DMA transaction.
@ 2011-11-23  9:13 Huang Shijie
  2011-11-23 10:58 ` Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: Huang Shijie @ 2011-11-23  9:13 UTC (permalink / raw)
  To: linux-arm-kernel

When we use the SDMA in the UART driver(such as imx6q), we will
meet one situation:
  Assume we set 64 bytes for the RX DMA buffer.
The receiving DMA buffer is not full, but the an Aging DMA request
will be received by the SDMA controller if we enable the
IDDMAEN(UCR4[6]).
  The UART driver needs to know the count of the real received bytes,
and push them to upper layer.

  So reuse the `private` field of dma_chan{}. Store the count of received bytes
to it, and use it in the UART driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/dma/imx-sdma.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index f993955..19ce579 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -501,6 +501,8 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
 static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)
 {
 	struct sdma_buffer_descriptor *bd;
+	struct dma_chan *chan = &sdmac->chan;
+	unsigned int count;
 	int i, error = 0;
 
 	/*
@@ -512,8 +514,12 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)
 
 		 if (bd->mode.status & (BD_DONE | BD_RROR))
 			error = -EIO;
+		 count += bd->mode.count;
 	}
 
+	/* save the real count we received or transmitted. */
+	chan->private = (void *)count;
+
 	if (error)
 		sdmac->status = DMA_ERROR;
 	else
-- 
1.7.3.2

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

end of thread, other threads:[~2011-11-24  2:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23  9:13 [PATCH] IMX/SDMA : save the real count for one DMA transaction Huang Shijie
2011-11-23 10:58 ` Wolfram Sang
2011-11-23 11:04   ` Huang Shijie
2011-11-23 11:06     ` Wolfram Sang
2011-11-23 11:13       ` Huang Shijie
2011-11-23 11:18         ` Wolfram Sang
2011-11-23 11:29           ` Huang Shijie
2011-11-23 11:36             ` Wolfram Sang
2011-11-24  2:56               ` Huang Shijie
2011-11-23 11:40             ` Vinod Koul
2011-11-24  2:42               ` 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).