Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1438741 > unrolled thread
| Started by | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| First post | 2016-07-07 19:20 +0200 |
| Last post | 2016-07-08 10:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC] [PATCH v3 1/4] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround Franklin S Cooper Jr <fcooper@ti.com> - 2016-07-07 19:20 +0200
Re: [RFC] [PATCH v3 1/4] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround Mark Brown <broonie@kernel.org> - 2016-07-08 10:50 +0200
| From | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| Date | 2016-07-07 19:20 +0200 |
| Subject | [RFC] [PATCH v3 1/4] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround |
| Message-ID | <rSl7X-1t6-19@gated-at.bofh.it> |
OMAP35x and OMAP37x mentions in the McSPI End-of-Transfer Sequences section
that if the McSPI is configured as a Master and only DMA RX is being
performed then the DMA transfer size needs to be reduced by 1 or 2.
This was originally implemented by:
commit 57c5c28dbc83 ("spi: omap2_mcspi rxdma bugfix")
This patch adds comments to clarify what is going on in the code since its
not obvious what problem its addressing.
Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
drivers/spi/spi-omap2-mcspi.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 1d237e9..c47f958 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -459,6 +459,11 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
count = xfer->len;
dma_count = xfer->len;
+ /*
+ * In the "End-of-Transfer Procedure" section for DMA RX in OMAP35x TRM
+ * it mentions reducing DMA transfer length by one element in master
+ * normal mode.
+ */
if (mcspi->fifo_depth == 0)
dma_count -= es;
@@ -478,6 +483,10 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
dmaengine_slave_config(mcspi_dma->dma_rx, &cfg);
+ /*
+ * Reduce DMA transfer length by one more if McSPI is
+ * configured in turbo mode.
+ */
if ((l & OMAP2_MCSPI_CHCONF_TURBO) && mcspi->fifo_depth == 0)
dma_count -= es;
@@ -507,6 +516,10 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer,
if (mcspi->fifo_depth > 0)
return count;
+ /*
+ * Due to the DMA transfer length reduction the missing bytes must
+ * be read manually to receive all of the expected data.
+ */
omap2_mcspi_set_enable(spi, 0);
elements = element_count - 1;
--
2.7.0
[toc] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2016-07-08 10:50 +0200 |
| Subject | Re: [RFC] [PATCH v3 1/4] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround |
| Message-ID | <rSzDX-2k6-5@gated-at.bofh.it> |
| In reply to | #1438741 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Jul 07, 2016 at 12:17:48PM -0500, Franklin S Cooper Jr wrote: > OMAP35x and OMAP37x mentions in the McSPI End-of-Transfer Sequences section > that if the McSPI is configured as a Master and only DMA RX is being > performed then the DMA transfer size needs to be reduced by 1 or 2. Please do not submit new versions of already applied patches, please submit incremental updates to the existing code. Modifying existing commits creates problems for other users building on top of those commits so it's best practice to only change pubished git commits if absolutely essential.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web