summaryrefslogtreecommitdiff
path: root/cmd/mtd.c
AgeCommit message (Collapse)Author
2020-01-24cmd: mtd: solve bad block support in erase commandPatrick Delaunay
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.delaunay@st.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2019-01-18cmd: mtd: fix compilation warning for help when SYS_LONGHELP=nQuentin Schulz
cmd/mtd.c:447:13: warning: ‘mtd_help_text’ defined but not used [-Wunused-variable] static char mtd_help_text[] = ^~~~~~~~~~~~~ When SYS_LONGHELP is not defined. After looking at how other commands work, we should surround the whole help text (even its declaration) with an #ifdef CONFIG_SYS_LONGHELP, since it's compiled out when calling _CMD_HELP[1] on the help text variable argument to U_BOOT_CMD. [1] https://elixir.bootlin.com/u-boot/latest/source/include/command.h#L181 Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2019-01-15cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commandsBoris Brezillon
It's way simpler this way, and we also gain auto-completion support for free (MTD name auto-completion has been added with mtd_name_complete()) Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-10-02cmd: mtd: add 'mtd' commandMiquel Raynal
There should not be a 'nand' command, a 'sf' command and certainly not a new 'spi-nand' command. Write a 'mtd' command instead to manage all MTD devices/partitions at once. This should be the preferred way to access any MTD device. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jagan Teki <jagan@openedev.com> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>