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.

AM623: about gpmc nand flash driver

Part Number: AM623

Tool/software:

Hi TI experts

from the gpmc nand driver file : drivers/mtd/nand/raw/omap2.c ,  I found that if not use NAND_BBT_USE_FLASH, will skip BBT scan. please tell me the reason.    

If we not  use NAND_BBT_USE_FLASH, also not set NAND_SKIP_BBTSCAN.  so will  storage BBT in the RAM.  Will it be have some issues in TI platform ? 

omap_nand_attach_chip--->

    {     if (chip->bbt_options & NAND_BBT_USE_FLASH)
              chip->bbt_options |= NAND_BBT_NO_OOB;
         else
          chip->options |= NAND_SKIP_BBTSCAN;

}

we use  TI linux SDK  version :  10.00.07.04

thanks very much

  • Hi Bert,

    The kernel driver: drivers/mtd/nand/raw/nand_bbt.c has an explanation of the BBT management in the beginning of the file.

  • Hi Bin

      I know the  BBT management method,   but we don’t want to create  a flash based BBT, only want to create a memory BBT. 

     but from the TI GPMC nand driver code omap2.c.  if not set  NAND_BBT_USE_FLASH flag, will set NAND_SKIP_BBTSCAN .  so  If not  to create a flash based BBT,  also not to create a memory BBT.      please help check the reason.  

  • Hi Bert,

    Now I understood your question. Let me know look into it and get back to you.

  • Hi Bert,

    I traced back the kernel driver drivers/mtd/nand/raw/omap2.c, it always has the flag NAND_SKIP_BBTSCAN set, since the very first version of the driver integrated in kernel back in 2009. So this driver never used the BBT logic. The MTD driver directly uses the OOB to manage bad blocks.

  • HI Bin

      do you think it have any issues  If I  delete the NAND_SKIP_BBTSCAN  flag ?

  • Hi Bert,

    I don't know, the omap2 nand driver never used BBT logic, it is not validated.

  • Hi Bin 

    It seems ok when delete NAND_SKIP_BBTSCAN flag. the system can boot ok and application can work normally.  

     Do you know what test cases I can do to ensure reliability base on your experience ?

  • Hi Bert,

    It has not been validated, so I won't be able to tell its reliability.

    Why do you want to remove this flag to use in-memory BBT management?

  • hi Bin

       The root cause is TI uboot and TI linux  default  flash based BBT   is not same .

    As said before,  in linux drivers/mtd/nand/raw/omap2.c,  if set NAND_BBT_USE_FLASH, will also set NAND_BBT_NO_OOB . but in uboot code  drivers/mtd/nand/raw/omap_gpmc.c not set it .  so in order to keep the same BBT between uboot and linux, We should change code in linux or uboot.  

    please check

  • Hi Bert,

    As said before,  in linux drivers/mtd/nand/raw/omap2.c,  if set NAND_BBT_USE_FLASH, will also set NAND_BBT_NO_OOB .

    NAND_BBT_USE_FLASH in kernel is never set in omap2.c,

      2244         if (info->flash_bbt)                                                    
         1                 nand_chip->bbt_options |= NAND_BBT_USE_FLASH;

    since info->flash_bbt flag is never set.

    So the behavior in kernel driver is the same as that in U-Boot. Did I miss anything?

  • Hi Bin

    omap_nand_attach_chip--->

        {     if (chip->bbt_options & NAND_BBT_USE_FLASH)
                  chip->bbt_options |= NAND_BBT_NO_OOB;
             else
              chip->options |= NAND_SKIP_BBTSCAN;

    }

    above code in linux drivers/mtd/nand/raw/omap2.c done what I said : if set NAND_BBT_USE_FLASH, will also set NAND_BBT_NO_OOB .

    uboot and linux both set NAND_BBT_USE_FLASH flag through device tree  nand-on-flash-bbt property

    if (of_property_read_bool(dn, "nand-on-flash-bbt"))
    chip->bbt_options |= NAND_BBT_USE_FLASH;

  • Hi Bert,

    Now I understand your concerns. I am checking on this internally and will get back to you once I have update.

  • Hi Bert,

    Since "nand-on-flash-bbt" DT properly has never been enabled in the SDK, it is not validated, I don't get a certain answer from internal discussion about its impact.

    But by reviewing the code, since U-Boot and kernel uses the NAND_BBT_NO_OOB flag differently, there is a potential problem that the OOB could be corrupted if "nand-on-flash-bbt" was set in both U-Boot and kernel devicetree.