All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads
@ 2020-09-17 11:23 Vignesh Raghavendra
  2020-09-17 11:23 ` [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist Vignesh Raghavendra
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Vignesh Raghavendra @ 2020-09-17 11:23 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
2.28.0

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

* [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist
  2020-09-17 11:23 [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads Vignesh Raghavendra
@ 2020-09-17 11:23 ` Vignesh Raghavendra
  2020-09-23  6:58   ` Stefan Roese
  2020-10-08  7:08   ` Stefan Roese
  2020-09-17 11:23 ` [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads Vignesh Raghavendra
  2020-10-05 18:42 ` [PATCH 0/2] mtd: cfi_mtd: Add DMA support " Vignesh Raghavendra
  2 siblings, 2 replies; 9+ messages in thread
From: Vignesh Raghavendra @ 2020-09-17 11:23 UTC (permalink / raw)
  To: u-boot

Caller would need gracefully handle failures of dma_get_device(),
therefore reduce pr_err() to pr_debug() when DMA device is not found.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/dma/dma-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
index 8cbb364042..50403148d6 100644
--- a/drivers/dma/dma-uclass.c
+++ b/drivers/dma/dma-uclass.c
@@ -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;
 	}
 
-- 
2.28.0

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

* [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads
  2020-09-17 11:23 [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads Vignesh Raghavendra
  2020-09-17 11:23 ` [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist Vignesh Raghavendra
@ 2020-09-17 11:23 ` Vignesh Raghavendra
  2020-09-23  6:59   ` Stefan Roese
  2020-10-08  7:08   ` Stefan Roese
  2020-10-05 18:42 ` [PATCH 0/2] mtd: cfi_mtd: Add DMA support " Vignesh Raghavendra
  2 siblings, 2 replies; 9+ messages in thread
From: Vignesh Raghavendra @ 2020-09-17 11:23 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/mtd/cfi_mtd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
-- 
2.28.0

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

* [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist
  2020-09-17 11:23 ` [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist Vignesh Raghavendra
@ 2020-09-23  6:58   ` Stefan Roese
  2020-10-08  7:08   ` Stefan Roese
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2020-09-23  6:58 UTC (permalink / raw)
  To: u-boot

On 17.09.20 13:23, Vignesh Raghavendra wrote:
> Caller would need gracefully handle failures of dma_get_device(),
> therefore reduce pr_err() to pr_debug() when DMA device is not found.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/dma/dma-uclass.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
> index 8cbb364042..50403148d6 100644
> --- a/drivers/dma/dma-uclass.c
> +++ b/drivers/dma/dma-uclass.c
> @@ -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

-- 
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

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

* [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads
  2020-09-17 11:23 ` [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads Vignesh Raghavendra
@ 2020-09-23  6:59   ` Stefan Roese
  2020-10-08  7:08   ` Stefan Roese
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2020-09-23  6:59 UTC (permalink / raw)
  To: u-boot

On 17.09.20 13:23, Vignesh Raghavendra wrote:
> 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>

Thanks,
Stefan

> ---
>   drivers/mtd/cfi_mtd.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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;
> 


Viele Gr??e,
Stefan

-- 
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

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

* [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads
  2020-09-17 11:23 [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads Vignesh Raghavendra
  2020-09-17 11:23 ` [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist Vignesh Raghavendra
  2020-09-17 11:23 ` [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads Vignesh Raghavendra
@ 2020-10-05 18:42 ` Vignesh Raghavendra
  2020-10-07  4:55   ` Stefan Roese
  2 siblings, 1 reply; 9+ messages in thread
From: Vignesh Raghavendra @ 2020-10-05 18:42 UTC (permalink / raw)
  To: u-boot

Hi Stefan

On 9/17/20 4:53 PM, Vignesh Raghavendra wrote:
> 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(-)
> 

Do you plan to pick up this series via CFI Flash? Or should I ask Tom to
pull it in? Thanks!

Regards
Vignesh

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

* [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads
  2020-10-05 18:42 ` [PATCH 0/2] mtd: cfi_mtd: Add DMA support " Vignesh Raghavendra
@ 2020-10-07  4:55   ` Stefan Roese
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2020-10-07  4:55 UTC (permalink / raw)
  To: u-boot

Hi Vignesh,

On 05.10.20 20:42, Vignesh Raghavendra wrote:
> Hi Stefan
> 
> On 9/17/20 4:53 PM, Vignesh Raghavendra wrote:
>> 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(-)
>>
> 
> 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

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

* [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist
  2020-09-17 11:23 ` [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist Vignesh Raghavendra
  2020-09-23  6:58   ` Stefan Roese
@ 2020-10-08  7:08   ` Stefan Roese
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2020-10-08  7:08 UTC (permalink / raw)
  To: u-boot

On 17.09.20 13:23, Vignesh Raghavendra wrote:
> Caller would need gracefully handle failures of dma_get_device(),
> therefore reduce pr_err() to pr_debug() when DMA device is not found.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>

Applied to u-boot-cfi-flash/master

Thanks,
Stefan

> ---
>   drivers/dma/dma-uclass.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
> index 8cbb364042..50403148d6 100644
> --- a/drivers/dma/dma-uclass.c
> +++ b/drivers/dma/dma-uclass.c
> @@ -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

-- 
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

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

* [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads
  2020-09-17 11:23 ` [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads Vignesh Raghavendra
  2020-09-23  6:59   ` Stefan Roese
@ 2020-10-08  7:08   ` Stefan Roese
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2020-10-08  7:08 UTC (permalink / raw)
  To: u-boot

On 17.09.20 13:23, Vignesh Raghavendra wrote:
> 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>

Applied to u-boot-cfi-flash/master

Thanks,
Stefan

> ---
>   drivers/mtd/cfi_mtd.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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;
> 


Viele Gr??e,
Stefan

-- 
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

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

end of thread, other threads:[~2020-10-08  7:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 11:23 [PATCH 0/2] mtd: cfi_mtd: Add DMA support for reads Vignesh Raghavendra
2020-09-17 11:23 ` [PATCH 1/2] dma: Reduce error level when DMA channel type does not exist Vignesh Raghavendra
2020-09-23  6:58   ` Stefan Roese
2020-10-08  7:08   ` Stefan Roese
2020-09-17 11:23 ` [PATCH 2/2] mtd: cfi_mtd: Use DMA for reads Vignesh Raghavendra
2020-09-23  6:59   ` Stefan Roese
2020-10-08  7:08   ` Stefan Roese
2020-10-05 18:42 ` [PATCH 0/2] mtd: cfi_mtd: Add DMA support " Vignesh Raghavendra
2020-10-07  4:55   ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.