public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se>
To: "'Anders Grafström'" <grfstrm@users.sourceforge.net>,
	"'Jared Hulbert'" <jaredeh@gmail.com>,
	"'Alexey Korolev'" <akorolev@infradead.org>,
	"'Linux-MTD Mailing List'" <linux-mtd@lists.infradead.org>
Subject: RE: cfi_cmdset_0001.c: Excessive erase suspends
Date: Sat, 19 Apr 2008 11:18:11 +0200	[thread overview]
Message-ID: <012501c8a1fe$4a5308e0$def91aa0$@Tjernlund@transmode.se> (raw)
In-Reply-To: <48091C7A.1070709@users.sourceforge.net>



> -----Original Message-----
> From: linux-mtd-bounces@lists.infradead.org [mailto:linux-mtd-bounces@lists.infradead.org] On Behalf
> Of Anders Grafström
> Sent: den 19 april 2008 00:11
> To: Jared Hulbert; Alexey Korolev; Linux-MTD Mailing List
> Subject: Re: cfi_cmdset_0001.c: Excessive erase suspends
> 
> Jared Hulbert wrote:
> > 2) Did you check that the MTD is configured to treat this flash with
> > the correct bus width?  I've been burned trying to figure out why a
> > 16bit configuration was missing half the data, turned out I had it
> > configured for 32bit MTD accesses.
> 
> I think I got it right.
> 
> > 3) I'd like to see that you can't use flash_eraseall and hexdump
> > /dev/mtdX to see this behavior.  Or maybe you could try to create a
> > simple test that would suspend an erase 10K times and verify the erase
> 
> See below.
> 
> > A solution might be an small delay before a
> > write suspends the erase.
> 
> udelay(100) right before the suspend command seems to work for me.
> It reduces the suspend count to about 1700 and no errors reported
> by JFFS2.
> 
> 
> I ran this routine in a standalone test program from u-boot:
> 
> void test_flash_erase_suspend(void)
> {
> 	volatile unsigned int *flash = (unsigned int *)0x41040000;
> 	unsigned int i;
> 	unsigned int suspends = 0;
> 	unsigned int words = 10;
> 
> 	/* Make sure there's something to erase */
> 	for (i = 0; i < 0x10000; i++) {
> 		if (flash[i] == 0xffffffff) {
> 			flash[i] = 0x00400040;
> 			flash[i] = 0;
> 			while ((flash[i] & 0x00800080) != 0x00800080);
> 		}
> 	}
> 
> 	/* Clear status */
> 	flash[0] = 0x00500050;
> 
> 	/* Erase */
> 	flash[0] = 0x00200020;
> 	flash[0] = 0x00d000d0;
> 
> 	while (1) {
> 		/* Suspend */
> 		flash[0] = 0x00b000b0;
> 		suspends++;
> 
> 		/* Short delay */
> 		for (i = 0; i < 1000; i++);
> 

Don't you need to check that the chip is suspended before you do any
new operation?

> 		/* Resume */
> 		flash[0] = 0x00d000d0;
> 		flash[0] = 0x00700070;
> 
> 		/* Erase done ? */
> 		if ((flash[i] & 0x00800080) == 0x00800080) {
> 			printf("\nStatus %08x\n", flash[i]);
> 			break;
> 		}
> 
> 		/* Short delay */
> 		for (i = 0; i < 3500; i++);
> 	}
> 
> 	/* Read array */
> 	flash[0] = 0x00ff00ff;
> 
> 	/* Show the first 10 failed words */
> 	for (i = 0; i < 0x10000; i++) {
> 		if (flash[i] != 0xffffffff) {
> 			printf("%08x\n", flash[i]);
> 			if (--words == 0)
> 				break;
> 		}
> 	}
> 
> 	printf("%d suspends\n", suspends);
> }

  parent reply	other threads:[~2008-04-19  9:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 20:38 cfi_cmdset_0001.c: Excessive erase suspends Anders Grafström
2008-04-18 15:02 ` Alexey Korolev
2008-04-18 16:35   ` Jamie Lokier
2008-04-18 17:54     ` Jared Hulbert
2008-04-18 22:11       ` Anders Grafström
2008-04-19  2:47         ` Jared Hulbert
2008-04-19  9:18         ` Joakim Tjernlund [this message]
2008-04-19 13:47           ` Anders Grafström
2008-04-19 17:01             ` Joakim Tjernlund
2008-04-24 14:34             ` Alexey Korolev
2008-04-24 21:02               ` Anders Grafström
2008-04-25  9:59                 ` Alexey Korolev

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='012501c8a1fe$4a5308e0$def91aa0$@Tjernlund@transmode.se' \
    --to=joakim.tjernlund@transmode.se \
    --cc=akorolev@infradead.org \
    --cc=grfstrm@users.sourceforge.net \
    --cc=jaredeh@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox