mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH RFT 1/2] ARM: mmu: take DMA offset into account for coherent memory
@ 2025-12-01 21:18 Ahmad Fatoum
  2025-12-01 21:18 ` [PATCH RFT 2/2] usb: xhci: pass hardware device to dma_alloc_coherent Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-12-01 21:18 UTC (permalink / raw)
  To: barebox; +Cc: chalianis1, Ahmad Fatoum

Now that dma_alloc_coherent and dma_alloc_writecombine take an optional
device parameter, let's take the dma_offset of the device into account
if a device has been supplied.

This will allow supporting systems, where the CPU and other DMA masters,
see the SDRAM at different addresses (i.e. has a dma-ranges in the DT).

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
Result of a discussion with Anis. Needs to be tested.
---
 arch/arm/cpu/mmu-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/mmu-common.c b/arch/arm/cpu/mmu-common.c
index dd4c8f7de7d4..30a9dfbcb9c0 100644
--- a/arch/arm/cpu/mmu-common.c
+++ b/arch/arm/cpu/mmu-common.c
@@ -47,7 +47,7 @@ void *dma_alloc_map(struct device *dev,
 	size = PAGE_ALIGN(size);
 	ret = xmemalign(PAGE_SIZE, size);
 	if (dma_handle)
-		*dma_handle = (dma_addr_t)ret;
+		*dma_handle = cpu_to_dma(ret);
 
 	memset(ret, 0, size);
 	dma_flush_range(ret, size);
-- 
2.47.3




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

end of thread, other threads:[~2025-12-01 21:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-01 21:18 [PATCH RFT 1/2] ARM: mmu: take DMA offset into account for coherent memory Ahmad Fatoum
2025-12-01 21:18 ` [PATCH RFT 2/2] usb: xhci: pass hardware device to dma_alloc_coherent Ahmad Fatoum

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