public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* NAND OOB data.
@ 2011-06-17 22:09 ANDY KENNEDY
  2011-06-20  9:25 ` THOMSON, Adam (Adam)
  2011-06-20 11:13 ` Atlant Schmidt
  0 siblings, 2 replies; 8+ messages in thread
From: ANDY KENNEDY @ 2011-06-17 22:09 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

I have overwritten my OOB data, to the point where all blocks are seen
as bad.  What do I do to recover from this?

Thanks,
Andy

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

* RE: NAND OOB data.
  2011-06-17 22:09 NAND OOB data ANDY KENNEDY
@ 2011-06-20  9:25 ` THOMSON, Adam (Adam)
  2011-06-20 11:13 ` Atlant Schmidt
  1 sibling, 0 replies; 8+ messages in thread
From: THOMSON, Adam (Adam) @ 2011-06-20  9:25 UTC (permalink / raw)
  To: ANDY KENNEDY, linux-mtd@lists.infradead.org

Andy Kennedy wrote:
> 
> I have overwritten my OOB data, to the point where all blocks 
> are seen as bad.  What do I do to recover from this?

If you're using u-boot then you can use the 'nand scrub' command which wipes all of the data from NAND, including OOB data. Only problem with that is you will lose any factory marked bad block markers, but sounds like in your current situation that isn't much of a concern for you. :o)

> 
> Thanks,
> Andy

Thanks

Adam

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

* RE: NAND OOB data.
  2011-06-17 22:09 NAND OOB data ANDY KENNEDY
  2011-06-20  9:25 ` THOMSON, Adam (Adam)
@ 2011-06-20 11:13 ` Atlant Schmidt
  2011-06-20 17:53   ` ANDY KENNEDY
  1 sibling, 1 reply; 8+ messages in thread
From: Atlant Schmidt @ 2011-06-20 11:13 UTC (permalink / raw)
  To: 'ANDY KENNEDY', linux-mtd@lists.infradead.org

Andy:

  If you don't have the old bad block information saved
  away somewhere (a bad block table, a scrap of paper,
  etc.), then you *CAN'T* completely recover from this
  situation; the original bad block data for that chip
  is probably irretrievably lost.*

  You can mark all the blocks as "good", of course, and
  then exercise the chip a bit, marking bad blocks as you
  go. You'll probably never achieve the same depth of
  testing that the factory was able to achieve using
  voltage, temperature, and timing margining, of course,
  but the results may be "good enough".

                          Atlant


* A few chip designs apparently blow fuses for the
  factory bad sectors and these blown fuses prevent
  you from ever writing the OOB bits to the state
  that would indicate a good block. For chips of
  these designs, you can fully recover the factory
  bad block data.


-----Original Message-----
From: linux-mtd-bounces@lists.infradead.org [mailto:linux-mtd-bounces@lists.infradead.org] On Behalf Of ANDY KENNEDY
Sent: Friday, June 17, 2011 18:09
To: linux-mtd@lists.infradead.org
Subject: NAND OOB data.

I have overwritten my OOB data, to the point where all blocks are seen
as bad.  What do I do to recover from this?

Thanks,
Andy

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.

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

* RE: NAND OOB data.
  2011-06-20 11:13 ` Atlant Schmidt
@ 2011-06-20 17:53   ` ANDY KENNEDY
  2011-06-20 18:17     ` Matthew L. Creech
                       ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: ANDY KENNEDY @ 2011-06-20 17:53 UTC (permalink / raw)
  To: Atlant Schmidt, linux-mtd@lists.infradead.org

> -----Original Message-----
> From: Atlant Schmidt [mailto:aschmidt@dekaresearch.com]
> Sent: Monday, June 20, 2011 6:14 AM
> To: ANDY KENNEDY; linux-mtd@lists.infradead.org
> Subject: RE: NAND OOB data.
> 
> Andy:
> 
>   If you don't have the old bad block information saved
>   away somewhere (a bad block table, a scrap of paper,
>   etc.), then you *CAN'T* completely recover from this
>   situation; the original bad block data for that chip
>   is probably irretrievably lost.*

All the other boards apparently are all good (is that normal?), but,
I'm not worried about the NAND having KNOWN bad blocks as this board
is supposed to be mine.

> 
>   You can mark all the blocks as "good", of course, and
>   then exercise the chip a bit, marking bad blocks as you
>   go. You'll probably never achieve the same depth of
>   testing that the factory was able to achieve using
>   voltage, temperature, and timing margining, of course,
>   but the results may be "good enough".
> 
>                           Atlant

Okay, so how do I (without the luxury of u-boot), in user or
kernel space, wipe the OOB data?  I'm looking at the code for
u-boot nand_erase_nand right now.  I mean, I'm not above writing
an userspace app that will do kernel level work for me.  I'm okay
with using /dev/mem and screwing with stuff.  Am I on the right
track?  I mean, I hate to go down this road if I'm just heading
for a dead-end.

