diff options
author | Michael Walle <mwalle@kernel.org> | 2023-09-08 13:16:28 +0300 |
---|---|---|
committer | Tudor Ambarus <tudor.ambarus@linaro.org> | 2023-09-19 18:56:29 +0300 |
commit | 6dec24b1a34c0ba7b09a400b4dfdbf63318f60c0 (patch) | |
tree | 9adb4e954297c1b34eca1bea7c03f2381c935d9c /drivers/mtd/spi-nor/swp.c | |
parent | 9b6bb07eadaf2a98a86b6bc1ab4410c72d6ba572 (diff) | |
download | linux-6dec24b1a34c0ba7b09a400b4dfdbf63318f60c0.tar.xz |
mtd: spi-nor: make sector_size optional
Most of the (old, non-SFDP) flashes use a sector size of 64k. Make that
a default value so it can be optional in the flash_info database.
As a preparation for conversion to the new database format, set the
sector size to zero if the default value is used. This way, the actual
change is happening with this patch ant not with a later conversion
patch.
Signed-off-by: Michael Walle <mwalle@kernel.org>
Link: https://lore.kernel.org/r/20230807-mtd-flash-info-db-rework-v3-10-e60548861b10@kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Diffstat (limited to 'drivers/mtd/spi-nor/swp.c')
-rw-r--r-- | drivers/mtd/spi-nor/swp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c index 40bf52867095..585813310ee1 100644 --- a/drivers/mtd/spi-nor/swp.c +++ b/drivers/mtd/spi-nor/swp.c @@ -34,7 +34,11 @@ static u8 spi_nor_get_sr_tb_mask(struct spi_nor *nor) static u64 spi_nor_get_min_prot_length_sr(struct spi_nor *nor) { unsigned int bp_slots, bp_slots_needed; - unsigned int sector_size = nor->info->sector_size; + /* + * sector_size will eventually be replaced with the max erase size of + * the flash. For now, we need to have that ugly default. + */ + unsigned int sector_size = nor->info->sector_size ?: SPI_NOR_DEFAULT_SECTOR_SIZE; u64 n_sectors = div_u64(nor->params->size, sector_size); u8 mask = spi_nor_get_sr_bp_mask(nor); |