[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250820122100.726451-1-mikhail.kshevetskiy@iopsys.eu>
Date: Wed, 20 Aug 2025 15:20:57 +0300
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
To: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Tudor Ambarus <tudor.ambarus@...aro.org>,
Takahiro Kuwano <Takahiro.Kuwano@...ineon.com>,
Martin Kurbanov <mmkurbanov@...utedevices.com>,
Cheng Ming Lin <chengminglin@...c.com.tw>,
linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Frieder Schrempf <frieder.schrempf@...tron.de>,
Mark Brown <broonie@...nel.org>
Cc: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
Subject: [PATCH v3 0/3] mtd: spinand: fix continuous reading mode support
Continuous reading mode is broken for some spi controllers. There are two
possible bug scenarios:
1) "continuous mode" flash and spi controller without dirmap support,
but with restriction on transfer length in adjust_op_size()
2) "continuous mode" flash and spi controller with dirmap support for a
single flash page
In the first case, any read that exceeds the limit specified in adjust_op_size()
will result in an EIO error. The limit may even be less than a size of a single
flash page. In this case, any read will result in an error.
In the second case, any read larger than flash page size will result in an EIO
error or spinand driver spoofing (because the spi controller driver returns
more bytes than were actually read).
This patch series tries to fix continuous reading (spinand driver side).
Unfortunately these fixes can't resolve "spinand driver spoofing" case.
Spi controller drivers might need fixes as well.
Changes v2:
* added helper to create reading dirmap descriptor
* fix spelling
* error code is not used for regular reading fallback anymore
* it's possible (but very unlucky) that someone will do raw reading
of the flash in continuous mode (i.e. without OOB), so fix dirmap
creation for that case as well.
Changes v3:
* improve description
* move airoha spi controller driver fix to a separate airoha spi fix series
Mikhail Kshevetskiy (3):
mtd: spinand: fix direct mapping creation sizes.
mtd: spinand: try a regular dirmap if creating a dirmap for continuous
reading fails
mtd: spinand: repeat reading in regular mode if continuous reading
fails
drivers/mtd/nand/spi/core.c | 88 ++++++++++++++++++++++++++++---------
1 file changed, 68 insertions(+), 20 deletions(-)
--
2.50.1
Powered by blists - more mailing lists