summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-06-14 11:15:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-06-17 08:25:43 +0200
commite31495eeb3a9e179a736e67012b17cc4a7bfc10b (patch)
treefef12e158bd416c580e0faa8375f31e80b767407
parentc50731ebca48c6216b183bd1e0272dd75033ba41 (diff)
downloadbarebox-e31495eeb3a9e179a736e67012b17cc4a7bfc10b.tar.gz
barebox-e31495eeb3a9e179a736e67012b17cc4a7bfc10b.tar.xz
dma: add dma_sync nop stubs for PBL
We can implement dma_sync functions as compiler barriers when we are certain that the buffers are in coherent/uncached memory, e.g. because MMU is only enabled in barebox_arm_entry which hasn't run yet. This will come in handy when doing mailbox communication in PBL on the Raspberry Pi. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220614091556.1018102-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/dma.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/dma.h b/include/dma.h
index 2a271044f6..2c4bdfc98f 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -56,6 +56,7 @@ static inline int dma_mapping_error(struct device_d *dev, dma_addr_t dma_addr)
(dev->dma_mask && dma_addr > dev->dma_mask);
}
+#ifndef __PBL__
/* streaming DMA - implement the below calls to support HAS_DMA */
#ifndef dma_sync_single_for_cpu
void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
@@ -66,6 +67,27 @@ void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
void dma_sync_single_for_device(dma_addr_t address, size_t size,
enum dma_data_direction dir);
#endif
+#else
+#ifndef dma_sync_single_for_cpu
+/*
+ * assumes buffers are in coherent/uncached memory, e.g. because
+ * MMU is only enabled in barebox_arm_entry which hasn't run yet.
+ */
+static inline void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
+ enum dma_data_direction dir)
+{
+ barrier_data((void *)address);
+}
+#endif
+
+#ifndef dma_sync_single_for_device
+static inline void dma_sync_single_for_device(dma_addr_t address, size_t size,
+ enum dma_data_direction dir)
+{
+ barrier_data((void *)address);
+}
+#endif
+#endif
#ifndef dma_alloc_coherent
void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle);