Commit f656b419 authored by Tudor Ambarus's avatar Tudor Ambarus

mtd: spi-nor: Fix mtd size for s3an flashes

As it was before the blamed commit, s3an_nor_scan() was called
after mtd size was set with params->size, and it overwrote the mtd
size value with '8 * nor->page_size * nor->info->n_sectors' when
XSR_PAGESIZE was set. With the introduction of
s3an_post_sfdp_fixups(), we missed to update the mtd size for the
s3an flashes. Fix the mtd size by updating both nor->params->size,
(which will update the mtd_info size later on) and nor->mtd.size
(which is used in spi_nor_set_addr_width()).

Fixes: 641edddb ("mtd: spi-nor: Add s3an_post_sfdp_fixups()")
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: default avatarPratyush Yadav <p.yadav@ti.com>
Link: https://lore.kernel.org/r/20211207140254.87681-2-tudor.ambarus@microchip.com
parent 228e8045
...@@ -69,7 +69,8 @@ static int xilinx_nor_setup(struct spi_nor *nor, ...@@ -69,7 +69,8 @@ static int xilinx_nor_setup(struct spi_nor *nor,
page_size = (nor->params->page_size == 264) ? 256 : 512; page_size = (nor->params->page_size == 264) ? 256 : 512;
nor->params->page_size = page_size; nor->params->page_size = page_size;
nor->mtd.writebufsize = page_size; nor->mtd.writebufsize = page_size;
nor->mtd.size = 8 * page_size * nor->info->n_sectors; nor->params->size = 8 * page_size * nor->info->n_sectors;
nor->mtd.size = nor->params->size;
nor->mtd.erasesize = 8 * page_size; nor->mtd.erasesize = 8 * page_size;
} else { } else {
/* Flash in Default addressing mode */ /* Flash in Default addressing mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment