From patchwork Thu Jul 4 12:05:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 256880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B9AA72C0085 for ; Thu, 4 Jul 2013 22:06:24 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UuiIS-0007xW-H2; Thu, 04 Jul 2013 12:06:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UuiIA-00061d-UK; Thu, 04 Jul 2013 12:05:42 +0000 Received: from antispam01.maxim-ic.com ([205.153.101.182] helo=antispam01.maximintegrated.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UuiI7-00060z-US for linux-mtd@lists.infradead.org; Thu, 04 Jul 2013 12:05:40 +0000 X-ASG-Debug-ID: 1372939513-02ae980b645a170001-6YE7NY Received: from maxdalex02.maxim-ic.internal (maxdalex02.maxim-ic.internal [10.16.15.104]) by antispam01.maximintegrated.com with ESMTP id fENHCN1kq7ZM72oO; Thu, 04 Jul 2013 07:05:13 -0500 (CDT) X-Barracuda-Envelope-From: brian.foster@maximintegrated.com Received: from maxsvlex02.maxim-ic.internal (10.32.112.18) by maxdalex02.maxim-ic.internal (10.16.15.104) with Microsoft SMTP Server (TLS) id 8.3.192.1; Thu, 4 Jul 2013 07:05:12 -0500 Received: from laclwks004.localnet (10.201.0.52) by maxsvlex02.maxim-ic.internal (10.32.112.18) with Microsoft SMTP Server (TLS) id 8.3.192.1; Thu, 4 Jul 2013 05:05:12 -0700 From: Brian Foster To: "linux-mtd@lists.infradead.org" Subject: [PATCH] Init ONFI get/set features in a more logical place Date: Thu, 4 Jul 2013 14:05:09 +0200 X-ASG-Orig-Subj: [PATCH] Init ONFI get/set features in a more logical place Message-ID: <196135732.t1bWnDcIrg@laclwks004> User-Agent: KMail/4.8.5 (Linux/3.2.0-48-generic; KDE/4.8.5; x86_64; ; ) In-Reply-To: References: <17588192.75Agdljyqk@laclwks004> <2540574.yn0MEqSsGa@laclwks004> MIME-Version: 1.0 X-Barracuda-Connect: maxdalex02.maxim-ic.internal[10.16.15.104] X-Barracuda-Start-Time: 1372939513 X-Barracuda-URL: http://AntiSpam02.maxim-ic.com:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at maximintegrated.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.12 X-Barracuda-Spam-Status: No, SCORE=0.12 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests=BSF_SC0_MISMATCH_TO, CN_BODY_332 X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.135779 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.12 CN_BODY_332 BODY: CN_BODY_332 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130704_080540_082612_C1840AB8 X-CRM114-Status: GOOD ( 16.23 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Florian Fainelli X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Attached (SORRY! see below) is a Patch based on some work being done on a v2.6.36-based kernel (with parts of more recent MTD/NAND support backported), to add support for Micron on-die ECC to Maxim Integrated's MAX32590 (JIBE) reference boards. This Patch makes a minor change to initialization order so code between nand_scan_ident() and nand_scan_tail() can easily get (or set) ONFI features. Since the original Patch is based on that older kernel, I can neither confirm nor deny it builds and works with the latest kernel/MTD/NAND source. However, I also have no reason to believe it won't build or work. Due to limitations of the e-mail server, the Patch is attached rather then being included inline. Apologies. Even so, the bloody server has _probably_ added CRs (\r), so you will _probably_ have to run the attached Patch through dos2unix(1) before it will apply. ;-\ CC-ed to the author of the original work. Since I do not regularly read this list (linux-mtd), any e-mail not CC-ed to me _may_ not be seen. Apologies! cheers! -blf- From 400afdd7734c74881e208ae4b7fdb2a3dc2220bb Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Thu, 4 Jul 2013 13:35:31 +0200 Subject: [PATCH] Init ONFI get/set features in a more logical place For some reason the ONFI get/set feature handlers were being initialized in nand_scan_tail(), making it rather difficult to use the default handlers after nand_scan_ident(), which determines whether or not the NAND chip is ONFI-compliant. Move the handler initialization into nand_set_defaults(), where most handlers are initialized. Change-Id: I055179ab3d4ea23780879197f4add02e27e6c0d1 Signed-off-by: Brian Foster Cc: Florian Fainelli --- drivers/mtd/nand/nand_base.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index dfcd0a5..aab79f7 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2814,6 +2814,11 @@ static void nand_set_defaults(struct nand_chip *chip, int busw) init_waitqueue_head(&chip->controller->wq); } + /* set for ONFI nand */ + if (!chip->onfi_set_features) + chip->onfi_set_features = nand_onfi_set_features; + if (!chip->onfi_get_features) + chip->onfi_get_features = nand_onfi_get_features; } /* Sanitize ONFI strings so we can safely print them */ @@ -3446,12 +3451,6 @@ int nand_scan_tail(struct mtd_info *mtd) if (!chip->write_page) chip->write_page = nand_write_page; - /* set for ONFI nand */ - if (!chip->onfi_set_features) - chip->onfi_set_features = nand_onfi_set_features; - if (!chip->onfi_get_features) - chip->onfi_get_features = nand_onfi_get_features; - /* * Check ECC mode, default to software if 3byte/512byte hardware ECC is * selected and we have 256 byte pagesize fallback to software ECC -- 1.7.9.5