linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Problem with mxc_nand driver
@ 2009-09-28  6:41 Jernej Turnsek
  2009-09-28  7:39 ` Eric Bénard
  0 siblings, 1 reply; 8+ messages in thread
From: Jernej Turnsek @ 2009-09-28  6:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Yesterday I have updated my linux kernel for ARM MX27 platform from
git repository and I have observed some strange behaviour regarding
nand driver.
I have a jffs2 partition on Samsung K9F1G08U0B and when I load a root
fs for the first time, it works, but after another reset I got
messages: "Bad erase block %d at"...
These messages are only for the blocks which are still empty.

After investigating problem I found that mxc_nand.c file was changed:

---
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 76beea4..65b26d5 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -857,6 +857,17 @@ static void mxc_nand_command(struct mtd_info
*mtd, unsigned command,
     }
 }

+/* Define some generic bad / good block scan pattern which are used
+ * while scanning a device for factory marked good / bad blocks. */
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr smallpage_memorybased = {
+    .options = NAND_BBT_SCAN2NDPAGE,
+    .offs = 5,
+    .len = 1,
+    .pattern = scan_ff_pattern
+};
+
 static int __init mxcnd_probe(struct platform_device *pdev)
 {
     struct nand_chip *this;
@@ -973,7 +984,10 @@ static int __init mxcnd_probe(struct platform_device *pdev)
         goto escan;
     }

-    host->pagesize_2k = (mtd->writesize == 2048) ? 1 : 0;
+    if (mtd->writesize == 2048) {
+        host->pagesize_2k = 1;
+        this->badblock_pattern = &smallpage_memorybased;
+    }

     if (this->ecc.mode == NAND_ECC_HW) {
         switch (mtd->oobsize) {

---

I found a bit strange to set badblock_pattern parameter to
smallpage_memorybased although pagesize is 2k. Or am I wrong?

When I revert this patch, everything works as it should.

BR,
Jernej

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

end of thread, other threads:[~2009-09-30 10:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-28  6:41 Problem with mxc_nand driver Jernej Turnsek
2009-09-28  7:39 ` Eric Bénard
2009-09-28  8:56   ` Jernej Turnsek
2009-09-28  9:20     ` Eric Bénard
2009-09-28  9:41       ` Jernej Turnsek
2009-09-28  9:43         ` Eric Bénard
2009-09-28 10:30           ` Jernej Turnsek
2009-09-30 10:07         ` Rabin Vincent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).