diff mbox

mtd: nand: onfi don't WARN if we are in 16 bits mode

Message ID 1358346345-7920-1-git-send-email-matthieu.castet@parrot.com
State Accepted
Commit 0ce82b7f7b7373b16ecf7b5725e21e2975204500
Headers show

Commit Message

Matthieu CASTET Jan. 16, 2013, 2:25 p.m. UTC
ff3206b2450499203532af2505a7f6f8413e92c0 adds a WARN if the onfi probe is
in 16 bits mode.
This allows to detect driver that need to be fixed, but this is a bit noisy [1].
Transform the WARN in a pr_err.

[1]
http://article.gmane.org/gmane.linux.ports.arm.omap/91317

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mtd/nand/nand_base.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Artem Bityutskiy Jan. 28, 2013, 4:13 p.m. UTC | #1
On Wed, 2013-01-16 at 15:25 +0100, Matthieu CASTET wrote:
> ff3206b2450499203532af2505a7f6f8413e92c0 adds a WARN if the onfi probe is
> in 16 bits mode.
> This allows to detect driver that need to be fixed, but this is a bit noisy [1].
> Transform the WARN in a pr_err.
> 
> [1]
> http://article.gmane.org/gmane.linux.ports.arm.omap/91317
> 
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>

This one is in linux-mtd.git now.
diff mbox

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8323ac9..3766682 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2857,8 +2857,11 @@  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 */
-	WARN_ON(chip->options & NAND_BUSWIDTH_16);
+	/* 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' ||