]> git.itanic.dy.fi Git - linux-stable/commit
mtd: spi-nor: push 4k SE handling into spi_nor_select_uniform_erase()
authorMichael Walle <mwalle@kernel.org>
Fri, 8 Sep 2023 10:16:27 +0000 (12:16 +0200)
committerTudor Ambarus <tudor.ambarus@linaro.org>
Tue, 19 Sep 2023 15:50:01 +0000 (18:50 +0300)
commit9b6bb07eadaf2a98a86b6bc1ab4410c72d6ba572
tree615c5d9f9932a2ca26af1d7368760125c56b34c2
parente255a79162b6fbf3c62f2883ef9ecd66feb10fb6
mtd: spi-nor: push 4k SE handling into spi_nor_select_uniform_erase()

4k sector erase sizes are only a thing with uniform erase types. Push
the "we want 4k erase sizes" handling into spi_nor_select_uniform_erase().

One might wonder why the former sector_size isn't used anymore. It is
because we either search for the largest erase size or if selected
through kconfig, the 4k erase size. Now, why is that correct? For this,
we have to differentiate between (1) flashes with SFDP and (2) without
SFDP. For (1), we just set one (or two if SECT_4K is set) erase types
and wanted_size is exactly one of these.

For (2) things are a bit more complicated. For flashes which we don't
have in our flash_info database, the generic driver is used and
sector_size was already 0, which in turn selected the largest erase
size. For flashes which had SFDP and an entry in flash_info, sector_size
was always the largest sector and thus the largest erase type.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Link: https://lore.kernel.org/r/20230807-mtd-flash-info-db-rework-v3-9-e60548861b10@kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
drivers/mtd/spi-nor/core.c