[PATCH] Bug fix in kernel nand driver code for ONFI flash with unconfigured buswidth

Willem Atsma willem.atsma at tanglebridge.com
Thu Jun 25 16:46:46 PDT 2015


Previously, when ONFI configuration succeeds the driver configuration might
still fail in the calling function nand_get_flash_type() if the
chip->options was not configured for the detected busw (8 or 16bit). With
ONFI present the hardware driver does not need to be configured. However
downstream the driver uses the chip->options field, so this patch updates
the bits when ONFI detection succeeds.

This fixes nand driver configuration on the overo-earth platform with
micron nand flash.

Signed-off-by: Willem Atsma <willem.atsma at tanglebridge.com>
---
 drivers/mtd/nand/nand_base.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ceb68ca..7b20471 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3218,6 +3218,11 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
 	else
 		*busw = 0;
 
+	/* Set the chip option here since ONFI succeeded and non-ONFI config may
+	 * be incomplete:
+	 */
+	chip->options |= *busw;
+
 	if (p->ecc_bits != 0xff) {
 		chip->ecc_strength_ds = p->ecc_bits;
 		chip->ecc_step_ds = 512;
-- 
1.9.1




More information about the linux-mtd mailing list