[PATCH 2/2] mtd: spi-nor: Always use biggest erase size

Alexander Sverdlin alexander.sverdlin at nokia.com
Mon Jan 13 07:34:32 PST 2020

Hello Tudor,

On 01/03/2019 10:50, Alexander Sverdlin wrote:
>>> Optimize erase time by always using biggest erase size for given erase
>>> request. Do it by removing "sector"-at-a-time erase code.
>>> spi_nor_erase_multi_sectors() seems to be mature enough to handle all
>>> the cases better.
>> Did you check if the upper mtd layers are affected by this change?
> For now I just change static function, I didn't want to remote
> spi_nor_has_uniform_erase() infrastructure in the first step.
> So I personally see no problems with my patch. It's also quite well
> tested up to now.
>>> For the above to work backwards-compatible regarding 4-bytes commands
>>> spi_nor_set_4byte_opcodes() has to prepare them always, independent of
>>> spi_nor_has_uniform_erase() flag.
>>> Remainder check in spi_nor_erase() becomes superfluous because
>>> spi_nor_erase_multi_sectors() performs it anyway.
>>> The trigger for this change was n25q128a13: enabling SECT_4K increased
>>> erase time of 128k block from 1.763s to 11.335s.
>> When needed, one can disable the 4K sectors with the MTD_SPI_NOR_USE_4K_SECTORS
>> kconfig option. Does this help you?
> This very same kernel runs on different boards with different flashes.
> Seems that more modern flashes are not so slow when 4K sectors are used.
> Moreover, I truly believe this was a dead code and want to be convinced
> otherwise before real problems start :)

in the past 10 months I didn't encounter any problems with this patch.
Could you take another look on it?

Best regards,
Alexander Sverdlin.

More information about the linux-mtd mailing list