u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] sf: ops: Add spi_flash_copy_mmap function
@ 2014-07-11 20:53 Tom Rini
  2014-07-11 20:53 ` [U-Boot] [PATCH 2/3] dma: Add TI EDMA driver Tom Rini
  2014-07-11 20:53 ` [U-Boot] [PATCH 3/3] sf: ti_qspi: Enable EDMA for reads in SPL Tom Rini
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Rini @ 2014-07-11 20:53 UTC (permalink / raw)
  To: u-boot

When doing a memory mapped copy we may have DMA available and thus need
to have this copy abstracted so that the driver can do it, rather than a
simple memcpy.

Cc: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
 drivers/mtd/spi/sf_ops.c |    8 +++++++-
 include/spi.h            |    3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index ef91b92..2c7b890 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -14,6 +14,7 @@
 #include <spi.h>
 #include <spi_flash.h>
 #include <watchdog.h>
+#include <linux/compiler.h>
 
 #include "sf_internal.h"
 
@@ -359,6 +360,11 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
 	return ret;
 }
 
+void __weak spi_flash_copy_mmap(void *data, void *offset, size_t len)
+{
+	memcpy(data, offset, len);
+}
+
 int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 		size_t len, void *data)
 {
@@ -375,7 +381,7 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 			return ret;
 		}
 		spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MMAP);
-		memcpy(data, flash->memory_map + offset, len);
+		spi_flash_copy_mmap(data, flash->memory_map + offset, len);
 		spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MMAP_END);
 		spi_release_bus(flash->spi);
 		return 0;
diff --git a/include/spi.h b/include/spi.h
index ffd6647..eecb9ad 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -220,6 +220,9 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen);
 int  spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
 		void *din, unsigned long flags);
 
+/* Copy memory mapped data */
+void spi_flash_copy_mmap(void *data, void *offset, size_t len);
+
 /**
  * Determine if a SPI chipselect is valid.
  * This function is provided by the board if the low-level SPI driver
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-22 14:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 20:53 [U-Boot] [PATCH 1/3] sf: ops: Add spi_flash_copy_mmap function Tom Rini
2014-07-11 20:53 ` [U-Boot] [PATCH 2/3] dma: Add TI EDMA driver Tom Rini
2014-07-11 20:53 ` [U-Boot] [PATCH 3/3] sf: ti_qspi: Enable EDMA for reads in SPL Tom Rini
2014-07-12 13:12   ` Jagan Teki
2014-07-14 20:37     ` Tom Rini
2015-01-16 16:00       ` Tom Rini
2015-04-22 11:15       ` Jagan Teki
2015-04-22 14:25         ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).