* [PATCH V2] mxs: spi: clear XFER_COUNT in ctrl0 field in DMA descriptor @ 2012-12-26 5:48 Juha Lumme [not found] ` <1356500931-31861-1-git-send-email-juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Juha Lumme @ 2012-12-26 5:48 UTC (permalink / raw) To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Cc: Marek Vasut, Fabio Estevam, Juha Lumme, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shawn Guo On MX23 the XFER_COUNT part in ctrl0 field in DMA descriptor was improperly OR'd during the construction of DMA descriptor chain, instead of being freshly set. Because of that too many bytes were being expected from SPI during the last DMA cycle. This caused a timeout (SSP_TIMEOUT) to happen in the processing of the last DMA descriptor, and thus reads and writes were failing. This is a fix for the problem, by clearing XFER_COUNT bytes in ctrl0 before setting the new XFER_COUNT for DMA descriptor. Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> Cc: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org> Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Signed-off-by: Juha Lumme <juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Acked-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> --- drivers/spi/spi-mxs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Changelog, v2: changed the description of the patch, to better describe the patch diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 86dd04d..265c33f 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -241,6 +241,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs, INIT_COMPLETION(spi->c); ctrl0 = readl(ssp->base + HW_SSP_CTRL0); + ctrl0 &= ~BM_SSP_CTRL0_XFER_COUNT; ctrl0 |= BM_SSP_CTRL0_DATA_XFER | mxs_spi_cs_to_reg(cs); if (*first) @@ -256,8 +257,10 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs, if ((sg_count + 1 == sgs) && *last) ctrl0 |= BM_SSP_CTRL0_IGNORE_CRC; - if (ssp->devid == IMX23_SSP) + if (ssp->devid == IMX23_SSP) { + ctrl0 &= ~BM_SSP_CTRL0_XFER_COUNT; ctrl0 |= min; + } dma_xfer[sg_count].pio[0] = ctrl0; dma_xfer[sg_count].pio[3] = min; -- 1.7.10.4 ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1356500931-31861-1-git-send-email-juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH V2] mxs: spi: clear XFER_COUNT in ctrl0 field in DMA descriptor [not found] ` <1356500931-31861-1-git-send-email-juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2013-01-07 12:13 ` Marek Vasut 2013-02-05 12:45 ` Grant Likely 1 sibling, 0 replies; 3+ messages in thread From: Marek Vasut @ 2013-01-07 12:13 UTC (permalink / raw) To: Juha Lumme Cc: Fabio Estevam, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Shawn Guo, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Dear Juha Lumme, > On MX23 the XFER_COUNT part in ctrl0 field in DMA descriptor was improperly > OR'd during the construction of DMA descriptor chain, instead of being > freshly set. > Because of that too many bytes were being expected from SPI during the last > DMA cycle. > This caused a timeout (SSP_TIMEOUT) to happen in the processing of the last > DMA descriptor, and thus reads and writes were failing. > This is a fix for the problem, by clearing XFER_COUNT bytes in ctrl0 before > setting the new XFER_COUNT for DMA descriptor. > > Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> > Cc: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org> > Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > Signed-off-by: Juha Lumme <juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Acked-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> Bump? This is stable matter too. Best regards, Marek Vasut ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] mxs: spi: clear XFER_COUNT in ctrl0 field in DMA descriptor [not found] ` <1356500931-31861-1-git-send-email-juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-01-07 12:13 ` Marek Vasut @ 2013-02-05 12:45 ` Grant Likely 1 sibling, 0 replies; 3+ messages in thread From: Grant Likely @ 2013-02-05 12:45 UTC (permalink / raw) To: Juha Lumme, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Cc: Marek Vasut, Fabio Estevam, Juha Lumme, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Shawn Guo On Wed, 26 Dec 2012 14:48:51 +0900, Juha Lumme <juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On MX23 the XFER_COUNT part in ctrl0 field in DMA descriptor was improperly > OR'd during the construction of DMA descriptor chain, instead of being > freshly set. > Because of that too many bytes were being expected from SPI during the last > DMA cycle. > This caused a timeout (SSP_TIMEOUT) to happen in the processing of the last > DMA descriptor, and thus reads and writes were failing. > This is a fix for the problem, by clearing XFER_COUNT bytes in ctrl0 before > setting the new XFER_COUNT for DMA descriptor. > > Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> > Cc: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org> > Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Applied, thanks. g. ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-05 12:45 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-12-26 5:48 [PATCH V2] mxs: spi: clear XFER_COUNT in ctrl0 field in DMA descriptor Juha Lumme [not found] ` <1356500931-31861-1-git-send-email-juha.lumme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-01-07 12:13 ` Marek Vasut 2013-02-05 12:45 ` Grant Likely
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).