From: Stefan Agner Date: Tue, 15 Nov 2016 10:43:06 -0800 Subject: [U-Boot] [PATCH] nand: force BBT scan for controllers which need it In-Reply-To: <1479187849.21746.25.camel@buserror.net> References: <20161027001844.11710-1-stefan@agner.ch> <1479187849.21746.25.camel@buserror.net> Message-ID: <6264239051da0bb558277ff624c0b943@agner.ch> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2016-11-14 21:30, Scott Wood wrote: > On Wed, 2016-10-26 at 17:18 -0700, Stefan Agner wrote: >> From: Stefan Agner >> >> 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 >> Signed-off-by: Stefan Agner >> --- >> 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