Skip to content

Commit e4a0cf9

Browse files
mkshevetskiymiquelraynal
authored andcommitted
mtd: spinand: fix direct mapping creation sizes
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: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent b8df622 commit e4a0cf9

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/mtd/nand/spi/core.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,18 +1097,13 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
10971097
unsigned int plane)
10981098
{
10991099
struct nand_device *nand = spinand_to_nand(spinand);
1100-
struct spi_mem_dirmap_info info = {
1101-
.length = nanddev_page_size(nand) +
1102-
nanddev_per_page_oobsize(nand),
1103-
};
1100+
struct spi_mem_dirmap_info info = { 0 };
11041101
struct spi_mem_dirmap_desc *desc;
11051102

1106-
if (spinand->cont_read_possible)
1107-
info.length = nanddev_eraseblock_size(nand);
1108-
11091103
/* The plane number is passed in MSB just above the column address */
11101104
info.offset = plane << fls(nand->memorg.pagesize);
11111105

1106+
info.length = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
11121107
info.op_tmpl = *spinand->op_templates.update_cache;
11131108
desc = devm_spi_mem_dirmap_create(&spinand->spimem->spi->dev,
11141109
spinand->spimem, &info);
@@ -1117,6 +1112,8 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
11171112

11181113
spinand->dirmaps[plane].wdesc = desc;
11191114

1115+
if (spinand->cont_read_possible)
1116+
info.length = nanddev_eraseblock_size(nand);
11201117
info.op_tmpl = *spinand->op_templates.read_cache;
11211118
desc = devm_spi_mem_dirmap_create(&spinand->spimem->spi->dev,
11221119
spinand->spimem, &info);
@@ -1132,6 +1129,7 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
11321129
return 0;
11331130
}
11341131

1132+
info.length = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
11351133
info.op_tmpl = *spinand->op_templates.update_cache;
11361134
info.op_tmpl.data.ecc = true;
11371135
desc = devm_spi_mem_dirmap_create(&spinand->spimem->spi->dev,
@@ -1141,6 +1139,8 @@ static int spinand_create_dirmap(struct spinand_device *spinand,
11411139

11421140
spinand->dirmaps[plane].wdesc_ecc = desc;
11431141

1142+
if (spinand->cont_read_possible)
1143+
info.length = nanddev_eraseblock_size(nand);
11441144
info.op_tmpl = *spinand->op_templates.read_cache;
11451145
info.op_tmpl.data.ecc = true;
11461146
desc = devm_spi_mem_dirmap_create(&spinand->spimem->spi->dev,

0 commit comments

Comments
 (0)