Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mehmet Fide <mehmet.fide@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/2] mtd: rawnand: vf610_nfc: fix reads on chips with more than 64 bytes of OOB
Date: Thu, 27 Aug 2026 22:12:57 +0200	[thread overview]
Message-ID: <20260827201257.3647133-1-mehmet.fide@gmail.com> (raw)
In-Reply-To: <87mruail2c.fsf@bootlin.com>

Hi Miquel,

On 25/08/2026 at 11:52, Miquel Raynal wrote:

> It fixes the problem, but honestly modifying the memorg is not
> correct. Broadcom and mpc5121 controller drivers do it, but that's
> likely wrong.
>
> What you report here is a U-Boot issue. The chips has more than 64 OOB
> bytes, U-boot clamps that value, Linux does not. U-boot is wrong. But I
> guess it's now too late and you'll tell me many devices in the field
> already use this broken layout?

Yes, unfortunately. These modules have been shipping since around 2016
with U-Boot and pre-a7ab085d7c16 kernels, both writing the 64-byte
layout, so the bad block tables and every UBI byte on the devices in
the field sit at those offsets. Changing the on-flash layout now would
brick them on the next kernel update.

> In this case, maybe you should just change the layout, instead of
> forcing an obviously incorrect memory layout. In this driver the large
> page generic OOB layout (which puts the ECC bytes at the end) is used. I
> guess a better approach could be to make your own 64-byte clamped OOB
> layout for backward compatibility. You should drop the oobsize
> modification as well.

Agreed, that is cleaner. For v2 I will drop the memorg/oobsize
modification entirely and add driver-specific mtd_ooblayout_ops that
place the ECC bytes inside the first 64 OOB bytes, at the same offsets
as before, regardless of the chip's real OOB size. The controller
setup keeps transferring 64 spare bytes as it always has, so the
on-flash format stays compatible with U-Boot and the old kernels.

> There is at least one legitimate Sashiko warning on this patch, can you
> please also check it?

Yes - the dev_info() uses %d for the u32 oobsize; that message goes
away together with the clamp in v2. While checking the report I also
found two pre-existing issues it flagged: write_page() never copies
chip->oob_poi into the controller SRAM, and vf610_nfc_done() does not
reinit_completion() after a timeout. Both look real and independent of
this fix, so I would send them as separate patches on top.

Thanks,
Mehmet

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2026-08-27 20:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 11:42 [PATCH 0/2] mtd: rawnand: vf610_nfc: two fixes for chips with large OOB and for erased pages Mehmet Fide
2026-08-18 11:42 ` [PATCH 1/2] mtd: rawnand: vf610_nfc: fix reads on chips with more than 64 bytes of OOB Mehmet Fide
2026-08-25  9:52   ` Miquel Raynal
2026-08-27 20:12     ` Mehmet Fide [this message]
2026-08-18 11:42 ` [PATCH 2/2] mtd: rawnand: vf610_nfc: fix false bitflips on reads of erased pages Mehmet Fide

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=20260827201257.3647133-1-mehmet.fide@gmail.com \
    --to=mehmet.fide@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox