All of lore.kernel.org
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo.dureghello@timesys.com>
To: vkoul@kernel.org
Cc: dmaengine@vger.kernel.org, peng.ma@nxp.com, maowenan@huawei.com,
	yibin.gong@nxp.com, festevam@gmail.com,
	Angelo Dureghello <angelo.dureghello@timesys.com>
Subject: [PATCH] dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
Date: Fri, 29 May 2020 22:15:45 +0200	[thread overview]
Message-ID: <20200529201545.192901-1-angelo.dureghello@timesys.com> (raw)

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_xxx() functions should already
take care of any eventual swap when 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.

Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com>
---
 drivers/dma/fsl-edma-common.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 5697c3622699..2008d0cedb66 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -353,25 +353,24 @@ 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.
+	 * The swap, when needed, is performed from edma_xxx() 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_writel(edma, tcd->saddr, &regs->tcd[ch].saddr);
+	edma_writel(edma, 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_writew(edma, tcd->attr, &regs->tcd[ch].attr);
+	edma_writew(edma, tcd->soff, &regs->tcd[ch].soff);
 
-	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_writel(edma, tcd->nbytes, &regs->tcd[ch].nbytes);
+	edma_writel(edma, tcd->slast, &regs->tcd[ch].slast);
 
-	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_writew(edma, tcd->citer, &regs->tcd[ch].citer);
+	edma_writew(edma, tcd->biter, &regs->tcd[ch].biter);
+	edma_writew(edma, tcd->doff, &regs->tcd[ch].doff);
+	edma_writel(edma, tcd->dlast_sga, &regs->tcd[ch].dlast_sga);
 
-	edma_writel(edma, le32_to_cpu(tcd->dlast_sga),
-			&regs->tcd[ch].dlast_sga);
-
-	edma_writew(edma, le16_to_cpu(tcd->csr), &regs->tcd[ch].csr);
+	edma_writew(edma, tcd->csr, &regs->tcd[ch].csr);
 }
 
 static inline
-- 
2.26.2


             reply	other threads:[~2020-05-29 20:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 20:15 Angelo Dureghello [this message]
2020-06-01  9:08 ` [PATCH] dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu kbuild test robot
2020-06-01  9:08   ` kbuild test robot

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=20200529201545.192901-1-angelo.dureghello@timesys.com \
    --to=angelo.dureghello@timesys.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=maowenan@huawei.com \
    --cc=peng.ma@nxp.com \
    --cc=vkoul@kernel.org \
    --cc=yibin.gong@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.