From patchwork Wed Sep 4 18:25:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 272704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [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 E84092C008F for ; Thu, 5 Sep 2013 04:27:49 +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 1VHHn6-0005oh-Se; Wed, 04 Sep 2013 18:26:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHHmn-0004u4-7x; Wed, 04 Sep 2013 18:26:37 +0000 Received: from mail-ie0-x229.google.com ([2607:f8b0:4001:c03::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VHHmP-0004mZ-KH for linux-mtd@lists.infradead.org; Wed, 04 Sep 2013 18:26:15 +0000 Received: by mail-ie0-f169.google.com with SMTP id tp5so1508655ieb.0 for ; Wed, 04 Sep 2013 11:25:51 -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:in-reply-to:references; bh=TwW0WxfGJAjtzfuLSxAEB9tgbAHS30Kpu1doJIqFc/Y=; b=XA46E4IWl8o0efwXfKNoWn/FjFArNjVgJeMlwwl+fRib/Lan3YV6mvbARop0gfCVr7 m1DQjVEEIcQnA/57WjS1wZFKKPqfIMjTgz7c8YUGSh6tiXr5QWYtMoxDP6hEb4+UZDf8 YKwXNJ3hSr/YjOYBqNR+S7q8pD4Wr//lrFNXPV7O3xWgj2KHWGWzrsR/ZBqrzUhcmmq/ w7U2/0qEHbAcWVLRN/yfqm3Hb6j4ZaulS2ofmCpmO15wxLxPk0cwWz/OYjPbzdqNupfZ PUo2eCrLOMZW5d13ogtjX/V1cG6Vba3BD55jtz6ZJIOy2Osx0I4fTRTQI4F2Z11Ff8fC 0sIg== X-Received: by 10.50.6.106 with SMTP id z10mr2886424igz.9.1378319151854; Wed, 04 Sep 2013 11:25:51 -0700 (PDT) Received: from ld-irv-0074.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id ka5sm4978938igb.2.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Sep 2013 11:25:51 -0700 (PDT) From: Brian Norris To: Subject: [PATCH 08/12] mtd: nand: don't print ONFI buswidth errors unless we need to Date: Wed, 4 Sep 2013 11:25:22 -0700 Message-Id: <1378319126-24473-9-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1378319126-24473-1-git-send-email-computersforpeace@gmail.com> References: <1378319126-24473-1-git-send-email-computersforpeace@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130904_142613_743279_C7D4F0DD X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -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_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Brian Norris 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org There are a few things wrong with this error message. First, it is unnecessary to print until after the READID (address 20h) command. READID *has* to work properly in whatever bus width configuration we are in, or else no identification mode works. So we can silence some useless warnings on systems which come up in 16-bit mode and do not even respond with an O-N-F-I string. Second, it doesn't read very well, and it has an extraneous exclamation. Third, it doesn't have proper multiline comment style. So, I move the whole block below the READID check and rewrite it. Signed-off-by: Brian Norris --- drivers/mtd/nand/nand_base.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 38b8dd4..8599096 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2937,17 +2937,21 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, int i; int val; - /* ONFI need to be probed in 8 bits mode, and 16 bits should be selected with NAND_BUSWIDTH_AUTO */ - if (chip->options & NAND_BUSWIDTH_16) { - pr_err("Trying ONFI probe in 16 bits mode, aborting !\n"); - return 0; - } /* Try ONFI for unknown chip or LP */ chip->cmdfunc(mtd, NAND_CMD_READID, 0x20, -1); if (chip->read_byte(mtd) != 'O' || chip->read_byte(mtd) != 'N' || chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I') return 0; + /* + * ONFI must be probed in 8-bit mode or with NAND_BUSWIDTH_AUTO, not + * with NAND_BUSWIDTH_16 + */ + if (chip->options & NAND_BUSWIDTH_16) { + pr_err("ONFI cannot be probed in 16-bit mode; aborting\n"); + return 0; + } + chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); for (i = 0; i < 3; i++) { chip->read_buf(mtd, (uint8_t *)p, sizeof(*p));