On Fri, Sep 20, 2019 at 09:20:12AM +0200, Patrick Delaunay wrote: > This patch modify the loop in mtd erase command to erase one by one > the blocks in the requested area. > > It solves issue on "mtd erase" command on nand with existing bad block, > the command is interrupted on the first bad block with the trace: > "Skipping bad block at 0xffffffffffffffff" > > In MTD driver (nand/raw), when a bad block is present on the MTD > device, the erase_op.fail_addr is not updated and we have the initial > value MTD_FAIL_ADDR_UNKNOWN = (ULL)-1. > > This case seems normal in nand_base.c:nand_erase_nand(), > we have the 2 exit cases during the loop: > > 1/ we have a bad block (nand_block_checkbad) > instr->state = MTD_ERASE_FAILED > loop interrupted (goto erase_exit) > > 2/ if block erase failed (status & NAND_STATUS_FAIL) > instr->state = MTD_ERASE_FAILED; > instr->fail_addr = > ((loff_t)page << chip->page_shift); > loop interrupted (goto erase_exit) > > So erase_op.fail_addr can't be used if bad blocks were present > in the erased area; we need to use mtd_erase only one block to detect > and skip these existing bad blocks (as it is done in nand_util.c). > > Signed-off-by: Patrick Delaunay <patrick.delau...@st.com> > Reviewed-by: Miquel Raynal <miquel.ray...@bootlin.com>
Applied to u-boot/master, thanks! -- Tom
signature.asc
Description: PGP signature