kernel: mtd: spinand: continuous mode fixes
authorMikhail Kshevetskiy <[email protected]>
Sat, 4 Oct 2025 06:17:33 +0000 (09:17 +0300)
committerRobert Marko <[email protected]>
Thu, 9 Oct 2025 14:37:25 +0000 (16:37 +0200)
commit32229a4bb7d2a8dd2c3a719c9f4e0e5fa08bbd33
tree21261440febcfe0bda18104759061c45950b1296
parent8a8bfcc7feec8974eaa23b43f98ef391a40b9a56
kernel: mtd: spinand: continuous mode fixes

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.

Signed-off-by: Mikhail Kshevetskiy <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20295
Signed-off-by: Robert Marko <[email protected]>
target/linux/airoha/patches-6.12/901-snand-mtk-bmt-support.patch
target/linux/generic/pending-6.12/405-01-mtd-spinand-fix-direct-mapping-creation-sizes.patch [new file with mode: 0644]
target/linux/generic/pending-6.12/405-02-mtd-spinand-try-a-regular-dirmap-if-creating-a-di.patch [new file with mode: 0644]
target/linux/generic/pending-6.12/405-03-mtd-spinand-repeat-reading-in-regular-mode-if-con.patch [new file with mode: 0644]
target/linux/generic/pending-6.12/487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch
target/linux/mediatek/patches-6.12/121-hack-spi-nand-1b-bbm.patch
target/linux/mediatek/patches-6.12/330-snand-mtk-bmt-support.patch
target/linux/mediatek/patches-6.12/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch
target/linux/mediatek/patches-6.12/435-drivers-mtd-spinand-Add-calibration-support-for-spin.patch
target/linux/mediatek/patches-6.12/436-drivers-mtd-spi-nor-Add-calibration-support-for-spi-.patch
target/linux/mediatek/patches-6.12/960-asus-hack-u-boot-ignore-mtdparts.patch