mtd: cfi_mtd: Add DMA support for reads
Subsystems (2)
Vignesh Raghavendra
maintainercover mtd: cfi_mtd: Add DMA support for reads
This series adds DMA support to read from memory mapped CFI flashes
First patch reduces noise from DMA APIs
Second patch adds DMA support for cfi_mtd.
Tested on J721e that has CFI compliant HyperFlash
Vignesh Raghavendra (2):
dma: Reduce error level when DMA channel type does not exist
mtd: cfi_mtd: Use DMA for reads
drivers/dma/dma-uclass.c | 4 ++-- drivers/mtd/cfi_mtd.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.28.0
Vignesh Raghavendra
maintainerPATCH 1/2 dma: Reduce error level when DMA channel type does not exist
Caller would need gracefully handle failures of dma_get_device(), therefore reduce pr_err() to pr_debug() when DMA device is not found.
--- drivers/dma/dma-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dma-uclass.c +2 -2
@@ -219,8 +219,8 @@ int dma_get_device(u32 transfer_type, struct udevice **devp) }if (!dev) { -pr_err ("No DMA device found that supports %x type\n" , - transfer_type); +pr_debug ("No DMA device found that supports %x type\n" , + transfer_type);return -EPROTONOSUPPORT ; }
Signature · 1 line
2.28.0
PATCH 1/2 dma: Reduce error level when DMA channel type does not exist
Quoted 4 lines · Vignesh Raghavendra
Caller would need gracefully handle failures of
dma_get_device(), therefore reducepr_err()topr_debug()when DMA device is not found.Signed-off-by Vignesh Raghavendra <[email protected]>
Thanks,
Stefan
Quoted 10 lines
--- drivers/dma/dma-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/dma-uclass.c +0
-0
drivers/dma/dma-uclass.c int dma_get_device(u32 transfer_type, struct udevice **devp) · line 226
Quoted 10 lines
drivers/dma/dma-uclass.c +2
-2@@ -219,8 +219,8 @@ int dma_get_device(u32 transfer_type, struct udevice **devp) }if (!dev) { -pr_err ("No DMA device found that supports %x type\n" , - transfer_type); +pr_debug ("No DMA device found that supports %x type\n" , + transfer_type);return -EPROTONOSUPPORT ; }
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/2 dma: Reduce error level when DMA channel type does not exist
In reply to Vignesh RaghavendraQuoted 4 lines · Vignesh Raghavendra
Caller would need gracefully handle failures of
dma_get_device(), therefore reducepr_err()topr_debug()when DMA device is not found.Signed-off-by Vignesh Raghavendra <[email protected]>
Applied to u-boot-cfi-flash/master
Thanks,
Stefan
Quoted 10 lines
--- drivers/dma/dma-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/dma-uclass.c +0
-0
drivers/dma/dma-uclass.c int dma_get_device(u32 transfer_type, struct udevice **devp) · line 226
Quoted 10 lines
drivers/dma/dma-uclass.c +2
-2@@ -219,8 +219,8 @@ int dma_get_device(u32 transfer_type, struct udevice **devp) }if (!dev) { -pr_err ("No DMA device found that supports %x type\n" , - transfer_type); +pr_debug ("No DMA device found that supports %x type\n" , + transfer_type);return -EPROTONOSUPPORT ; }
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
Vignesh Raghavendra
maintainerPATCH 2/2 mtd: cfi_mtd: Use DMA for reads
In reply to Vignesh RaghavendraWhen 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.
--- drivers/mtd/cfi_mtd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/cfi_mtd.c +3 -1
@@ -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 ;
Signature · 1 line
2.28.0
PATCH 2/2 mtd: cfi_mtd: Use DMA for reads
Quoted 7 lines · Vignesh Raghavendra
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 <[email protected]>
Thanks,
Stefan
Quoted 18 lines
--- drivers/mtd/cfi_mtd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/mtd/cfi_mtd.c +1
-0@@ -6,6 +6,7 @@*/ #include <common.h> +#include <dma.h> #include <flash.h> #include <malloc.h>
drivers/mtd/cfi_mtd.c static int cfi_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, · line 78
Quoted 9 lines
drivers/mtd/cfi_mtd.c +2
-1@@ -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 ;
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 2/2 mtd: cfi_mtd: Use DMA for reads
In reply to Vignesh RaghavendraQuoted 7 lines · Vignesh Raghavendra
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 <[email protected]>
Applied to u-boot-cfi-flash/master
Thanks,
Stefan
Quoted 18 lines
--- drivers/mtd/cfi_mtd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/mtd/cfi_mtd.c +1
-0@@ -6,6 +6,7 @@*/ #include <common.h> +#include <dma.h> #include <flash.h> #include <malloc.h>
drivers/mtd/cfi_mtd.c static int cfi_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, · line 78
Quoted 9 lines
drivers/mtd/cfi_mtd.c +2
-1@@ -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 ;
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
Vignesh Raghavendra
maintainercover mtd: cfi_mtd: Add DMA support for reads
In reply to Vignesh RaghavendraHi Stefan
Quoted 7 lines · Vignesh Raghavendra
This series adds DMA support to read from memory mapped CFI flashes
First patch reduces noise from DMA APIs
Second patch adds DMA support forcfi_mtd.Tested on J721e that has CFI compliant HyperFlash
Quoted 8 lines
Vignesh Raghavendra (2):
dma: Reduce error level when DMA channel type does not exist
mtd:cfi_mtd: Use DMA for readsdrivers/dma/dma-uclass.c | 4 ++-- drivers/mtd/cfi_mtd.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
Do you plan to pick up this series via CFI Flash? Or should I ask Tom to pull it in? Thanks!
Regards
Vignesh
cover mtd: cfi_mtd: Add DMA support for reads
Hi Vignesh,
Quoted 14 lines · Vignesh Raghavendra
Hi Stefan
Quoted 11 lines · Vignesh Raghavendra
This series adds DMA support to read from memory mapped CFI flashes
First patch reduces noise from DMA APIs
Second patch adds DMA support forcfi_mtd.Tested on J721e that has CFI compliant HyperFlash
Vignesh Raghavendra (2):
dma: Reduce error level when DMA channel type does not exist
mtd:cfi_mtd: Use DMA for reads
Quoted 7 lines
Quoted 4 lines
drivers/dma/dma-uclass.c | 4 ++-- drivers/mtd/cfi_mtd.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)Do you plan to pick up this series via CFI Flash? Or should I ask Tom to pull it in? Thanks!
I'll pull this patchset soon via the CFI tree.
Thanks,
Stefan