PATCH: solving a hang while waiting in FL_STATUS

Anders Grafström grfstrm at users.sourceforge.net
Wed Apr 23 14:57:25 EDT 2008


Abel Bernabeu wrote:
> Image you have a broken sector which will never respond... that could
> hang the process while unlocking the sectors of a partition. In my
> case the problem prevents our board to complete the kernel start-up.

I have seen a case with a faulty Intel 28F128J3 that had a sector that
wouldn't erase. What happened was that the device kept trying to erase
the sector until the max specified erase time had passed then it set
the ready and error bits. The max erase time in this case was 25 seconds.
(early chip revision suffering from errata #2, I believe)
inval_cache_and_wait_for_operation() timed out already after 8 seconds
and set chip->state to FL_STATUS. It thus lost the actual state of the chip.
All operations within the next 17 seconds failed. The unit was impossble
to boot since it just kept panicing.

The error message I saw at that time (2.6.18) was
"Waiting for chip to be ready timed out. Status xxxx"
then JFFS2 got very unhappy.

A patched kernel with proper timeouts later booted this unit with just a
warning message about the bad sector. I'll post the patch shortly.

I've added this patch below as a safeguard. (Any thoughts on it?)
You could try it and see if it gets you out of the loop.

Anders

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index e812df6..e8a880c 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -706,6 +706,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long

  	case FL_STATUS:
  		for (;;) {
+			map_write(map, CMD(0x70), adr);
  			status = map_read(map, adr);
  			if (map_word_andequal(map, status, status_OK, status_OK))
  				break;



More information about the linux-mtd mailing list