summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-10-17 15:13:27 -0600
committerTom Rini <[email protected]>2024-10-17 18:21:20 -0600
commitf1de0b97d1cbfd982b7a507962bb21b12a024b2f (patch)
tree50faa0029b442de15773ffc46618eeb3d83593ea /arch
parent0a504585d1cefeaf35ae8f860a5e5aa44dfffed5 (diff)
parentf83076add0fcc3d062c8183d905e7fc15236ce51 (diff)
Merge patch series "Cleanup dma device in spl and move dma channel[0]"
Prasanth Babu Mantena <[email protected]> says: The channel allocation and deallocation for dma copy was happening on every dma transfer. This is a overhead for transactions like NAND, which does page reads recursively for complete data. So, moving the dma allocation to probe and implement corresponding remove function and cleanup dma device while exiting from spl. Enable SPL_DM_DEVICE_REMOVE, for device removal capability in SPL. Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-k3/common.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index f2086cbdf51..fa8cd93d664 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -28,6 +28,8 @@
#include <env.h>
#include <elf.h>
#include <soc.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
#include <asm/arch/k3-qos.h>
@@ -246,12 +248,32 @@ void spl_enable_cache(void)
#endif
}
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
+static __maybe_unused void k3_dma_remove(void)
+{
+ struct udevice *dev;
+ int rc;
+
+ rc = uclass_find_device(UCLASS_DMA, 0, &dev);
+ if (!rc && dev) {
+ rc = device_remove(dev, DM_REMOVE_NORMAL);
+ if (rc)
+ pr_warn("Cannot remove dma device '%s' (err=%d)\n",
+ dev->name, rc);
+ } else
+ pr_warn("DMA Device not found (err=%d)\n", rc);
+}
+
void spl_board_prepare_for_boot(void)
{
+#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
dcache_disable();
+#endif
+#if IS_ENABLED(CONFIG_SPL_DMA) && IS_ENABLED(CONFIG_SPL_DM_DEVICE_REMOVE)
+ k3_dma_remove();
+#endif
}
+#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
void spl_board_prepare_for_linux(void)
{
dcache_disable();