From: Franklin S Cooper Jr <fcooper-l0cyMroinI0@public.gmane.org>
To: david.s.gordon-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
axboe-b10kYP2dOMg@public.gmane.org,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
ming.l-Vzezgt5dB6uUEJcrhfAQsw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
nsekhar-l0cyMroinI0@public.gmane.org,
peter.ujfalusi-l0cyMroinI0@public.gmane.org
Cc: Franklin S Cooper Jr <fcooper-l0cyMroinI0@public.gmane.org>
Subject: [RFC] [PATCH v2 2/3] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround
Date: Mon, 27 Jun 2016 09:54:08 -0500 [thread overview]
Message-ID: <1467039249-7816-3-git-send-email-fcooper@ti.com> (raw)
In-Reply-To: <1467039249-7816-1-git-send-email-fcooper-l0cyMroinI0@public.gmane.org>
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-l0cyMroinI0@public.gmane.org>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-27 14:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 14:54 [RFC] [PATCH v2 0/3] scatterlist: Add support to clone sg_table Franklin S Cooper Jr
[not found] ` <1467039249-7816-1-git-send-email-fcooper-l0cyMroinI0@public.gmane.org>
2016-06-27 14:54 ` [RFC] [PATCH v2 1/3] scatterlist: Add support to clone scatterlist Franklin S Cooper Jr
[not found] ` <1467039249-7816-2-git-send-email-fcooper-l0cyMroinI0@public.gmane.org>
2016-07-05 14:49 ` Mark Brown
2016-07-05 16:47 ` Andy Shevchenko
2016-07-05 17:10 ` Andy Shevchenko
[not found] ` <CAHp75VfR=TKfVN=03jvGy5oZRA_-ASb8Vb_A4+x3OrkpZT6PoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-06 17:09 ` Franklin S Cooper Jr.
2016-07-06 17:46 ` Andy Shevchenko
[not found] ` <CAHp75VcPLV-483ihn_RmHnDOc0iFMSdYj5_SrNevyqrrpeWatQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-06 19:39 ` Franklin S Cooper Jr.
2016-07-06 22:04 ` Robert Jarzmik
[not found] ` <871t368lu6.fsf-4ty26DBLk+jEm7gnYqmdkQ@public.gmane.org>
2016-07-07 8:02 ` Mark Brown
[not found] ` <20160707080241.GE6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-07 17:43 ` Robert Jarzmik
[not found] ` <87twg1739e.fsf-4ty26DBLk+jEm7gnYqmdkQ@public.gmane.org>
2016-07-08 8:18 ` Mark Brown
2016-07-12 17:14 ` Robert Jarzmik
2016-07-07 15:58 ` Franklin S Cooper Jr.
2016-07-06 10:15 ` Sekhar Nori
[not found] ` <577CDA45.80408-l0cyMroinI0@public.gmane.org>
2016-07-06 17:20 ` Franklin S Cooper Jr.
2016-06-27 14:54 ` Franklin S Cooper Jr [this message]
2016-06-27 14:54 ` [RFC] [PATCH v2 3/3] spi: omap2-mcspi: Use the SPI framework to handle DMA mapping 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=1467039249-7816-3-git-send-email-fcooper@ti.com \
--to=fcooper-l0cymroini0@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=axboe-b10kYP2dOMg@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=david.s.gordon-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ming.l-Vzezgt5dB6uUEJcrhfAQsw@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=peter.ujfalusi-l0cyMroinI0@public.gmane.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).