Andy

> 
> 
> * A few chip designs apparently blow fuses for the
>   factory bad sectors and these blown fuses prevent
>   you from ever writing the OOB bits to the state
>   that would indicate a good block. For chips of
>   these designs, you can fully recover the factory
>   bad block data.
> 
> 
> -----Original Message-----
> From: linux-mtd-bounces@lists.infradead.org [mailto:linux-mtd-
> bounces@lists.infradead.org] On Behalf Of ANDY KENNEDY
> Sent: Friday, June 17, 2011 18:09
> To: linux-mtd@lists.infradead.org
> Subject: NAND OOB data.
> 
> I have overwritten my OOB data, to the point where all blocks are
> seen
> as bad.  What do I do to recover from this?
> 
> Thanks,
> Andy
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 
> This e-mail and the information, including any attachments, it
> contains are intended to be a confidential communication only to
> the person or entity to whom it is addressed and may contain
> information that is privileged. If the reader of this message is
> not the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in
> error, please immediately notify the sender and destroy the
> original message.
> 
> Thank you.
> 
> Please consider the environment before printing this email.

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

* Re: NAND OOB data.
  2011-06-20 17:53   ` ANDY KENNEDY
@ 2011-06-20 18:17     ` Matthew L. Creech
  2011-06-20 19:08     ` Atlant Schmidt
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Matthew L. Creech @ 2011-06-20 18:17 UTC (permalink / raw)
  To: ANDY KENNEDY; +Cc: linux-mtd@lists.infradead.org, Atlant Schmidt

On Mon, Jun 20, 2011 at 1:53 PM, ANDY KENNEDY <ANDY.KENNEDY@adtran.com> wrote:
>
> Okay, so how do I (without the luxury of u-boot), in user or
> kernel space, wipe the OOB data?  I'm looking at the code for
> u-boot nand_erase_nand right now.  I mean, I'm not above writing
> an userspace app that will do kernel level work for me.  I'm okay
> with using /dev/mem and screwing with stuff.  Am I on the right
> track?  I mean, I hate to go down this road if I'm just heading
> for a dead-end.
>

If you don't have U-Boot, it sounds like you need a Linux equivalent
to U-Boot's "nand scrub" command.  A quick search yields this:

http://patchwork.ozlabs.org/patch/65406/

Then I guess you'd need to set the corresponding flag in your
mtd-utils when doing flash_eraseall.

-- 
Matthew L. Creech

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

* RE: NAND OOB data.
  2011-06-20 17:53   ` ANDY KENNEDY
  2011-06-20 18:17     ` Matthew L. Creech
@ 2011-06-20 19:08     ` Atlant Schmidt
  2011-06-20 23:49     ` Brian Norris
  2011-06-23  8:52     ` Artem Bityutskiy
  3 siblings, 0 replies; 8+ messages in thread
From: Atlant Schmidt @ 2011-06-20 19:08 UTC (permalink / raw)
  To: 'ANDY KENNEDY', linux-mtd@lists.infradead.org

Andy:

> All the other boards apparently are all good
> (is that normal?),

  It happens; we're in the midst of switching from
  MLC to SLC flash and while I'd never expect that
  from our MLC parts, it seems to be pretty-commonly
  true for our SLC parts.


