public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
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	[thread overview]
Message-ID: <1378319126-24473-9-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1378319126-24473-1-git-send-email-computersforpeace@gmail.com>

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 <computersforpeace@gmail.com>
---
 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));
-- 
1.8.4

  parent reply	other threads:[~2013-09-04 18:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 18:25 [PATCH 00/12] mtd: miscellaneous fixes Brian Norris
2013-09-04 18:25 ` [PATCH 01/12] nand: docg4: use nand_base's default BBT scan Brian Norris
2013-09-05 20:09   ` Mike Dunn
2013-09-04 18:25 ` [PATCH 02/12] mtd: nand: lpc32xx_slc: don't call nand_default_bbt directly Brian Norris
2013-09-04 18:25 ` [PATCH 03/12] mtd: nandsim: don't call nand_default_bbt() directly Brian Norris
2013-09-04 18:25 ` [PATCH 04/12] mtd: nand: stop exporting nand_default_bbt Brian Norris
2013-09-04 18:25 ` [PATCH 05/12] mtd: dataflash: remove unused field Brian Norris
2013-09-04 18:25 ` [PATCH 06/12] mtd: denali: make init function static Brian Norris
2013-09-04 18:25 ` [PATCH 07/12] mtd: nand: return failure when failing to get ECC from ONFI Brian Norris
2013-09-05  2:34   ` Huang Shijie
2013-09-11 21:43     ` Brian Norris
2013-09-11 23:02       ` Ezequiel Garcia
2013-09-04 18:25 ` Brian Norris [this message]
2013-09-04 18:25 ` [PATCH 09/12] mtd: onenand: remove redundant offset check Brian Norris
2013-09-04 18:25 ` [PATCH 10/12] mtd: nand: remove obsolete 'ecclayout' field Brian Norris
2013-09-04 18:25 ` [PATCH 11/12] mtd: onenand: remove unused variable assignments Brian Norris
2013-09-04 18:25 ` [PATCH 12/12] mtd: lpddr_cmds: make function static Brian Norris
2013-09-11 22:27 ` [PATCH 00/12] mtd: miscellaneous fixes Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378319126-24473-9-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox