From: fcooper@ti.com (Franklin S Cooper Jr)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] [PATCH v3 1/4] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround
Date: Thu, 7 Jul 2016 12:17:48 -0500 [thread overview]
Message-ID: <1467911871-4508-2-git-send-email-fcooper@ti.com> (raw)
In-Reply-To: <1467911871-4508-1-git-send-email-fcooper@ti.com>
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
next prev parent reply other threads:[~2016-07-07 17:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-07 17:17 [RFC] [PATCH v3 0/4] spi: omap2-mcspi: Use the SPI framework to handle DMA mapping Franklin S Cooper Jr
2016-07-07 17:17 ` Franklin S Cooper Jr [this message]
2016-07-08 8:46 ` [RFC] [PATCH v3 1/4] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround Mark Brown
2016-07-07 17:17 ` [RFC] [PATCH v3 2/4] spi: spi-omap2-mcspi: Select SPI_SPLIT Franklin S Cooper Jr
2016-07-07 17:33 ` Randy Dunlap
2016-07-08 8:49 ` Applied "spi: omap2-mcspi: Select SPI_SPLIT" to the spi tree Mark Brown
2016-07-08 8:54 ` Sekhar Nori
2016-07-07 17:17 ` [RFC] [PATCH v3 3/4] spi: omap2-mcspi: Use the SPI framework to handle DMA mapping Franklin S Cooper Jr
2016-07-08 8:49 ` Applied "spi: omap2-mcspi: Use the SPI framework to handle DMA mapping" to the spi tree Mark Brown
2016-07-07 17:17 ` [RFC] [PATCH v3 4/4] ARM: dts: am335x-icev2: Add SPI based NOR Franklin S Cooper Jr
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=1467911871-4508-2-git-send-email-fcooper@ti.com \
--to=fcooper@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).