From patchwork Fri Apr 27 10:19:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Hecht X-Patchwork-Id: 155458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 474A1B6F9D for ; Fri, 27 Apr 2012 20:22:17 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SNiHo-00036k-Mr; Fri, 27 Apr 2012 10:20:24 +0000 Received: from mail-wi0-f171.google.com ([209.85.212.171]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SNiHl-000364-3O for linux-mtd@lists.infradead.org; Fri, 27 Apr 2012 10:20:21 +0000 Received: by wibhj13 with SMTP id hj13so329333wib.0 for ; Fri, 27 Apr 2012 03:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=gWbPAjTyvwx5ZuioHIRGQcHFUxxdqfsyjjzEwMA/nic=; b=g6RVAy/LjIahQ+6faHjfBaZUqbmnakfaB8tYIaKO8suOwFsssz3yYhxcdoutxpU8Bt P1h2B46MXaiCXgaN8+0XLpW7nMmfmAOwHQysZmrV3064zbTJMT3HyywmQkHvZu/SuGx7 hzIIhqYXbwxqv5N4VGtF3lY7LyqiuKAa9UhtyfuVIgvPepgSFjdf7WlbTY+wWj8B7aor Oly3TxZo/eaBbHW3wPMA87KJCWXyny+fYpLJSnTJ84z4g+o+fm7PHfsz9+SrNPZF3uez 6jIZOOpzZaOlkVv0mV95dRPTIpCkpuADDCeY2QUZHhLmCbhNShwAzZmGUSgi+/QAoyFy c4+g== Received: by 10.180.106.9 with SMTP id gq9mr4495871wib.17.1335522017967; Fri, 27 Apr 2012 03:20:17 -0700 (PDT) Received: from localhost.localdomain ([176.74.57.22]) by mx.google.com with ESMTPS id ff9sm3610258wib.2.2012.04.27.03.20.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Apr 2012 03:20:17 -0700 (PDT) From: Bastian Hecht To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: nand: Add a NAND_CMD_STATUS when using write verification Date: Fri, 27 Apr 2012 12:19:31 +0200 Message-Id: <1335521971-5046-1-git-send-email-hechtb@gmail.com> X-Mailer: git-send-email 1.7.5.4 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.6 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (hechtb[at]googlemail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.171 listed in list.dnswl.org] 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 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 To make sure the NAND chip is properly programmed we need a status command before each page write. When CONFIG_MTD_NAND_VERIFY_WRITE=y this assumption is broken when writing multiple pages consecutively. This patch fixes this. Signed-off-by: Bastian Hecht --- drivers/mtd/nand/nand_base.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 8a393f9..58335cd 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2101,6 +2101,9 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, if (chip->verify_buf(mtd, buf, mtd->writesize)) return -EIO; + + /* Make sure the next page prog is preceded by a status read */ + chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1); #endif return 0; }