From: Vignesh R <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot RESEND v2 07/10] sf: ops: Add spi_flash_copy_mmap function
Date: Mon, 17 Aug 2015 13:29:54 +0530 [thread overview]
Message-ID: <1439798397-1397-8-git-send-email-vigneshr@ti.com> (raw)
In-Reply-To: <1439798397-1397-1-git-send-email-vigneshr@ti.com>
From: Tom Rini <trini@ti.com>
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.
Signed-off-by: Tom Rini <trini@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Jagan Teki <jteki@openedev.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 38592f518b72..900ec1f2a9ce 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"
@@ -378,6 +379,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)
{
@@ -394,7 +400,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 18362364cf0e..51fdfd6d7360 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -272,6 +272,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
--
2.5.0
next prev parent reply other threads:[~2015-08-17 7:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 7:59 [U-Boot] [U-Boot RESEND v2 00/10] Enable edma support for ti-qspi Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 01/10] sf: allocate cache aligned buffers to copy from flash Vignesh R
2015-08-17 17:19 ` Jagan Teki
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 02/10] env: use cache line aligned memory for flash read Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 03/10] ARM: AM43xx: Add support for disabling clocks in uboot Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 04/10] ARM: OMAP5: " Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 05/10] ARM: OMAP5: Add functions to enable and disable EDMA3 clocks Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 06/10] ARM: AM43XX: " Vignesh R
2015-08-17 7:59 ` Vignesh R [this message]
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 08/10] dma: ti-edma3: Add helper function to support edma3 transfer Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 09/10] spi: ti_qspi: Use DMA to read from qspi flash Vignesh R
2015-08-17 8:18 ` Jagan Teki
2015-08-17 8:22 ` R, Vignesh
2015-08-17 9:50 ` Vignesh R
2015-08-17 7:59 ` [U-Boot] [U-Boot RESEND v2 10/10] ARM: dra7xx_evm: Enable EDMA3 in SPL to support DMA on qspi Vignesh R
2015-08-17 18:02 ` [U-Boot] [U-Boot RESEND v2 00/10] Enable edma support for ti-qspi Jagan Teki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439798397-1397-8-git-send-email-vigneshr@ti.com \
--to=vigneshr@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox