[U-Boot] NAND bad block table

Naveen Mamindlapalli naveen.mamindlapalli at xilinx.com
Mon Feb 10 10:05:15 EST 2014


Cc: linux-mtd-list

Hi Scott,

Yes, the searching of BBT happens from the end of flash when NAND_BBT_USE_FLASH option is used & NAND_BBT_ABSPAGE option is not used. The searching of BBT happens by scanning the last 4 blocks for BBT signature starting from end block. The number of blocks to scan from the end for BBT signature is defined by macro NAND_BBT_SCAN_MAXBLOCKS in "include/linux/mtd/bbm.h" which is currently set to value 4.

If the last 4 blocks are factory marked bad by the vendor, then the flash is not usable by u-boot or Linux. We can fix this issue by changing the macro value NAND_BBT_SCAN_MAXBLOCKS to a value greater than 4 (depending on the flash part) which doesn't seem to be a good solution since the change has to be done to the MTD layer default values.

It would be good if there is a device tree binding to specify the number of blocks to scan to check if BBT is present in the flash. Currently there is no such device tree option is available.

Thanks and Regards,
Naveen

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Thursday, February 06, 2014 12:46 AM
To: monstr at monstr.eu
Cc: u-boot at lists.denx.de; Michal Simek; Naveen Mamindlapalli
Subject: Re: [U-Boot] NAND bad block table

On Wed, 2014-02-05 at 15:16 +0100, Michal Simek wrote:
> On 02/04/2014 09:46 PM, Scott Wood wrote:
> > On Tue, 2014-02-04 at 13:43 +0100, Michal Simek wrote:
> >> Hi Scott and others,
> >>
> >> I have a question regarding BBT position and number of blocks
> >> allocated for BBT.
> >>
> >> Did you face the issue with last 4 blocks broken in any NAND flash
> >> device since the default option in Linux/u-boot BBM is last 4 blocks?
> >>
> >> It doesn't mean that if the last 4 blocks are broken than the NAND
> >> flash device is broken too.
> >> Also I haven't seen any common binding for Linux kernel to change it.
> >>
> >> Has someone tried to improve this algorithm or process of storing BBT in a better way.
> >> For example just look for BBT from the end till any limit?
> >
> > I don't recall if I've ever tested it personally, but that sort of
> > scanning is already there.  Have you seen a problem with it?
>
> We have met with nand device which has broken last 4 blocks and u-boot
> and linux just scan last 4 blocks by default.
>
> In connection to Linux. Interesting is that there is no binding for
> extending scan blocks and this has to be done through driver
> properties.

Could you be more specific about what sort of "driver property" you're talking about?  AFAICT from glancing at the code, searching is the default unless the controller driver specifies NAND_BBT_ABSPAGE.

In any case, this code comes straight from Linux, so you'll probably find people more familiar with this code on linux-mtd.

-Scott





This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.





More information about the linux-mtd mailing list