]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: spinand: fix direct mapping creation sizes
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Tue, 30 Sep 2025 00:21:07 +0000 (03:21 +0300)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sun, 5 Oct 2025 18:26:33 +0000 (20:26 +0200)
Continuous mode is only supported for data reads, thus writing
requires only single flash page mapping.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/spi/core.c

index b3d53e234b775e1c80dc13a795dbd8d802d58850..69dbdd60a6a32d9c038d7a98234189d72217dbfc 100644 (file)
@@ -1118,18 +1118,13 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
                                 unsigned int plane)
 {
        struct nand_device *nand = spinand_to_nand(spinand);
-       struct spi_mem_dirmap_info info = {
-               .length = nanddev_page_size(nand) +
-                         nanddev_per_page_oobsize(nand),
-       };
+       struct spi_mem_dirmap_info info = { 0 };
        struct spi_mem_dirmap_desc *desc;
 
-       if (spinand->cont_read_possible)
-               info.length = nanddev_eraseblock_size(nand);
-
        /* The plane number is passed in MSB just above the column address */
        info.offset = plane << fls(nand->memorg.pagesize);
 
+       info.length = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
        info.op_tmpl = *spinand->op_templates.update_cache;
        desc = spi_mem_dirmap_create(spinand->slave, &info);
        if (IS_ERR(desc))
@@ -1137,6 +1132,8 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
 
        spinand->dirmaps[plane].wdesc = desc;
 
+       if (spinand->cont_read_possible)
+               info.length = nanddev_eraseblock_size(nand);
        info.op_tmpl = *spinand->op_templates.read_cache;
        desc = spi_mem_dirmap_create(spinand->slave, &info);
        if (IS_ERR(desc)) {