summaryrefslogtreecommitdiff
path: root/rust/helpers/dma.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2025-04-30 17:33:59 +0300
committerMark Brown <broonie@kernel.org>2025-04-30 17:33:59 +0300
commita7f035c2c72496cf7ac34bfaa8c289e0d4c45836 (patch)
tree1962110083a27f50a6b0f08d44e6f225e6bd7cbd /rust/helpers/dma.c
parentdf8c5ad0f56635341bfe3f59ef7c6473e389abc4 (diff)
parente6702c44c2adb28b62f81de498e9b1e4562ce660 (diff)
downloadlinux-a7f035c2c72496cf7ac34bfaa8c289e0d4c45836.tar.xz
spi: axi-spi-engine: offload instruction optimization
Merge series from David Lechner <dlechner@baylibre.com>: In order to achieve a 4 MSPS rate on a 16-bit ADC with a 80 MHz SCLK using the SPI offload feature of the AXI SPI Engine, we need to shave off some time that is spent executing unnecessary instructions. There are a few one-time setup instructions that can be moved so that they execute only once when the SPI offload trigger is enabled rather than repeating each time the offload is triggered. Additionally, a recent change to the IP block allows dropping the SYNC instruction completely. With these changes, we are left with only the 3 instructions that are needed to to assert CS, transfer the data, and deassert CS. This makes 3 + 16 * 12.5 ns = 237.5 ns < 250 ns which is comfortably within the available time period.
Diffstat (limited to 'rust/helpers/dma.c')
-rw-r--r--rust/helpers/dma.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/helpers/dma.c b/rust/helpers/dma.c
new file mode 100644
index 000000000000..df8b8a77355a
--- /dev/null
+++ b/rust/helpers/dma.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/dma-mapping.h>
+
+void *rust_helper_dma_alloc_attrs(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, gfp_t flag,
+ unsigned long attrs)
+{
+ return dma_alloc_attrs(dev, size, dma_handle, flag, attrs);
+}
+
+void rust_helper_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
+ dma_addr_t dma_handle, unsigned long attrs)
+{
+ dma_free_attrs(dev, size, cpu_addr, dma_handle, attrs);
+}