mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] dma: apbh: pass integer, not pointer as value to writel
@ 2025-06-02  6:20 Ahmad Fatoum
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-06-02  6:20 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




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

end of thread, other threads:[~2025-06-02  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-02  6:20 [PATCH 1/2] dma: apbh: pass integer, not pointer as value to writel Ahmad Fatoum
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox