This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Omap-L138 Nand flash and UBIFS

Other Parts Discussed in Thread: OMAP-L138

Hello,

LogicPD EVM board for OMAP-L138 (Da850EVM) comes with a 512 MiBytes NAND flash.

It is a Micron MT29F4G08 device.

All the UBI tools handle the concepts of Erase Blocks (Physical an Logical), pages and sub-pages.

UBI needs two headers for each Physical Erase Block each needing a sub-page.

Usually on NAND devices page size is 2048 bytes and sub-page size is 512 bytes.

So, UBI headers need only one page. So we get :

Phgysical Erase Block size is 128 K

Logical Erase Block size is 126 K (ie 128K minus one page for headers - a page is the minimal I/O size).

I can't find trace of sub-page concept in the Micron documentation for this device.

So I conclude that page size is 2048 and sub-page size is 2048.

So headers that shall be independant needs 2 pages.

And Logical Erase Block size should be 124 KiBytes, 128 K minus 2 pages of 2K.

Unfortunately there is no way to force this value in the UBI tools.

the -s option in ubinize is without effect. At the end there is a mention of 512 bytes sub pages even with -s 2048.

And when you want to create empty UBI volumes there is no option to force the sub page size to 2048.

The ubimkvol  works but tells that Logical Erase Block size is 126 KiB.

I swear that further wear levelling or bad blocks management will not work.

 

Can somebody gives an explanation ?

Thank you

 

Gilbert Brisset.

  • Gilbert,

    Sub-page is more of a logical concept. Its really based on the number of bytes used by the NAND flash controller for calculating ECC. Typically 512 bytes is the limit. So, here the sub-page size is 512 bytes. You can disable the subpage in the driver by applying the following modifications. This is more of a hack. 

    diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
    index a796dd7..44ef833 100644
    --- a/drivers/mtd/nand/nand_base.c
    +++ b/drivers/mtd/nand/nand_base.c
    @@ -3410,6 +3410,7 @@ int nand_scan_tail(struct mtd_info *mtd)
    break;
    }
    }
    + mtd->subpage_sft = 0;
    chip->subpagesize = mtd->writesize >> mtd->subpage_sft;

  • Hello,

    As I guessed it, there were troubles around the sub page mismatch with the Micron MT29F4G08 NAND flash.

    I had try to set the -s option of ubiformat to 512, 2048 or nothing (default), every times the results printed said that the sub page is set to 512.

    Then you can run ubiattch and mount correctly the first time.

    But after a power down / up, running ubiattach leads to ECC mistakes and an infinite block torture test loop.

    Renjith, your hack corrects that, and I can use the ubitools with no longer error.

    But I still think that there is at least a bug in ubiformat and maybe in the MTD driver.

     

    Thank you again for the hack.

    Best regards.

    Gilbert Brisset.