]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: spinand: Drop a too strong limitation
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 29 Apr 2026 17:56:38 +0000 (19:56 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 4 May 2026 13:02:06 +0000 (15:02 +0200)
Since continuous reads may sometimes not be able to go past an erase
block boundary, it has been decided not to attempt longer reads and if
the user request is bigger, it will be split across eraseblocks.

As these request will anyway be handled correctly, there is no reason to
filter out cases where we would go over a target or a die, so drop this
limitation which had a side effect: any request to read more than the
content of an eraseblock would simply not benefit from the continuous
read feature.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/spi/core.c

index 8aa3753aaaa1d32ee953de2321e51015fd435090..43df7d558b7486d8f0dbd87e8b025cc46ebeacba 100644 (file)
@@ -878,6 +878,12 @@ static int spinand_mtd_continuous_page_read(struct mtd_info *mtd, loff_t from,
         * Each data read must be a multiple of 4-bytes and full pages should be read;
         * otherwise, the data output might get out of sequence from one read command
         * to another.
+        *
+        * Continuous reads never cross LUN boundaries. Some devices don't
+        * support crossing planes boundaries. Some devices don't even support
+        * crossing blocks boundaries. The common case being to read through UBI,
+        * we will very rarely read two consequent blocks or more, so let's only enable
+        * continuous reads when reading within the same erase block.
         */
        nanddev_io_for_each_block(nand, NAND_PAGE_READ, from, ops, &iter) {
                ret = spinand_select_target(spinand, iter.req.pos.target);
@@ -968,19 +974,6 @@ static bool spinand_use_cont_read(struct mtd_info *mtd, loff_t from,
        nanddev_offs_to_pos(nand, from, &start_pos);
        nanddev_offs_to_pos(nand, from + ops->len - 1, &end_pos);
 
-       /*
-        * Continuous reads never cross LUN boundaries. Some devices don't
-        * support crossing planes boundaries. Some devices don't even support
-        * crossing blocks boundaries. The common case being to read through UBI,
-        * we will very rarely read two consequent blocks or more, so it is safer
-        * and easier (can be improved) to only enable continuous reads when
-        * reading within the same erase block.
-        */
-       if (start_pos.target != end_pos.target ||
-           start_pos.plane != end_pos.plane ||
-           start_pos.eraseblock != end_pos.eraseblock)
-               return false;
-
        return start_pos.page < end_pos.page;
 }