From patchwork Tue Oct 19 14:24:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe De Muyter X-Patchwork-Id: 68340 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5C168B70DF for ; Wed, 20 Oct 2010 01:30:25 +1100 (EST) 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 1P8D86-00038c-8V; Tue, 19 Oct 2010 14:25:30 +0000 Received: from mailrelay008.isp.belgacom.be ([195.238.6.174]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P8D81-00037r-9M for linux-mtd@lists.infradead.org; Tue, 19 Oct 2010 14:25:28 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmIFAFdHvUzCTtAn/2dsb2JhbACTbo15cb5XhUoEiks Received: from mail.macqel.be ([194.78.208.39]) by relay.skynet.be with ESMTP; 19 Oct 2010 16:24:58 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.macqel.be (Postfix) with ESMTP id BF9E1130CE7; Tue, 19 Oct 2010 16:24:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at macqel.be Received: from mail.macqel.be ([127.0.0.1]) by localhost (mail.macqel.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X-eOP9c8XqxC; Tue, 19 Oct 2010 16:24:55 +0200 (CEST) Received: from frolo.macqel.be (frolo.macqel [10.1.40.73]) by mail.macqel.be (Postfix) with ESMTP id 265B6130A48; Tue, 19 Oct 2010 16:24:55 +0200 (CEST) Received: by frolo.macqel.be (Postfix, from userid 1000) id 0F85ADF0417; Tue, 19 Oct 2010 16:24:54 +0200 (CEST) From: Philippe De Muyter To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: Apply Numonyx Axcell P33/P30 workaround for Lock/Unlock bug. Date: Tue, 19 Oct 2010 16:24:23 +0200 Message-Id: <1287498263-5561-1-git-send-email-phdm@macqel.be> X-Mailer: git-send-email 1.7.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101019_102525_499393_7616EB07 X-CRM114-Status: GOOD ( 17.42 ) 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 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [195.238.6.174 listed in list.dnswl.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 Some flash chips have a small but annoying bug, documented in "Numonyx Axcell P33/P30 256-Mbit Specification Update" It states : When customer uses [...] block unlock, the block lock status might be altered inadvertently. Lock status might be set to either 01h or 03h unexpectedly (00h as expected data), which leads to program/erase failure on certain blocks. A workaround is given, (summary : issue a "Read Lock Status" before the "Lock" or "Unlock" command) which I have applied and tested with success. Signed-off-by: Philippe De Muyter --- drivers/mtd/chips/cfi_cmdset_0001.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 9e2b7e9..0d0ae41 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -2047,6 +2047,7 @@ static int __xipram do_xxlock_oneblock(struct map_info *map, struct flchip *chip { struct cfi_private *cfi = map->fldrv_priv; struct cfi_pri_intelext *extp = cfi->cmdset_priv; + int ofs_factor = cfi->interleave * cfi->device_type; int udelay; int ret; @@ -2062,6 +2063,14 @@ static int __xipram do_xxlock_oneblock(struct map_info *map, struct flchip *chip ENABLE_VPP(map); xip_disable(map, chip, adr); + /* + * Issue a "Read Lock Status" before the "Lock" or "Unlock" : + * see errata "Numonyx Axcell P33/P30 Specification Update" :) + */ + map_write(map, CMD(0x90), adr+(2*ofs_factor)); + chip->state = FL_JEDEC_QUERY; + cfi_read_query(map, adr+(2*ofs_factor)); + map_write(map, CMD(0x60), adr); if (thunk == DO_XXLOCK_ONEBLOCK_LOCK) { map_write(map, CMD(0x01), adr);