[PATCH] mtd: nand: omap: save Bad-Block-Table (BBT) on device

Gupta, Pekon pekon at ti.com
Wed Jul 23 09:26:19 PDT 2014


Hi Ezequiel,

>From: Ezequiel Garcia [mailto:ezequiel at vanguardiasur.com.ar]
>>On 23 Jul 05:24 PM, Pekon Gupta wrote:
>> This patch makes OMAP NAND driver to
>> - save Bad-Block-Table (BBT) on NAND Flash device
>> - scan on device BBT during probe
>>
>
>Doesn't this break backward compatibility? Please correct me if I'm wrong
>here, but if I apply this patch, and boot with my current NAND flash
>contents, the kernel won't have any place to store the BBT (assuming
>there are no blocks reserved).

Good point. I'll rather like your opinion to judge my below understanding
as you were recently involved in some NAND BBT features additions..

When bbt_options "NAND_BBT_USE_FLASH" is enabled, default BBT
options will be used which are:

$KERNEL/drivers/mtd/nand_bbt.c
static struct nand_bbt_descr bbt_main_descr = {
	.options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
		| NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,

As default options have NAND_BBT_CREATE and NAND_BBT_WRITE,
so kernel will try to reserve erase-blocks for main-BBT and mirror-BBT
towards end of NAND device.

- Case-1: If there is un-allocated space (not allocated to any partition)
  at end of Flash device then it will be used. And there is no problem.

- Case-2: If there is no free space towards the end of flash, then ...
As per my understanding, the create_bbt() would try scanning whole
NAND to find empty blocks and then it creates BBT wherever it finds
empty blocks. And those blocks are marked as BAD with BBT signature
to prevent getting erased or over-written by any user-data.

Is my understanding correct?
If yes, then this will not break backward compatibility, as on upgrading
the kernel new BBT will be automatically written on first boot. And
it will be used in subsequent boots.
Need feedbacks ...

with regards, pekon



More information about the linux-mtd mailing list