• Michael Walle's avatar
    mtd: spi-nor: push 4k SE handling into spi_nor_select_uniform_erase() · 9b6bb07e
    Michael Walle authored
    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: default avatarMichael Walle <mwalle@kernel.org>
    Link: https://lore.kernel.org/r/20230807-mtd-flash-info-db-rework-v3-9-e60548861b10@kernel.orgSigned-off-by: default avatarTudor Ambarus <tudor.ambarus@linaro.org>
    9b6bb07e
core.c 97.7 KB