All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pathompong Puengrostham <jay4mail@yahoo.com>
To: linux-mtd@lists.infradead.org
Subject: Re: JFFS2 on NAND, Magic bitmask 0x1985 not found
Date: Wed, 14 Jul 2004 11:57:27 +0700	[thread overview]
Message-ID: <40F4BD37.4090500@yahoo.com> (raw)
In-Reply-To: <40F4B205.6060902@yahoo.com>

Hi,

I just found the problem. It is that my NAND flash CE pin is not driven 
by GPIO. It is driven by CS from the CPU. Here is the change that I made.

--- mtd/drivers/mtd/nand/nand_base.c	2004-07-01 05:00:10.000000000 +0700
+++ linux/drivers/mtd/nand/nand_base.c	2004-07-14 11:32:37.419835456 +0700
@@ -990,8 +990,15 @@
  	 * by an GPIO pin ?
  	 */
  out:	
+#ifdef CONFIG_MTD_NAND_CE_NOT_GPIO
+	if (!this->dev_ready)
+		udelay (this->chip_delay);
+	else
+		while (!this->dev_ready(mtd));
+#else
  	this->select_chip(mtd, -1);
  	this->select_chip(mtd, chipnr);
+#endif
  	return res;
  }
  #endif
@@ -1248,8 +1255,15 @@
  		} else		
  			read += mtd->oobblock;

-		if (read == len)
+		if (read == len) {
+#ifdef CONFIG_MTD_NAND_CE_NOT_GPIO
+			if (!this->dev_ready)
+				udelay (this->chip_delay);
+			else
+				while (!this->dev_ready(mtd));
+#endif
  			break;	
+		}

  		/* For subsequent reads align to page boundary. */
  		col = 0;
@@ -1374,6 +1388,14 @@
  			        this->cmdfunc (mtd, NAND_CMD_READOOB, 0x0, page & 
this->pagemask);
  			}
  		}
+#ifdef CONFIG_MTD_NAND_CE_NOT_GPIO
+		else {
+			if (!this->dev_ready)
+				udelay (this->chip_delay);
+			else
+				while (!this->dev_ready(mtd));
+		}
+#endif
  	}

  	/* Deselect and wake up anyone waiting on the device */


I also had to add the following to my nand_init().

for (i = 0; nand_flash_ids[i].name != NULL; i++)
	nand_flash_ids[i].options |= NAND_NO_AUTOINCR;

Regards,
Jay

Pathompong Puengrostham wrote:
> Hi all,
> 
> Could anybody help me on this please? I mounted a cleanly erased NAND 
> flash , unmounted without writing anything into it and then mounted it 
> again. I got the following errors.
> 
> nand_read_ecc: Failed ECC read, page 0x000000e0
> mtd->read(0x400 bytes from 0x1c000) returned ECC error
> jffs2_scan_eraseblock(): Node at 0x0001c008 {0x1985, 0x2003, 0x00000008) 
> has invalid CRC 0xffff0000 (calculated 0x6b7c27e6)
> jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0001c00c: 
> 0x0008 instead
> nand_read_ecc: Failed ECC read, page 0x00000120
> mtd->read(0x400 bytes from 0x24000) returned ECC error
> jffs2_scan_eraseblock(): Node at 0x00024008 {0x1985, 0x2003, 0x00000008) 
> has invalid CRC 0xffff0000 (calculated 0x6b7c27e6)
> jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002400c: 
> 0x0008 instead
> ...
> 
> This is the data that I dump out of the flash using "nanddump /dev/mtd3 
> dump.txt 114688 1024"
> 
> 0x0001c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0x0001c010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ...
> 0x0001c1f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>   OOB Data: ff ff ff ff ff ff ff ff 85 19 03 20 08 00 00 00
> 0x0001c200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 0x0001c210: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ...
> 0x0001c3f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>   OOB Data: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> 
> I can see that the magic bitmask 0x1985 is there. Why did JFFS2 look at 
> the wrong place and got 0x0008 instead?
> 
> I'm using mtd snapshot 20040707.
> 
> Thank you in advance.
> 
> Regards,
> Jay
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 
> 

  reply	other threads:[~2004-07-14  4:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-14  4:09 JFFS2 on NAND, Magic bitmask 0x1985 not found Pathompong Puengrostham
2004-07-14  4:57 ` Pathompong Puengrostham [this message]
2004-07-14  7:41   ` Thomas Gleixner
2004-07-14  9:55     ` Pathompong Puengrostham
2004-07-14 10:39       ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40F4BD37.4090500@yahoo.com \
    --to=jay4mail@yahoo.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.