mtd: atmel_nand: modify test case for using DMA operations
authorNicolas Ferre <nicolas.ferre@atmel.com>
Fri, 1 Apr 2011 14:40:44 +0000 (16:40 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 1 Apr 2011 13:44:32 +0000 (16:44 +0300)
We have better performances not using DMA for oob operations.
Modify size test so that it is using DMA for size greater than oobsize.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/nand/atmel_nand.c

index f254fa6..e9fdbe4 100644 (file)
@@ -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;