[U-Boot] NAND bad block checking policy

Guilherme de Oliveira Costa guilherme.oliveira at autotrac.com.br
Thu Feb 18 12:23:06 CET 2016


Hello,

I'm using U-Boot 2013.01.01, and I've noticed an odd behaviour when the system is checking for bad blocks on my Micron NAND.


Let's say we have a NAND memory with the following features:

 Memory Size 128 MB

 Sector size 128 KiB

 Page size      2048 b

 OOB size         64 b

 Erase size   131072 b

If I try and mark a block as bad manually (via nand markbad), the following happens:

U-Boot at UCC3# nand markbad 0x4290000
block 0x04290000 successfully marked as bad
U-Boot at UCC3# nand bad

Device 0 bad blocks:
  04280000

Everything seems fine. However, after a reboot, the system loses the information. Sifting through the code, I found the it is only checking the first two pages OOB. Note however that the block that gets marked as bad is block 0x4280000, which is aligned in memory with the eraseblock size (1st page in the eraseblock). Also, if I dump the oob info from 0x428000, it is not flagged as bad, but  in 0x429000, the first byte is still 0x00, indicating it as bad.

If I mark the 1st or 2nd page in an erase block as bad, then the information persists through boot cycles. Also, I've verified that we are not using a NAND based bbt.

My main concern is that, because this checking shared between functionalities, everytime we erase a block, we keep losing bad block information, because inner pages (i.e. not the 1st or 2nd in an eraseblock), are flagged as good, which, in my point of view,  is a bad thing.

If this is indeed the intended behaviour, it seems to me that it is due to performance reasons. So, in this case, should we mark the whole eraseblock as bad (by writing 0x00 to the 1st or 2nd pages) if we find a single bad page in a block? Isn't this also a bad solution, since we will be marking 128kiB as bad due to a single page? Shouldn't this control be made at a finer level (i.e. page level)?
Regards,
Guilherme

Esta mensagem e qualquer anexo a ela s?o documentos confidenciais e direcionados exclusivamente ao(s) destinat?rio(s). Qualquer uso, desvio, sonega??o, supress?o, revela??o ou divulga??o n?o autorizada ? proibida e sujeita ?s san??es e/ou repara??es legais por ato il?cito (C?digo Penal, Artigos 151 e 152). Caso n?o seja um dos destinat?rios expressamente indicados, por favor entre em contato com o remetente, respondendo este e-mail e destrua quaisquer c?pias da mensagem original. Qualquer opini?o, cr?tica ou an?lise descrita nesta mensagem ? de responsabilidade ?nica do remetente, a menos quando estiver explicitamente expresso que seja da empresa remetente.

This message and any attachment are confidential information for the sole use of the intended recipients. Any unauthorized use, deviation, withholdment, suppression, disclosure or distribution is prohibited and is subjected to legal sanctions and/or compensations per illicit act (Penal Code, articles 151 and 152). If you are not one of the intended recipients, please contact the sender by reply e-mail and destroy any copy of the original message. Any view, comment or analysis expressed in this message is sole responsibility from the sender, except when it's specifically expressed that it's the view, comment or analysis of the company.



More information about the U-Boot mailing list