Skip to contentSkip to conversation

MTD: atmel_nand: modify test case for using DMA operations

PATCH New Hong Xu 3 participants 11 messages Mar 30, 2011 – Apr 1, 2011

Subsystems (3)
lore
Share & tools
lore

Hong Xu

author
#0 lore raw

PATCH 1/3 MTD: atmel_nand: modify test case for using DMA operations

From: Nicolas Ferre <[email protected]>

We have better performances not using DMA for oob operations. Modify size test so that it is using DMA for size greater than oobsize.

---
 drivers/mtd/nand/atmel_nand.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -2
index 6fae04b..9acecdc 100644
@@ -280,7 +280,7 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
 	struct nand_chip *chip = mtd->priv;
 	struct atmel_nand_host *host = chip->priv;
 
-	if (use_dma && len >= mtd->oobsize)
+	if (use_dma && len > mtd->oobsize)
 		if (atmel_nand_dma_op(mtd, buf, len, 1) == 0)
 			return;
 
@@ -295,7 +295,7 @@ static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
 	struct nand_chip *chip = mtd->priv;
 	struct atmel_nand_host *host = chip->priv;
 
-	if (use_dma && len >= mtd->oobsize)
+	if (use_dma && len > mtd->oobsize)
 		if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0)
 			return;
 
Signature · 1 line
1.7.3.3
author
#1 lore raw

PATCH 2/3 MTD: atmel_nand: trivial: change DMA usage information trace

From: Nicolas Ferre <[email protected]>

---
 drivers/mtd/nand/atmel_nand.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -1
index 9acecdc..c36ea50 100644
@@ -611,7 +611,8 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
 		}
 	}
 	if (use_dma)
-		dev_info(host->dev, "Using DMA for NAND access.\n");
+		dev_info(host->dev, "Using %s for DMA transfers.\n",
+					dma_chan_name(host->dma_chan));
 	else
 		dev_info(host->dev, "No DMA support for NAND access.\n");
 
Signature · 1 line
1.7.3.3
author
#3 lore raw

PATCH 3/3 MTD/atmel_nand: Fix support for CPUs that do not support DMA access

In reply to Hong Xu

use_dma was always "1" even if the CPU does not support DMA

Tested on AT91SAM9261EK by Jean-Christophe PLAGNIOL-VILLARD

---
 drivers/mtd/nand/atmel_nand.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/mtd/nand/atmel_nand.c +4 -1
index c36ea50..1b43654 100644
@@ -599,7 +599,10 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
 		nand_chip->options |= NAND_USE_FLASH_BBT;
 	}
 
