Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1401373
| From | Jiada Wang <jiada_wang@mentor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 01/10] dma: imx-sdma: use chn_real_count to report residue for UART |
| Date | 2016-05-16 10:50 +0200 |
| Message-ID | <rzmnU-4GN-3@gated-at.bofh.it> (permalink) |
| References | <rzmed-4Dx-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
For uart rx dma data may not receive fully, so the number
of data read by sdma script once isn't always equal to period_len,
thus residue returned from sdma_tx_status() isn't valid for uart rx
dma. The old way to use chn_real_count to report residue should be
used for uart rx dma.
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
drivers/dma/imx-sdma.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 0f6fd42..1f1b64b 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -680,6 +680,11 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
bd->mode.status |= BD_DONE;
sdmac->buf_tail++;
sdmac->buf_tail %= sdmac->num_bd;
+ if (sdmac->peripheral_type == IMX_DMATYPE_UART) {
+ /* restore mode.count after counter readed */
+ sdmac->chn_real_count = bd->mode.count;
+ bd->mode.count = sdmac->chn_count;
+ }
}
}
@@ -1285,6 +1290,9 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
goto err_out;
}
+ if (sdmac->peripheral_type == IMX_DMATYPE_UART)
+ sdmac->chn_count = period_len;
+
while (buf < buf_len) {
struct sdma_buffer_descriptor *bd = &sdmac->bd[i];
int param;
@@ -1361,7 +1369,8 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan,
struct sdma_channel *sdmac = to_sdma_chan(chan);
u32 residue;
- if (sdmac->flags & IMX_DMA_SG_LOOP)
+ if ((sdmac->flags & IMX_DMA_SG_LOOP) &&
+ (sdmac->peripheral_type != IMX_DMATYPE_UART))
residue = (sdmac->num_bd - sdmac->buf_tail) * sdmac->period_len;
else
residue = sdmac->chn_count - sdmac->chn_real_count;
--
2.4.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v1 00/10] *** imx-sdma: misc fix *** Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200 [PATCH 06/10] dma: imx-sdma: add terminate_all support Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200 [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200 [PATCH 08/10] dma: imx-sdma: abort updating channel when it has been terminated Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200 [PATCH 10/10] dma: imx-sdma: clear channel0 interrupt bit in irq routine Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200 [PATCH 07/10] dma: imx-sdma: Add synchronization support Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200 [PATCH 01/10] dma: imx-sdma: use chn_real_count to report residue for UART Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:50 +0200 [PATCH 05/10] dma: imx-sdma: add flag to indicate SDMA channel state Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:50 +0200 [PATCH 03/10] dma: imx-sdma: clear BD_RROR flag before pass it to sdma script Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:50 +0200 Re: [PATCH v1 00/10] *** imx-sdma: misc fix *** Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> - 2016-05-16 13:10 +0200
csiph-web