From: Boris Brezillon <boris.brezillon@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] mtd: nand: Don't abort erase operation when a bad block is detected
Date: Mon, 6 Aug 2018 22:06:13 +0200 [thread overview]
Message-ID: <20180806220613.7d134ea5@bbrezillon> (raw)
In-Reply-To: <20180806151253.31205-2-sr@denx.de>
Hi Stefan,
On Mon, 6 Aug 2018 17:12:51 +0200
Stefan Roese <sr@denx.de> wrote:
> It was noticed, that the erase command (mtd erase spi-nand0) aborts upon
> the first bad block. With this change, bad blocks are now skipped and
> the erase operation will continue.
>
That's not what the raw NAND framework does [1], and I'm almost sure
MTD users expect erase ops to stop when a bad block is found and "skip
bad block" was not explicitly requested.
I'd suggest moving to an approach where cmd/mtd.c erases blocks one by
one and checks the status of each block (with mtd_block_isbad()) before
calling mtd_erase(). Alternatively, we could add a 'bool skipbad' field
to struct erase_info, but that means getting away from Linux
implementation (which is already the case since uboot has an extra
"int scrub" field).
Regards,
Boris
[1]https://elixir.bootlin.com/u-boot/v2018.09-rc1/source/drivers/mtd/nand/nand_base.c#L2911
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Cc: Jagan Teki <jagan@openedev.com>
> ---
> drivers/mtd/nand/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
> index 0b793695cc..888f765b90 100644
> --- a/drivers/mtd/nand/core.c
> +++ b/drivers/mtd/nand/core.c
> @@ -162,7 +162,7 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo)
> nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last);
> while (nanddev_pos_cmp(&pos, &last) <= 0) {
> ret = nanddev_erase(nand, &pos);
> - if (ret) {
> + if (ret && ret != -EIO) {
> einfo->fail_addr = nanddev_pos_to_offs(nand, &pos);
>
> return ret;
next prev parent reply other threads:[~2018-08-06 20:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-06 15:12 [U-Boot] [PATCH 1/4] spi: spi-mem: Add optional half-duplex SPI transfer mode Stefan Roese
2018-08-06 15:12 ` [U-Boot] [PATCH 2/4] mtd: nand: Don't abort erase operation when a bad block is detected Stefan Roese
2018-08-06 20:06 ` Boris Brezillon [this message]
2018-08-07 5:25 ` Stefan Roese
2018-08-06 15:12 ` [U-Boot] [PATCH 3/4] cmd: mtd: Don't use with negative return codes for shell commands Stefan Roese
2018-08-06 20:38 ` Boris Brezillon
2018-08-07 5:07 ` Stefan Roese
2018-08-06 15:12 ` [U-Boot] [PATCH 4/4] cmd: mtd: Add info text to mtd erase subcommand Stefan Roese
2018-08-06 20:41 ` Boris Brezillon
2018-08-07 5:08 ` Stefan Roese
2018-08-06 19:53 ` [U-Boot] [PATCH 1/4] spi: spi-mem: Add optional half-duplex SPI transfer mode Boris Brezillon
2018-08-07 5:06 ` Stefan Roese
2018-08-07 5:53 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180806220613.7d134ea5@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox