public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] NAND: Let NAND_NO_SUBPAGE_WRITE through
@ 2011-11-05  2:24 Marek Vasut
  2011-11-06  9:01 ` Stefano Babic
  2011-11-10 17:02 ` Marek Vasut
  0 siblings, 2 replies; 10+ messages in thread
From: Marek Vasut @ 2011-11-05  2:24 UTC (permalink / raw)
  To: u-boot

There is a problem reported that the NAND_NO_SUBPAGE_WRITE, set by some drivers,
is silently ignored by NAND core. This causes UBI to malfunction on these
drivers, because UBI tries to use subpage writes.

This was discussed already with no conclusion, see thread:
Message-Id: <1302372335-30232-6-git-send-email-sbabic@denx.de>

The bug was recently retriggered by Veli-Pekka Peltola, causing him trouble with
UBI on the MX28 CPU:
Message-ID: <4EB3E4EA.9080509@bluegiga.com>

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
---
 drivers/mtd/nand/nand_base.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 6aac6a2..7ecd5a3 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2548,6 +2548,7 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 {
 	int ret, maf_idx;
 	int tmp_id, tmp_manf;
+	int no_subpage = 0;
 
 	/* Select the device */
 	chip->select_chip(mtd, 0);
@@ -2612,10 +2613,20 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 	if (!ret)
 		nand_flash_detect_non_onfi(mtd, chip, type, &busw);
 
+	/*
+	 * If the controller is incapable of subpage writes, force no subpage
+	 * writes. This has to be done here, otherwise UBI will complain.
+	 */
+	if (chip->options & NAND_NO_SUBPAGE_WRITE)
+		no_subpage = 1;
+
 	/* Get chip options, preserve non chip based options */
 	chip->options &= ~NAND_CHIPOPTIONS_MSK;
 	chip->options |= type->options & NAND_CHIPOPTIONS_MSK;
 
+	if (no_subpage)
+		chip->options |= NAND_NO_SUBPAGE_WRITE;
+
 	/*
 	 * Set chip as a default. Board drivers can override it, if necessary
 	 */
-- 
1.7.6.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-11-11 17:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-05  2:24 [U-Boot] [PATCH] NAND: Let NAND_NO_SUBPAGE_WRITE through Marek Vasut
2011-11-06  9:01 ` Stefano Babic
2011-11-06 12:43   ` Marek Vasut
2011-11-06 14:54     ` Stefano Babic
2011-11-06 15:16       ` Marek Vasut
2011-11-10 17:02 ` Marek Vasut
2011-11-10 17:10   ` Scott Wood
2011-11-10 17:44     ` Marek Vasut
2011-11-11 12:52       ` Veli-Pekka Peltola
2011-11-11 17:50         ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox