diff options
author | Vignesh Raghavendra <vigneshr@ti.com> | 2020-09-17 16:53:08 +0530 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2020-10-08 09:04:41 +0200 |
commit | 3f891a103c5c90c186a5a0b1584dfa39e8688b8f (patch) | |
tree | fc764bfed0cf22b47a8148fb7d15f3bd664e937c /drivers/mtd | |
parent | 8995a86cd6fa6e189c03a638da4a8ef9755d3738 (diff) | |
download | u-boot-3f891a103c5c90c186a5a0b1584dfa39e8688b8f.tar.gz |
mtd: cfi_mtd: Use DMA for reads
When possible use DMA for reading from CFI flash, this provides upto 5x
improvement in read performance with high speed CFI compliant flashes
like HyperFlash.
Code will gracefully fallback to CPU copy when DMA is unavailable.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/cfi_mtd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/cfi_mtd.c b/drivers/mtd/cfi_mtd.c index a5bb0962e5..78293caa2f 100644 --- a/drivers/mtd/cfi_mtd.c +++ b/drivers/mtd/cfi_mtd.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <dma.h> #include <flash.h> #include <malloc.h> @@ -70,7 +71,8 @@ static int cfi_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, flash_info_t *fi = mtd->priv; u_char *f = (u_char*)(fi->start[0]) + from; - memcpy(buf, f, len); + if (dma_memcpy(buf, f, len) < 0) + memcpy(buf, f, len); *retlen = len; return 0; |