From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Weinberger Date: Tue, 2 Feb 2016 12:40:00 +0100 Subject: [U-Boot] [PATCH] mtd, ubi: set free_count to zero before walking through erase list In-Reply-To: <1454410475-29929-1-git-send-email-hs@denx.de> References: <1454410475-29929-1-git-send-email-hs@denx.de> Message-ID: <56B09590.2030308@nod.at> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 02.02.2016 um 11:54 schrieb Heiko Schocher: > Set free_count to zero before walking through ai->erase list > in wl_init(). > > As U-Boot has no workqueue/threads, it immediately calls > erase_worker(), which increase for each erased block > free_count. Without this patch, free_count gets after > this initialized to zero in wl_init(), so the free_count > variable always has the maybe wrong value 0. > > Detected this behaviour on the dxr2 board, where the > UBI fastmap gets not written when attaching/dettaching > on an empty NAND. It drops instead the error message: > > could not find any anchor PEB > > With this patch, fastmap gets written on dettach. > > Signed-off-by: Heiko Schocher > --- > added Richard to this EMail, as maybe this could be a problem > in linux too ... ? ubi_wl_init() is called by ubi_attach(). So, as soon your UBI image is attached the WL subsystem is fully initialized and ready to use. If you try to use it before you're in undefined state. u-boot must not run the erase_worker() before the attach phase is done. Do you have more details what exactly happened? This needs a deeper investigation. Thanks, //richard