mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 1/2] dma: apbh: pass integer, not pointer as value to writel
Date: Mon,  2 Jun 2025 08:20:19 +0200	[thread overview]
Message-ID: <20250602062020.754880-1-a.fatoum@barebox.org> (raw)

In preparation for enforcing that at least the value of writeX is an
integer, a number of places writing a pointer were noticed.

Add a virt_to_phys to paper over this with a comment that this is not
completely correct.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/dma/apbh_dma.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index 298f706f1bcd..fb8b6b304cf0 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -103,6 +103,7 @@ int mxs_dma_go(int chan, struct mxs_dma_cmd *cmd, int ncmds)
 	struct apbh_dma *apbh = apbh_dma;
 	uint32_t timeout = 10000;
 	int i, ret, channel_bit;
+	dma_addr_t dma;
 
 	ret = mxs_dma_validate_chan(chan);
 	if (ret)
@@ -113,12 +114,18 @@ int mxs_dma_go(int chan, struct mxs_dma_cmd *cmd, int ncmds)
 		cmd[i].data |= MXS_DMA_DESC_CHAIN;
 	}
 
+	/*
+	 * TODO: cmd is in DMA coherent memory, but it uses DMA_ADDRESS_BROKEN,
+	 * and thus assumes a 1:1 mapping here
+	 */
+	dma = virt_to_phys(cmd);
+
 	if (apbh_dma_is_imx23(apbh)) {
-		writel(cmd, apbh->regs + HW_APBHX_CHn_NXTCMDAR_MX23(chan));
+		writel(dma, apbh->regs + HW_APBHX_CHn_NXTCMDAR_MX23(chan));
 		writel(1, apbh->regs + HW_APBHX_CHn_SEMA_MX23(chan));
 		channel_bit = chan + BP_APBH_CTRL0_CLKGATE_CHANNEL;
 	} else {
-		writel(cmd, apbh->regs + HW_APBHX_CHn_NXTCMDAR_MX28(chan));
+		writel(dma, apbh->regs + HW_APBHX_CHn_NXTCMDAR_MX28(chan));
 		writel(1, apbh->regs + HW_APBHX_CHn_SEMA_MX28(chan));
 		channel_bit = chan;
 	}
-- 
2.39.5




             reply	other threads:[~2025-06-02  6:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02  6:20 Ahmad Fatoum [this message]
2025-06-02  6:20 ` [PATCH 2/2] ARM: Arria10: xload: don't check writel return value Ahmad Fatoum
2025-06-02  7:43 ` [PATCH 1/2] dma: apbh: pass integer, not pointer as value to writel Sascha Hauer

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=20250602062020.754880-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox