Received: by 10.223.185.116 with SMTP id b49csp371567wrg; Tue, 20 Feb 2018 00:22:24 -0800 (PST) X-Google-Smtp-Source: AH8x2254xmrGui0oYfPeGPdo73wXy+xVrk+BWZM8hCe9niG6jqF0BRyP9jBvCA+UvD6wBYuhr8p8 X-Received: by 10.98.204.132 with SMTP id j4mr16206173pfk.35.1519114944268; Tue, 20 Feb 2018 00:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519114944; cv=none; d=google.com; s=arc-20160816; b=J5WeGxAbi5ixh4FPpqhgt8BopZvBtEOfwgef8odjMsSxRMfL3p6/TeUuHYUb9x6hPP uRn11bmyYEwxN1WWMoWWWeD7q9dOnpUIQZnj0kC+Zvh95MPNlQi3f0O27YjuS84JhY+C VyMCtPhQq7FTexYZJWC+JFC8GlooI3iBSvVMGMof+yExLuTyZavF7alc6/okBZ8Itxd0 ounuW4Nexydlxw6jxJg7h9gVrbImBSblzj4HDGkcXj8y7e6q05zfxcZCxmrPr6UIU9QU iLEK1xPbD6MOZTx0h66p6zEm+DJ7p2I2gANvV4Sp0zKnLXVf1zmWl0Ul/ssfGNSVcn/p Cg7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:cc:to :subject:from:arc-authentication-results; bh=56DL/fvvPLLUzGBysOoP9Iv30KGzy76iegQMd6PJCfs=; b=Mp54gBBZ1qdb4k/uLOM7K/EiSgJOTIYUjkSCuc/cHCcoJTXrjTiNJUE27nQkrtOmA/ 4RMkS2YdyCkGEBJgytPyNnnGyWKBm6t653jZ4qeMmwwHGjjmNCMTSHPrbktsuOVOivcA fqHuGJViITkG/8aMPXeZHHBBTjItBEjnZTAqM3wJHruKfBCGe8WF3BwlnWK705FKfhdL lCs2xJxFZ0Z4hCZE2KwIeIWnIFelvaysyig4tNzVwdGwMSBC/v2bkLCptJ1kleqg+XvR Sl+ou0LOkXWbo+WQaUgLSXCJOoGB97zcCAwSAJWzUxphmlcw8uhUQpiCKKqv+u7pn+Cg WI4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1-v6si5690039pln.138.2018.02.20.00.22.10; Tue, 20 Feb 2018 00:22:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751362AbeBTIVC (ORCPT + 99 others); Tue, 20 Feb 2018 03:21:02 -0500 Received: from mx-ginzinger.sigmacloud.services ([185.154.235.147]:39003 "EHLO mx-ginzinger.sigmacloud.services" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbeBTIVB (ORCPT ); Tue, 20 Feb 2018 03:21:01 -0500 X-Greylist: delayed 323 seconds by postgrey-1.27 at vger.kernel.org; Tue, 20 Feb 2018 03:21:01 EST 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 CC: Richard Weinberger , , , Manfred Schlaegl 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-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 2.11.0