[PATCHv3][ 1/2] mtd: nand: mxc_nand: Enforce a minimum mtd_info writesize default value.

Denis Carikli denis at eukrea.com
Mon Jan 6 11:02:36 EST 2014


The linux/mtd/mtd.h header has a comment in the
  mtd_info struct definition that says that
  having a writesize of 0 is illegal.

When nand_flash_detect_onfi is called (in the case
  of an ONFI flash), it will call the function
  pointed by read_buf in order to get some parameters
  of the flash chip, including its writesize.

Before decoding the writesize value that was retrived
  with that read, the mxc_nand's mtd_info struct had
  a writesize set to zero.

Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: linux-mtd at lists.infradead.org
Cc: Sascha Hauer <s.hauer at pengutronix.de>
Cc: Eric Bénard <eric at eukrea.com>
Signed-off-by: Denis Carikli <denis at eukrea.com>
---
ChangeLog v2->v3:
New patch in this serie.
---
 drivers/mtd/nand/mxc_nand.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 567a5e5..d4d8d66 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1415,6 +1415,9 @@ static int mxcnd_probe(struct platform_device *pdev)
 	mtd->dev.parent = &pdev->dev;
 	mtd->name = DRIVER_NAME;
 
+	/* Enforce a minimum writesize */
+	mtd->writesize = 512;
+
 	/* 50 us command delay time */
 	this->chip_delay = 5;
 
-- 
1.7.9.5




More information about the linux-mtd mailing list