]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
sf: spi_flash: use dma to copy data from mmap region if platform supports
authorMugunthan V N <mugunthanvnm@ti.com>
Mon, 15 Feb 2016 10:01:39 +0000 (15:31 +0530)
committerJagan Teki <jteki@openedev.com>
Tue, 23 Feb 2016 10:44:46 +0000 (16:14 +0530)
Add dma memcpy api to the default spi_flash_copy_mmap(), so that
dma will be used to copy data when CONFIG_DMA is defined for the
platform.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
drivers/mtd/spi/spi_flash.c

index 8a60c72926d911ac6438873d989a452e9b222750..3c365d5e9ad8f94b11fd96388dbf934c58e7f5a6 100644 (file)
@@ -16,6 +16,7 @@
 #include <spi.h>
 #include <spi_flash.h>
 #include <linux/log2.h>
+#include <dma.h>
 
 #include "sf_internal.h"
 
@@ -454,8 +455,16 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
        return ret;
 }
 
+/*
+ * TODO: remove the weak after all the other spi_flash_copy_mmap
+ * implementations removed from drivers
+ */
 void __weak spi_flash_copy_mmap(void *data, void *offset, size_t len)
 {
+#ifdef CONFIG_DMA
+       if (!dma_memcpy(data, offset, len))
+               return;
+#endif
        memcpy(data, offset, len);
 }