public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Daniel Palmer <daniel@0x0f.com>
Cc: richard@nod.at, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mtd: spinand: core: Properly fill the OOB area.
Date: Fri, 6 Aug 2021 22:02:42 +0200	[thread overview]
Message-ID: <20210806220242.4b83237d@xps13> (raw)
In-Reply-To: <20210617110842.2358461-1-daniel@0x0f.com>

Hi Daniel,

Daniel Palmer <daniel@0x0f.com> wrote on Thu, 17 Jun 2021 20:08:42
+0900:

> The comment in spinand_write_to_cache_op() says that
> spinand_ondie_ecc_prepare_io_req() should 0xff fill the OOB
> area but it doesn't.
> 
> This causes the OOB area to get filled with zeros
> and anytime the first page in a block the bad block marker
> is cleared and it becomes a bad block on the next boot.
> 
> This was observed on Longsys FORSEE branded parts and
> might be specific to these parts.
> 
> Signed-off-by: Daniel Palmer <daniel@0x0f.com>

This change looks fine, I'll use spinand->oobbuf instead of databuf +
offset (will update when applying).

> ---
>  drivers/mtd/nand/spi/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 6f2d39f9bb06..f1c76fa0e220 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -281,6 +281,9 @@ static int spinand_ondie_ecc_prepare_io_req(struct nand_device *nand,
>  	struct spinand_device *spinand = nand_to_spinand(nand);
>  	bool enable = (req->mode != MTD_OPS_RAW);
>  
> +	memset(spinand->databuf + nanddev_page_size(nand),
> +			0xff, nanddev_per_page_oobsize(nand));
> +
>  	/* Only enable or disable the engine */
>  	return spinand_ecc_enable(spinand, enable);
>  }

Thanks,
Miquèl

  reply	other threads:[~2021-08-06 20:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 11:08 [RFC PATCH] mtd: spinand: core: Properly fill the OOB area Daniel Palmer
2021-08-06 20:02 ` Miquel Raynal [this message]
2021-08-11  7:37   ` Daniel Palmer
2021-08-16  7:42     ` Miquel Raynal
2021-08-06 20:03 ` Miquel Raynal

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=20210806220242.4b83237d@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=daniel@0x0f.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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