From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
To: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: u-boot@lists.denx.de,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Stefan Roese <sr@denx.de>,
agnau@iopsys.eu
Subject: Re: [PATCH 2/7] mtd/nand: try to erase bad blocks only if scrub flag is provided
Date: Thu, 6 Oct 2022 19:17:26 +0300 [thread overview]
Message-ID: <20221006191726.49b94916@laska.lan> (raw)
In-Reply-To: <CAOf5uw=9fYU2TVYy+ek19G=CVcqt_mcby0XD6hF6YgmZb9U57Q@mail.gmail.com>
On Thu, 6 Oct 2022 18:03:17 +0200
Michael Nazzareno Trimarchi <michael@amarulasolutions.com> wrote:
> [External email]
>
>
>
>
>
> On Thu, Oct 6, 2022 at 5:52 PM Mikhail Kshevetskiy
> <mikhail.kshevetskiy@iopsys.eu> wrote:
> >
> > On Thu, 6 Oct 2022 08:56:08 +0200
> > Michael Nazzareno Trimarchi <michael@amarulasolutions.com> wrote:
> >
> > > [External email]
> > >
> > >
> > >
> > >
> > >
> > > Hi
> > >
> > > On Thu, Oct 6, 2022 at 5:15 AM <mikhail.kshevetskiy@iopsys.eu> wrote:
> > > >
> > > > From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
> > > >
> > > > 'mtd erase' command should not erase bad blocks. To force bad block
> > > > erasing there is 'mtd erase.dontskipbad' command (this command sets
> > > > 'scrub' flag to true in the erase_info structure). Unfortunately nand
> > > > layer ignore scrub flag and try to erases bad blocks unconditionally.
> > > > This is wrong.
> > > >
> > > > Add checks to allow bad block erasing only if scrub flag is set.
> > > >
> > > > Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
> > > > ---
> > > > drivers/mtd/nand/core.c | 5 ++++-
> > > > 1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
> > > > index 99c29670c7..a4fb7602c9 100644
> > > > --- a/drivers/mtd/nand/core.c
> > > > +++ b/drivers/mtd/nand/core.c
> > > > @@ -174,7 +174,10 @@ 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) {
> > > > schedule();
> > > > - ret = nanddev_erase(nand, &pos);
> > > > + if (!einfo->scrub && nanddev_isbad(nand, &pos))
> > >
> > > The nandev_erase already check it here:
> > >
> > > if (nanddev_isbad(nand, pos) || nanddev_isreserved(nand, pos)) {
> > >
> >
> > no it does not work. see nanddev_erase() code
> >
>
> Let me re-formulate it. What execution path are you taking into account?
>
> The nand are erased using the cmd/nand interface and the erase command
> there calls nand_erase_opts that take in account it.
spi-nand flash
cmd/mtd.c -> do_mtd_erase() -> .... -> nanddev_mtd_erase() -> nanddev_erase()
>
> Michael
>
>
>
> The nand is erased using the
> > if block is bad or reserverved, than warning is printed, than block is
> > erased.
> >
> >
> > > > + ret = -EIO;
> > > > + else
> > > > + ret = nanddev_erase(nand, &pos);
> > >
> > > erase opt should already take in account scrub.
> > >
> > > Please extend the problem
> > >
> > > Michael
> > > > if (ret) {
> > > > einfo->fail_addr = nanddev_pos_to_offs(nand,
> > > > &pos);
> > > >
> > > > --
> > > > 2.35.1
> > > >
> > >
> > >
> > > --
> > > Michael Nazzareno Trimarchi
> > > Co-Founder & Chief Executive Officer
> > > M. +39 347 913 2170
> > > michael@amarulasolutions.com
> > > __________________________________
> > >
> > > Amarula Solutions BV
> > > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> > > T. +31 (0)85 111 9172
> > > info@amarulasolutions.com
> > > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7C220e94cc3ad54f5ccca108daa7b44fe6%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638006690117535825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zTEEwU%2BKnLWNDq5xs77MmD6SI%2F31bRf3fEx%2Fyaa65%2FU%3D&reserved=0
>
>
>
> --
> Michael Nazzareno Trimarchi
> Co-Founder & Chief Executive Officer
> M. +39 347 913 2170
> michael@amarulasolutions.com
> __________________________________
>
> Amarula Solutions BV
> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> T. +31 (0)85 111 9172
> info@amarulasolutions.com
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7C220e94cc3ad54f5ccca108daa7b44fe6%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638006690117535825%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zTEEwU%2BKnLWNDq5xs77MmD6SI%2F31bRf3fEx%2Fyaa65%2FU%3D&reserved=0
next prev parent reply other threads:[~2022-10-06 22:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 3:14 [PATCH 1/7] mtd: replace name of 'rfree' field with 'free' in struct mtd_ooblayout_ops to better match it's description mikhail.kshevetskiy
2022-10-06 3:14 ` [PATCH 2/7] mtd/nand: try to erase bad blocks only if scrub flag is provided mikhail.kshevetskiy
2022-10-06 6:56 ` Michael Nazzareno Trimarchi
2022-10-06 15:52 ` Mikhail Kshevetskiy
2022-10-06 16:03 ` Michael Nazzareno Trimarchi
2022-10-06 16:17 ` Mikhail Kshevetskiy [this message]
2022-10-06 18:09 ` Michael Nazzareno Trimarchi
2022-10-10 13:32 ` Mikhail Kshevetskiy
2022-10-06 3:14 ` [PATCH 3/7] mtd/spinand: rework detect procedure for different READ_ID operation mikhail.kshevetskiy
2022-10-06 3:14 ` [PATCH 4/7] mtd/spinand: sync core spinand code with linux-5.10.118 mikhail.kshevetskiy
2022-10-06 3:15 ` [PATCH 5/7] mtd/spinand: sync supported devices with linux-5.15.43 mikhail.kshevetskiy
2022-10-06 3:15 ` [PATCH 6/7] mtd/spinand: add Winbond W25N02KV flash support, fix Winbond flashes identifications mikhail.kshevetskiy
2022-10-07 11:34 ` [PATCH 1/7] mtd: replace name of 'rfree' field with 'free' in struct mtd_ooblayout_ops to better match it's description Michael Nazzareno Trimarchi
2022-10-07 11:58 ` Fabio Estevam
2022-10-07 11:59 ` Michael Nazzareno Trimarchi
2022-10-07 14:01 ` Michael Nazzareno Trimarchi
2022-11-24 15:09 ` Frieder Schrempf
2022-12-05 16:11 ` Simon Glass
2022-12-05 16:15 ` Michael Nazzareno Trimarchi
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=20221006191726.49b94916@laska.lan \
--to=mikhail.kshevetskiy@iopsys.eu \
--cc=agnau@iopsys.eu \
--cc=dario.binacchi@amarulasolutions.com \
--cc=michael@amarulasolutions.com \
--cc=sr@denx.de \
--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