From patchwork Tue Feb 20 08:15:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manfred Schlaegl X-Patchwork-Id: 875429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="efec4qii"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zltjt0KFBz9ryJ for ; Tue, 20 Feb 2018 19:16:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:To:Subject :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XVSWoEPk0IMY+vsmYXe9nlnISTBYbw+PMkj5yKNqoF0=; b=efec4qiiMqS8i7 YVBC3ZrlSVIAzitK/ucDym2oDjmi1IwIIb2VUX5BeydTlDFZM68Wsbld80Pi+NQ+gYBRypt1SwOxd zv24t6o8pj28K1xhN4MxLsqnwEijxdKfSq9g+lGj6Q1LFINVUp4suQ1Xo1VRN5i7GNgKD7k0s0Kam WKj35DWyvScoHnUl4KCoeElpYNbTZGL7FMmmzXrYp0chQgFtnNwXqcUhXSfYhAj409EA9qV/VfQAy u8z24dv8qaEQutvKpoQond1+iB+yPBgH0rJSmjW3aQKTTXYFDTcfqi+mQGzxyvXVcqclKndgwJVLL 4mjGSYjzh4U21CcgX3pw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eo35w-0005VF-Ek; Tue, 20 Feb 2018 08:16:12 +0000 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eo35d-0005TS-Jt for linux-mtd@lists.infradead.org; Tue, 20 Feb 2018 08:15:55 +0000 Received: from [31.193.165.228] (port=31719 helo=mx-ginzinger.sigmacloud.services) by mx-ginzinger.sigmacloud.services with esmtps (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1eo35J-00062v-2v; Tue, 20 Feb 2018 09:15:34 +0100 Received: from [10.10.1.106] (10.10.1.106) by exc1.buero.ginzinger.com (10.1.1.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1034.26; Tue, 20 Feb 2018 09:15:33 +0100 X-CTCH-RefID: str=0001.0A0B0203.5A8BD925.01EE:SCFSTAT16437741, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 From: Manfred Schlaegl Subject: [PATCH] mtd: nand: gpmi: fix edo mode for non fully ONFI compliant flashes To: Han Xu , Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen Message-ID: <2e12a84b-b4cb-f0ff-f3c9-173def6b5bd2@ginzinger.com> Date: Tue, 20 Feb 2018 09:15:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [10.10.1.106] X-ClientProxiedBy: exc1.buero.ginzinger.com (10.1.1.204) To exc1.buero.ginzinger.com (10.1.1.204) X-EXCLAIMER-MD-ORIGINAL-SUBJECT: [PATCH] mtd: nand: gpmi: fix edo mode for non fully ONFI compliant flashes[NOSIG][NODISC] X-EXCLAIMER-MD-CONFIG: 9dd172f7-de2e-4231-b886-ec11f46e03b3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180220_001553_853892_005B1990 X-CRM114-Status: GOOD ( 12.81 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.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] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Manfred Schlaegl , Richard Weinberger , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In enable_edo_mode the timing mode feature is set according to previously read capabilities of the parameter page ("Timing mode support"). After the value was set, it is read back to provide a "double-check". If the "double check" fails, the whole function returns with an error, which leads to a very slow (non-edo) fallback timing. The problem here is, that there seem to be some NAND flashes, which are not fully ONFI 1.0 compliant. One of these is Winbond W29N04GV. According to datasheet and parameter page, the flash supports timing mode 4 (edo), but the timing mode feature is simply missing. It seems that setting a non-existing feature is simply ignored. The real problem occurs, when the feature is read back: W29N04GV always delivers zero, which causes the "double-check" to fail. This leads to very slow timing and therefore to poor performance. To solve this, we simply remove the double-check, which is a paranoia check anyways. The modification was intensively tested on i.MX6 with linux-4.1, Winbond W29N04GV and Micron MT29F4G08ABADAH4. Signed-off-by: Manfred Schlaegl --- drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c index 97787246af41..40fba96df215 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c @@ -939,16 +939,9 @@ static int enable_edo_mode(struct gpmi_nand_data *this, int mode) if (ret) goto err_out; - /* [2] send GET FEATURE command to double-check the timing mode */ - memset(feature, 0, ONFI_SUBFEATURE_PARAM_LEN); - ret = nand->onfi_get_features(mtd, nand, - ONFI_FEATURE_ADDR_TIMING_MODE, feature); - if (ret || feature[0] != mode) - goto err_out; - nand->select_chip(mtd, -1); - /* [3] set the main IO clock, 100MHz for mode 5, 80MHz for mode 4. */ + /* [2] set the main IO clock, 100MHz for mode 5, 80MHz for mode 4. */ rate = (mode == 5) ? 100000000 : 80000000; clk_set_rate(r->clock[0], rate);