dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
Subsystems (2)
PATCH RESEND v2 1/1 dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
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
--- drivers/dma/fsl-edma-common.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/dma/fsl-edma-common.c +14 -12
@@ -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 , ®s->tcd[ch].csr); -edma_writel (edma,le32_to_cpu (tcd->saddr), ®s->tcd[ch].saddr); -edma_writel (edma,le32_to_cpu (tcd->daddr), ®s->tcd[ch].daddr); -edma_writew (edma,le16_to_cpu (tcd->attr), ®s->tcd[ch].attr); -edma_writew (edma,le16_to_cpu (tcd->soff), ®s->tcd[ch].soff); +edma_writel (edma, (s32 )tcd->saddr, ®s->tcd[ch].saddr); +edma_writel (edma, (s32 )tcd->daddr, ®s->tcd[ch].daddr); -edma_writel (edma,le32_to_cpu (tcd->nbytes), ®s->tcd[ch].nbytes); -edma_writel (edma,le32_to_cpu (tcd->slast), ®s->tcd[ch].slast); +edma_writew (edma, (s16 )tcd->attr, ®s->tcd[ch].attr); +edma_writew (edma, tcd->soff, ®s->tcd[ch].soff); -edma_writew (edma,le16_to_cpu (tcd->citer), ®s->tcd[ch].citer); -edma_writew (edma,le16_to_cpu (tcd->biter), ®s->tcd[ch].biter); -edma_writew (edma,le16_to_cpu (tcd->doff), ®s->tcd[ch].doff); +edma_writel (edma, (s32 )tcd->nbytes, ®s->tcd[ch].nbytes); +edma_writel (edma, (s32 )tcd->slast, ®s->tcd[ch].slast); -edma_writel (edma,le32_to_cpu (tcd->dlast_sga), +edma_writew (edma, (s16 )tcd->citer, ®s->tcd[ch].citer); +edma_writew (edma, (s16 )tcd->biter, ®s->tcd[ch].biter); +edma_writew (edma, (s16 )tcd->doff, ®s->tcd[ch].doff); + +edma_writel (edma, (s32 )tcd->dlast_sga, ®s->tcd[ch].dlast_sga); -edma_writew (edma,le16_to_cpu (tcd->csr), ®s->tcd[ch].csr); +edma_writew (edma, (s16 )tcd->csr, ®s->tcd[ch].csr); } static inline
Signature · 1 line
2.26.2
Quoted 8 lines · Angelo Dureghello
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
Signature · 1 line
~Vinod