dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND v2] dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
@ 2020-07-01 22:52 Angelo Dureghello
  2020-07-06  5:15 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Angelo Dureghello @ 2020-07-01 22:52 UTC (permalink / raw)
  To: vkoul
  Cc: dmaengine, peng.ma, maowenan, yibin.gong, festevam,
	Angelo Dureghello, kbuild test robot

Due to recent fixes in m68k arch-specific I/O accessor macros, this
driver is not working anymore for ColdFire. Fix wrong tcd endianness
removing additional swaps, since edma_writex() functions should already
take care of any eventual swap if needed.

Note, i could only test the change in ColdFire mcf54415 and Vybrid
vf50 / Colibri where i don't see any issue. So, every feedback and
test for all other SoCs involved is really appreciated.
---
Changes for v2:
- fix build robot (sparse) wrong endianness warnings

Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com>
Reported-by: kbuild test robot <lkp@intel.com>
---
 drivers/dma/fsl-edma-common.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 5697c3622699..9285884758b2 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -352,26 +352,28 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan,
 	/*
 	 * TCD parameters are stored in struct fsl_edma_hw_tcd in little
 	 * endian format. However, we need to load the TCD registers in
-	 * big- or little-endian obeying the eDMA engine model endian.
+	 * big- or little-endian obeying the eDMA engine model endian,
+	 * and this is performed from specific edma_write functions
 	 */
 	edma_writew(edma, 0,  &regs->tcd[ch].csr);
-	edma_writel(edma, le32_to_cpu(tcd->saddr), &regs->tcd[ch].saddr);
-	edma_writel(edma, le32_to_cpu(tcd->daddr), &regs->tcd[ch].daddr);
 
-	edma_writew(edma, le16_to_cpu(tcd->attr), &regs->tcd[ch].attr);
-	edma_writew(edma, le16_to_cpu(tcd->soff), &regs->tcd[ch].soff);
+	edma_writel(edma, (s32)tcd->saddr, &regs->tcd[ch].saddr);
+	edma_writel(edma, (s32)tcd->daddr, &regs->tcd[ch].daddr);
 
-	edma_writel(edma, le32_to_cpu(tcd->nbytes), &regs->tcd[ch].nbytes);
-	edma_writel(edma, le32_to_cpu(tcd->slast), &regs->tcd[ch].slast);
+	edma_writew(edma, (s16)tcd->attr, &regs->tcd[ch].attr);
+	edma_writew(edma, tcd->soff, &regs->tcd[ch].soff);
 
-	edma_writew(edma, le16_to_cpu(tcd->citer), &regs->tcd[ch].citer);
-	edma_writew(edma, le16_to_cpu(tcd->biter), &regs->tcd[ch].biter);
-	edma_writew(edma, le16_to_cpu(tcd->doff), &regs->tcd[ch].doff);
+	edma_writel(edma, (s32)tcd->nbytes, &regs->tcd[ch].nbytes);
+	edma_writel(edma, (s32)tcd->slast, &regs->tcd[ch].slast);
 
-	edma_writel(edma, le32_to_cpu(tcd->dlast_sga),
+	edma_writew(edma, (s16)tcd->citer, &regs->tcd[ch].citer);
+	edma_writew(edma, (s16)tcd->biter, &regs->tcd[ch].biter);
+	edma_writew(edma, (s16)tcd->doff, &regs->tcd[ch].doff);
+
+	edma_writel(edma, (s32)tcd->dlast_sga,
 			&regs->tcd[ch].dlast_sga);
 
-	edma_writew(edma, le16_to_cpu(tcd->csr), &regs->tcd[ch].csr);
+	edma_writew(edma, (s16)tcd->csr, &regs->tcd[ch].csr);
 }
 
 static inline
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND v2] dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
  2020-07-01 22:52 [RESEND v2] dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu Angelo Dureghello
@ 2020-07-06  5:15 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-07-06  5:15 UTC (permalink / raw)
  To: Angelo Dureghello
  Cc: dmaengine, peng.ma, maowenan, yibin.gong, festevam, kbuild test robot

On 02-07-20, 00:52, Angelo Dureghello wrote:
> Due to recent fixes in m68k arch-specific I/O accessor macros, this
> driver is not working anymore for ColdFire. Fix wrong tcd endianness
> removing additional swaps, since edma_writex() functions should already
> take care of any eventual swap if needed.
> 
> Note, i could only test the change in ColdFire mcf54415 and Vybrid
> vf50 / Colibri where i don't see any issue. So, every feedback and
> test for all other SoCs involved is really appreciated.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-06  5:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 22:52 [RESEND v2] dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu Angelo Dureghello
2020-07-06  5:15 ` Vinod Koul

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).