[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1372304548-30777-1-git-send-email-joelf@ti.com>
Date: Wed, 26 Jun 2013 22:42:28 -0500
From: Joel Fernandes <joelf@...com>
To: Tony Lindgren <tony@...mide.com>, Sekhar Nori <nsekhar@...com>,
Matt Porter <matt@...orter.com>,
Grant Likely <grant.likely@...retlab.ca>,
Rob Herring <rob.herring@...xeda.com>,
Vinod Koul <vinod.koul@...el.com>,
Mark Brown <broonie@...aro.org>,
Benoit Cousson <b-cousson@...com>,
Russell King <linux@....linux.org.uk>,
Rob Landley <rob@...dley.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>
CC: Devicetree Discuss <devicetree-discuss@...ts.ozlabs.org>,
Linux OMAP List <linux-omap@...r.kernel.org>,
Linux ARM Kernel List <linux-arm-kernel@...ts.infradead.org>,
Linux DaVinci Kernel List
<davinci-linux-open-source@...ux.davincidsp.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Documentation List <linux-doc@...r.kernel.org>,
Linux MMC List <linux-mmc@...r.kernel.org>,
Linux SPI Devel List
<spi-devel-general@...ts.sourceforge.net>,
Joel Fernandes <joelf@...com>
Subject: [PATCH v2 2/2] DMA: EDMA: Add comments for A-sync case calculations
A-sync case in EDMA driver is tricky and not so obvious.
Document the reasons for the calculations and the scenarious
they are used.
Signed-off-by: Joel Fernandes <joelf@...com>
---
drivers/dma/edma.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index e008ed2..a1d9f3785 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -284,8 +284,24 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
*/
if (burst == 1) {
edesc->absync = false;
+ /*
+ * For the A-sync case, bcnt and ccnt are the remainder
+ * and quotient respectively of the division of:
+ * (sg_dma_len(sg) / acnt) by (SZ_64K -1). This is so
+ * that in case bcnt over flows, we have ccnt to use.
+ * Note: In A-sync tranfer only, bcntrld is used, but it
+ * only applies for sg_dma_len(sg) >= SZ_64K.
+ * In this case, the best way adopted is- bccnt for the
+ * first frame will be the remainder below. Then for
+ * every successive frame, bcnt will be SZ_64K-1. This
+ * is assured as bcntrld = 0xffff in end of function.
+ */
ccnt = sg_dma_len(sg) / acnt / (SZ_64K - 1);
bcnt = sg_dma_len(sg) / acnt - ccnt * (SZ_64K - 1);
+ /*
+ * If bcnt is non-zero, we have a remainder and hence an
+ * extra frame to transfer, so increment ccnt.
+ */
if (bcnt)
ccnt++;
else
@@ -343,6 +359,12 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
edesc->pset[i].a_b_cnt = bcnt << 16 | acnt;
edesc->pset[i].ccnt = ccnt;
+ /*
+ * Only time when (bcntrld) auto reload is required is for
+ * A-sync case, and in this case, a requirement of reload value
+ * of SZ_64K-1 only is assured. 'link' is initially set to NULL
+ * and then later will be populated by edma_execute.
+ */
edesc->pset[i].link_bcntrld = 0xffffffff;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists