From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Cheng Ming Lin <linchengming884@gmail.com>
Cc: vigneshr@ti.com, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, richard@nod.at,
alvinzhou@mxic.com.tw, leoyu@mxic.com.tw,
Cheng Ming Lin <chengminglin@mxic.com.tw>
Subject: Re: [PATCH 2/2] mtd: spi-nand: Add read retry support
Date: Tue, 1 Oct 2024 12:17:24 +0200 [thread overview]
Message-ID: <20241001121724.5edbb64b@xps-13> (raw)
In-Reply-To: <20240905055333.2363358-3-linchengming884@gmail.com>
Hi Cheng Ming,
linchengming884@gmail.com wrote on Thu, 5 Sep 2024 13:53:33 +0800:
> From: Cheng Ming Lin <chengminglin@mxic.com.tw>
>
> When the host ECC fails to correct the data error of NAND device,
> there's a special read for data recovery method which host setups
> for the next read retry mode and may recover the lost data by host
> ECC again.
>
> Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
> ---
> drivers/mtd/nand/spi/core.c | 33 +++++++++++++++++++++++++++++++--
> 1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index e0b6715e5dfe..2f21ea926132 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -640,6 +640,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
> struct nand_io_iter iter;
> bool disable_ecc = false;
> bool ecc_failed = false;
> + u8 retry_mode = 0;
> int ret = 0;
>
> if (ops->mode == MTD_OPS_RAW || !spinand->eccinfo.ooblayout)
> @@ -657,20 +658,45 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
This will no longer apply with continuous support added in. However
please make this only in the non continuous path. I don't think it can
fly in the other.
> if (ret)
> break;
>
> +read_retry:
> ret = spinand_read_page(spinand, &iter.req);
> if (ret < 0 && ret != -EBADMSG)
> break;
>
> - if (ret == -EBADMSG)
> + if (ret == -EBADMSG && spinand->info->fixups) {
> + if (spinand->read_retries && ((retry_mode + 1) < spinand->read_retries)) {
++retry_mode?
> + retry_mode++;
So this can be dropped.
> + ret = spinand->info->fixups->setup_read_retry(spinand, retry_mode);
> + if (ret < 0)
> + break;
No, you need to set ecc_failed here.
> +
> + /* Reset ecc_stats; retry */
> + mtd->ecc_stats = old_stats;
> + goto read_retry;
> + } else {
> + /* No more retry modes; real failure */
> + ecc_failed = true;
> + }
> + } else if (ret == -EBADMSG) {
> ecc_failed = true;
> - else
> + } else {
> max_bitflips = max_t(unsigned int, max_bitflips, ret);
> + }
>
> ret = 0;
> ops->retlen += iter.req.datalen;
> ops->oobretlen += iter.req.ooblen;
> +
> + /* Reset to retry mode 0*/
> + if (retry_mode) {
retry_mode = 0;
> + ret = spinand->info->fixups->setup_read_retry(spinand, 0);
retry_mode);
> + if (ret < 0)
> + break;
this if clause is useless.
> + retry_mode = 0;
And then this can be dropped from here.
> + }
> }
>
> +
Spurious line
> if (ops->stats) {
> ops->stats->uncorrectable_errors +=
> mtd->ecc_stats.failed - old_stats.failed;
> @@ -1095,6 +1121,9 @@ int spinand_match_and_init(struct spinand_device *spinand,
> spinand->flags = table[i].flags;
> spinand->id.len = 1 + table[i].devid.len;
> spinand->select_target = table[i].select_target;
> + spinand->info = info;
> + if (spinand->info->fixups && spinand->info->fixups->init_read_retry)
> + spinand->read_retries = spinand->info->fixups->init_read_retry(spinand);
Now I get you init. Ok, fine.
>
> op = spinand_select_op_variant(spinand,
> info->op_variants.read_cache);
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Cheng Ming Lin <linchengming884@gmail.com>
Cc: vigneshr@ti.com, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, richard@nod.at,
alvinzhou@mxic.com.tw, leoyu@mxic.com.tw,
Cheng Ming Lin <chengminglin@mxic.com.tw>
Subject: Re: [PATCH 2/2] mtd: spi-nand: Add read retry support
Date: Tue, 1 Oct 2024 12:17:24 +0200 [thread overview]
Message-ID: <20241001121724.5edbb64b@xps-13> (raw)
In-Reply-To: <20240905055333.2363358-3-linchengming884@gmail.com>
Hi Cheng Ming,
linchengming884@gmail.com wrote on Thu, 5 Sep 2024 13:53:33 +0800:
> From: Cheng Ming Lin <chengminglin@mxic.com.tw>
>
> When the host ECC fails to correct the data error of NAND device,
> there's a special read for data recovery method which host setups
> for the next read retry mode and may recover the lost data by host
> ECC again.
>
> Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
> ---
> drivers/mtd/nand/spi/core.c | 33 +++++++++++++++++++++++++++++++--
> 1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index e0b6715e5dfe..2f21ea926132 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -640,6 +640,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
> struct nand_io_iter iter;
> bool disable_ecc = false;
> bool ecc_failed = false;
> + u8 retry_mode = 0;
> int ret = 0;
>
> if (ops->mode == MTD_OPS_RAW || !spinand->eccinfo.ooblayout)
> @@ -657,20 +658,45 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
This will no longer apply with continuous support added in. However
please make this only in the non continuous path. I don't think it can
fly in the other.
> if (ret)
> break;
>
> +read_retry:
> ret = spinand_read_page(spinand, &iter.req);
> if (ret < 0 && ret != -EBADMSG)
> break;
>
> - if (ret == -EBADMSG)
> + if (ret == -EBADMSG && spinand->info->fixups) {
> + if (spinand->read_retries && ((retry_mode + 1) < spinand->read_retries)) {
++retry_mode?
> + retry_mode++;
So this can be dropped.
> + ret = spinand->info->fixups->setup_read_retry(spinand, retry_mode);
> + if (ret < 0)
> + break;
No, you need to set ecc_failed here.
> +
> + /* Reset ecc_stats; retry */
> + mtd->ecc_stats = old_stats;
> + goto read_retry;
> + } else {
> + /* No more retry modes; real failure */
> + ecc_failed = true;
> + }
> + } else if (ret == -EBADMSG) {
> ecc_failed = true;
> - else
> + } else {
> max_bitflips = max_t(unsigned int, max_bitflips, ret);
> + }
>
> ret = 0;
> ops->retlen += iter.req.datalen;
> ops->oobretlen += iter.req.ooblen;
> +
> + /* Reset to retry mode 0*/
> + if (retry_mode) {
retry_mode = 0;
> + ret = spinand->info->fixups->setup_read_retry(spinand, 0);
retry_mode);
> + if (ret < 0)
> + break;
this if clause is useless.
> + retry_mode = 0;
And then this can be dropped from here.
> + }
> }
>
> +
Spurious line
> if (ops->stats) {
> ops->stats->uncorrectable_errors +=
> mtd->ecc_stats.failed - old_stats.failed;
> @@ -1095,6 +1121,9 @@ int spinand_match_and_init(struct spinand_device *spinand,
> spinand->flags = table[i].flags;
> spinand->id.len = 1 + table[i].devid.len;
> spinand->select_target = table[i].select_target;
> + spinand->info = info;
> + if (spinand->info->fixups && spinand->info->fixups->init_read_retry)
> + spinand->read_retries = spinand->info->fixups->init_read_retry(spinand);
Now I get you init. Ok, fine.
>
> op = spinand_select_op_variant(spinand,
> info->op_variants.read_cache);
Thanks,
Miquèl
next prev parent reply other threads:[~2024-10-01 10:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 5:53 [PATCH 0/2] mtd: spi-nand: Add support for read retry Cheng Ming Lin
2024-09-05 5:53 ` Cheng Ming Lin
2024-09-05 5:53 ` [PATCH 1/2] mtd: spi-nand: Add fixups " Cheng Ming Lin
2024-09-05 5:53 ` Cheng Ming Lin
2024-10-01 9:40 ` Miquel Raynal
2024-10-01 9:40 ` Miquel Raynal
2024-10-07 5:49 ` Cheng Ming Lin
2024-10-07 5:49 ` Cheng Ming Lin
2024-10-07 8:33 ` Miquel Raynal
2024-10-07 8:33 ` Miquel Raynal
2024-10-08 6:25 ` Cheng Ming Lin
2024-10-08 6:25 ` Cheng Ming Lin
2024-10-08 8:55 ` Miquel Raynal
2024-10-08 8:55 ` Miquel Raynal
2024-10-08 9:19 ` Cheng Ming Lin
2024-10-08 9:19 ` Cheng Ming Lin
2024-09-05 5:53 ` [PATCH 2/2] mtd: spi-nand: Add read retry support Cheng Ming Lin
2024-09-05 5:53 ` Cheng Ming Lin
2024-10-01 10:17 ` Miquel Raynal [this message]
2024-10-01 10:17 ` Miquel Raynal
2024-10-07 5:53 ` Cheng Ming Lin
2024-10-07 5:53 ` Cheng Ming Lin
-- strict thread matches above, loose matches on Subject: below --
2024-09-09 12:34 kernel test robot
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=20241001121724.5edbb64b@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=alvinzhou@mxic.com.tw \
--cc=chengminglin@mxic.com.tw \
--cc=leoyu@mxic.com.tw \
--cc=linchengming884@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.