[PATCH v2 2/6] mtd: spi-nor: add erase die (chip) capability

Tudor Ambarus tudor.ambarus at linaro.org
Wed Nov 1 09:04:42 PDT 2023


Hi, Fabio,

On 11/1/23 14:58, Tudor Ambarus wrote:
> JESD216 defines a chip as a die, one and the other are the same thing.
> JESD216 clarifies that the chip erase time defined in BFPT dword(11)
> applies separately to each die for multi-die devices in which the dice
> are individually accessed. Based on this, update the
> spi_nor_erase_chip() method to support multi-die devices.
> 
> For now, benefit of the die erase when addr and len are aligned with die
> size. This could be improved however for the uniform and non-uniform
> erases cases to use the die erase when possible. For example if one
> requests that an erase of a 2 die device starting from the last 64KB of
> the first die to the end of the flash size, we could use just 2
> commands, a 64KB erase and a die erase. This improvement is left as an
> exercise for the reader, as I don't have multi die flashes at hand.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus at linaro.org>
> ---
>  drivers/mtd/spi-nor/core.c    | 104 +++++++++++++++++++++++-----------
>  drivers/mtd/spi-nor/core.h    |   8 ++-
>  drivers/mtd/spi-nor/debugfs.c |   2 +-
>  3 files changed, 78 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 25a64c65717d..ac2651e76285 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1065,19 +1065,25 @@ static int spi_nor_read_sr2(struct spi_nor *nor, u8 *sr2)
>   *
>   * Return: 0 on success, -errno otherwise.
>   */
> -static int spi_nor_erase_chip(struct spi_nor *nor)
> +static int spi_nor_erase_die(struct spi_nor *nor, loff_t addr, size_t die_size)
>  {
> +	bool multi_die = nor->mtd.size == die_size;

this is wrong, it should have been
	bool multi_die = nor->mtd.size != die_size;

Sorry :)



More information about the linux-mtd mailing list