From patchwork Fri Apr 1 14:40:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 89260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6BCD7B6F8C for ; Sat, 2 Apr 2011 00:34:46 +1100 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q5eTY-00051c-68; Fri, 01 Apr 2011 13:33:20 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q5eTW-0001PQ-Fx; Fri, 01 Apr 2011 13:33:18 +0000 Received: from newsmtp5.atmel.com ([204.2.163.5] helo=sjogate2.atmel.com) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q5eTT-0001Op-L8; Fri, 01 Apr 2011 13:33:16 +0000 Received: from meyreuil.atmel.fr ([10.159.254.132]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id p31DUNlC029611; Fri, 1 Apr 2011 06:30:24 -0700 (PDT) Received: from bendor.rfo.atmel.com ([10.159.245.201]) by meyreuil.atmel.fr (8.11.7p1+Sun/8.11.7) with ESMTP id p31DX9r07273; Fri, 1 Apr 2011 15:33:09 +0200 (MEST) From: Nicolas Ferre To: dedekind1@gmail.com, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3 v2] MTD: atmel_nand: modify test case for using DMA operations Date: Fri, 1 Apr 2011 16:40:44 +0200 Message-Id: <1301668844-4500-1-git-send-email-nicolas.ferre@atmel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1301662188.2789.57.camel@localhost> References: <1301662188.2789.57.camel@localhost> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110401_093315_964572_49F78066 X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: hong.xu@atmel.com, Nicolas Ferre , linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- 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(-) diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 6fae04b..5872f2a 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -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;