mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
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>
This commit is contained in:
parent
8995a86cd6
commit
3f891a103c
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue