[U-Boot] [PATCH] nand: force BBT scan for controllers which need it

Stefan Agner stefan at agner.ch
Tue Nov 15 19:43:06 CET 2016


On 2016-11-14 21:30, Scott Wood wrote:
> On Wed, 2016-10-26 at 17:18 -0700, Stefan Agner wrote:
>> From: Stefan Agner <stefan.agner at toradex.com>
>>
>> Commit 35c204d8a9d0 ("nand: reinstate lazy bad block scanning")
>> introduced lazy BBT scanning. However, some controller do parts
>> of the initialization (mxs_nand.c) during scan_bbt, hence for
>> those controllers the BBT must be scanned at initialization time.
>>
>> In most situation the U-Boot environment gets read first, and
>> the U-Boot environment code checks for bad blocks first. Checking
>> for bad blocks will ask for scan_bbt before reading the first page,
>> hence in most situation the issue does not appear in practice.
>> However, when there is no environment configured, other code might
>> access NAND first which does not explicitly checks for bad blocks,
>> in those cases ECC reads will fail always.
>>
>> Cc: Rostislav Lisovy <lisovy at gmail.com>
>> Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
>> ---
>> Not sure if this solution is a nice solution as we diverge more
>> and more from the kernel...
> 
> Why does this init code need to run at the end of nand_scan_tail()?  If it can
> run in between nand_scan_ident() and nand_scan_tail(), then use
> CONFIG_SYS_NAND_SELF_INIT to allow the driver to run its init at that time.

Hm, the comment in mxs_nand.c claims that we don't have formal mechanism
for this, but that has been written in 2011 and
CONFIG_SYS_NAND_SELF_INIT has been added in 2012, hence I guess we could
get rid of that hack.

Will check if your suggestion...

--
Stefan


More information about the U-Boot mailing list