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

Fabio Estevam festevam at denx.de
Thu Nov 2 14:42:57 PDT 2023


On 02/11/2023 15:56, Tudor Ambarus wrote:

> Let's try something else:
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 5584bf9cbfd1..a0af7a7eb727 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1074,7 +1074,7 @@ static int spi_nor_erase_die(struct spi_nor *nor,
> loff_t addr, size_t die_size)
> 
>         if (nor->spimem) {
>                 struct spi_mem_op op =
> -                       
> SPI_NOR_DIE_ERASE_OP(nor->params->die_erase_opcode,
> +                       SPI_NOR_DIE_ERASE_OP(nor->erase_opcode,
>                                              nor->addr_nbytes, addr,
> multi_die);
> 
>                 spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
> 
> I expect that with this the first sector from each die will be erased.

You are right. This is exactly what happens with this change:

First die:

~# hexdump  /dev/mtd0
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0010000 9231 efb8 d664 d77b 231c 3522 d7e8 4f6e

Second die:

~# hexdump -s 0x4000000 /dev/mtd0
4000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
4010000 0418 0518 60a0 9214 2411 2004 c144 9e2b



More information about the linux-mtd mailing list