[U-Boot] [PATCH 3/6] sf: sf_ops: use dma to copy data from mmap region if platform supports

Mugunthan V N mugunthanvnm at ti.com
Tue Dec 1 12:13:15 CET 2015


Add dma memcpy api to the default spi_flash_copy_mmap(), so that
dma will be used to copy data when DM_DMA is defined for the
platform.

Signed-off-by: Mugunthan V N <mugunthanvnm at ti.com>
---
 drivers/mtd/spi/sf_ops.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index 3a56d7f..3c83f8a 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -16,6 +16,7 @@
 #include <watchdog.h>
 #include <linux/compiler.h>
 #include <linux/log2.h>
+#include <dma.h>
 
 #include "sf_internal.h"
 
@@ -389,6 +390,10 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
 
 void __weak spi_flash_copy_mmap(void *data, void *offset, size_t len)
 {
+#ifdef CONFIG_DM_DMA
+	if (!dma_memcpy(data, offset, len))
+		return;
+#endif
 	memcpy(data, offset, len);
 }
 
-- 
2.6.3.368.gf34be46



More information about the U-Boot mailing list