> Okay, so how do I (without the luxury of u-boot), in user or
> kernel space, wipe the OOB data?  I'm looking at the code for
> u-boot nand_erase_nand right now.  I mean, I'm not above writing
> an userspace app that will do kernel level work for me.  I'm okay
> with using /dev/mem and screwing with stuff.  Am I on the right
> track?  I mean, I hate to go down this road if I'm just heading
> for a dead-end.

  I think there's enough "stuff" available simply through
  /dev/mtd... to let you do any of this. I do a lot of
  Flash manipulation simply using Perl, mtdinfo, ubinfo
  and the /dev/mtd... and /dev/ubi... devices.

  (Unfortunately, I can't share any of that code.)

                               Atlant

-----Original Message-----
From: ANDY KENNEDY [mailto:ANDY.KENNEDY@adtran.com]
Sent: Monday, June 20, 2011 13:54
To: Atlant Schmidt; linux-mtd@lists.infradead.org
Subject: RE: NAND OOB data.

> -----Original Message-----
> From: Atlant Schmidt [mailto:aschmidt@dekaresearch.com]
> Sent: Monday, June 20, 2011 6:14 AM
> To: ANDY KENNEDY; linux-mtd@lists.infradead.org
> Subject: RE: NAND OOB data.
>
> Andy:
>
>   If you don't have the old bad block information saved
>   away somewhere (a bad block table, a scrap of paper,
>   etc.), then you *CAN'T* completely recover from this
>   situation; the original bad block data for that chip
>   is probably irretrievably lost.*

All the other boards apparently are all good (is that normal?), but,
I'm not worried about the NAND having KNOWN bad blocks as this board
is supposed to be mine.

>
>   You can mark all the blocks as "good", of course, and
>   then exercise the chip a bit, marking bad blocks as you
>   go. You'll probably never achieve the same depth of
>   testing that the factory was able to achieve using
>   voltage, temperature, and timing margining, of course,
>   but the results may be "good enough".
>
>                           Atlant

Okay, so how do I (without the luxury of u-boot), in user or
kernel space, wipe the OOB data?  I'm looking at the code for
u-boot nand_erase_nand right now.  I mean, I'm not above writing
an userspace app that will do kernel level work for me.  I'm okay
with using /dev/mem and screwing with stuff.  Am I on the right
track?  I mean, I hate to go down this road if I'm just heading
for a dead-end.

Andy


This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.

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

* Re: NAND OOB data.
  2011-06-20 17:53   ` ANDY KENNEDY
  2011-06-20 18:17     ` Matthew L. Creech
  2011-06-20 19:08     ` Atlant Schmidt
@ 2011-06-20 23:49     ` Brian Norris
  2011-06-23  8:52     ` Artem Bityutskiy
  3 siblings, 0 replies; 8+ messages in thread
From: Brian Norris @ 2011-06-20 23:49 UTC (permalink / raw)
  To: ANDY KENNEDY; +Cc: linux-mtd@lists.infradead.org, Atlant Schmidt

On Mon, Jun 20, 2011 at 10:53 AM, ANDY KENNEDY <ANDY.KENNEDY@adtran.com> wrote:
> Okay, so how do I (without the luxury of u-boot), in user or
> kernel space, wipe the OOB data?  I'm looking at the code for
> u-boot nand_erase_nand right now.  I mean, I'm not above writing
> an userspace app that will do kernel level work for me.  I'm okay
> with using /dev/mem and screwing with stuff.  Am I on the right
> track?  I mean, I hate to go down this road if I'm just heading
> for a dead-end.

Well, it's hack-ish, but the easiest way I've found is just to
(temporarily) remove this piece of code from nand_erase_nand():
                /*
                 * heck if we have a bad block, we do not erase bad blocks !
                 */
                if (nand_block_checkbad(mtd, ((loff_t) page) <<
                                        chip->page_shift, 0, allowbbt)) {
                        printk(KERN_WARNING "%s: attempt to erase a bad block "
                                        "at page 0x%08x\n", __func__, page);
                        instr->state = MTD_ERASE_FAILED;
                        goto erase_exit;
                }

Then you can trick the MTD layer into erasing your bad blocks. Be sure
to undo this code change after you've erased the chip!

Brian

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

* RE: NAND OOB data.
  2011-06-20 17:53   ` ANDY KENNEDY
                       ` (2 preceding siblings ...)
  2011-06-20 23:49     ` Brian Norris
@ 2011-06-23  8:52     ` Artem Bityutskiy
  3 siblings, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-23  8:52 UTC (permalink / raw)
  To: ANDY KENNEDY; +Cc: linux-mtd@lists.infradead.org, Atlant Schmidt

On Mon, 2011-06-20 at 17:53 +0000, ANDY KENNEDY wrote:
> > -----Original Message-----
> > From: Atlant Schmidt [mailto:aschmidt@dekaresearch.com]
> > Sent: Monday, June 20, 2011 6:14 AM
> > To: ANDY KENNEDY; linux-mtd@lists.infradead.org
> > Subject: RE: NAND OOB data.
> > 
> > Andy:
> > 
> >   If you don't have the old bad block information saved
> >   away somewhere (a bad block table, a scrap of paper,
> >   etc.), then you *CAN'T* completely recover from this
> >   situation; the original bad block data for that chip
> >   is probably irretrievably lost.*
> 
> All the other boards apparently are all good (is that normal?), but,
> I'm not worried about the NAND having KNOWN bad blocks as this board
> is supposed to be mine.

I think someone implemented an utility or ioctl for this, probably
Matthew Castet, but I asked for some more improvements or something, and
he disappeared. Try to find the thread, may be you can continue his
work.

But in general, I think the ideal way would be:

1. be able to distinguish between factory-marked and user-marked bad
blocks.
2. allow unmarking user-marked bad blocks, but not factory marked.

Not sure this is always possible, though.

-- 
Best Regards,
Artem Bityutskiy

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

end of thread, other threads:[~2011-06-23  8:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17 22:09 NAND OOB data ANDY KENNEDY
2011-06-20  9:25 ` THOMSON, Adam (Adam)
2011-06-20 11:13 ` Atlant Schmidt
2011-06-20 17:53   ` ANDY KENNEDY
2011-06-20 18:17     ` Matthew L. Creech
2011-06-20 19:08     ` Atlant Schmidt
2011-06-20 23:49     ` Brian Norris
2011-06-23  8:52     ` Artem Bityutskiy

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