-	if (cpu_has_dma() && use_dma) {
+	if (!cpu_has_dma())
+		use_dma = 0;
+
+	if (use_dma) {
 		dma_cap_mask_t mask;
 
 		dma_cap_zero(mask);
Signature · 1 line
1.7.3.3
#4 lore raw

PATCH 3/3 MTD/atmel_nand: Fix support for CPUs that do not support DMA access

Quoted 6 lines · Hong Xu

use_dma was always "1" even if the CPU does not support DMA

Tested on AT91SAM9261EK by Jean-Christophe PLAGNIOL-VILLARD

Pushed to l2-mtd-2.6.git tree. This looks like a candidate for the stable tree - should it be sent there?

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)
#5 lore raw

PATCH 3/3 MTD/atmel_nand: Fix support for CPUs that do not support DMA access

Le 01/04/2011 14:54, Artem Bityutskiy :

Quoted 10 lines · Hong Xu
Quoted 6 lines

use_dma was always "1" even if the CPU does not support DMA

Tested on AT91SAM9261EK by Jean-Christophe PLAGNIOL-VILLARD

Pushed to l2-mtd-2.6.git tree. This looks like a candidate for the stable tree - should it be sent there?

Well, definitively the whole series is a candidate for .39-xx (also with the "[PATCH] MTD: atmel_nand: Fall back to CPU I/O when buffer is in vmalloc(ed) region" that follows.

But, as DMA access was not included in .38, stable tree should not be impacted.

Best regards,

Signature · 1 line
Nicolas Ferre
#6 lore raw

PATCH 3/3 MTD/atmel_nand: Fix support for CPUs that do not support DMA access

Quoted 12 lines · Nicolas Ferre

Le 01/04/2011 14:54, Artem Bityutskiy :

Quoted 10 lines · Hong Xu
Quoted 6 lines

use_dma was always "1" even if the CPU does not support DMA

Tested on AT91SAM9261EK by Jean-Christophe PLAGNIOL-VILLARD

Pushed to l2-mtd-2.6.git tree. This looks like a candidate for the stable tree - should it be sent there?

Quoted 6 lines

Well, definitively the whole series is a candidate for .39-xx (also with the "[PATCH] MTD: atmel_nand: Fall back to CPU I/O when buffer is in vmalloc(ed) region" that follows.

But, as DMA access was not included in .38, stable tree should not be impacted.

I see, then this is not -stable material. But should be merged this merge window.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)
#7 lore raw

PATCH 3/3 MTD/atmel_nand: Fix support for CPUs that do not support DMA access

In reply to Nicolas Ferre
Quoted 9 lines · Nicolas Ferre

Le 01/04/2011 14:54, Artem Bityutskiy :

Quoted 8 lines · Hong Xu
Quoted 6 lines

use_dma was always "1" even if the CPU does not support DMA

Tested on AT91SAM9261EK by Jean-Christophe PLAGNIOL-VILLARD

Quoted 6 lines
Quoted 2 lines

Pushed to l2-mtd-2.6.git tree. This looks like a candidate for the stable tree - should it be sent there?

Well, definitively the whole series is a candidate for .39-xx (also with the "[PATCH] MTD: atmel_nand: Fall back to CPU I/O when buffer is in vmalloc(ed) region" that follows.

Thanks for pointing this, I could miss that patch.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)
#8 lore raw

PATCH 1/3 MTD: atmel_nand: modify test case for using DMA operations

In reply to Hong Xu
Quoted 3 lines · Hong Xu

From: Nicolas Ferre <[email protected]>

We have better performances not using DMA for oob operations.

Would it be possible to have this comment in the code, not only in the commit message?

Quoted 3 lines

Modify size test so that it is using DMA for size greater than oobsize.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)
#9 lore raw

PATCH v2 1/3 MTD: atmel_nand: modify test case for using DMA operations

We have better performances not using DMA for oob operations. Modify size test so that it is using DMA for size greater than oobsize.

---
Artem,

Here is the v2 version with embedded comment as you suggested.

Best regards,

 drivers/mtd/nand/atmel_nand.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/nand/atmel_nand.c +4 -2
index 6fae04b..5872f2a 100644
@@ -280,7 +280,8 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
 	struct nand_chip *chip = mtd->priv;
 	struct atmel_nand_host *host = chip->priv;
 
-	if (use_dma && len >= mtd->oobsize)
+	if (use_dma && len > mtd->oobsize)
+		/* only use DMA for bigger than oob size: better performances */
 		if (atmel_nand_dma_op(mtd, buf, len, 1) == 0)
 			return;
 
@@ -295,7 +296,8 @@ static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
 	struct nand_chip *chip = mtd->priv;
 	struct atmel_nand_host *host = chip->priv;
 
-	if (use_dma && len >= mtd->oobsize)
+	if (use_dma && len > mtd->oobsize)
+		/* only use DMA for bigger than oob size: better performances */
 		if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0)
 			return;
 
Signature · 1 line
1.7.3
#10 lore raw
Quoted 4 lines · Nicolas Ferre

We have better performances not using DMA for oob operations. Modify size test so that it is using DMA for size greater than oobsize.

Pushed to l2-mtd-2.6.git, thank you!

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)