[PATCH v2 2/6] mtd: spi-nor: add erase die (chip) capability
Fabio Estevam
festevam at denx.de
Wed Nov 1 09:17:32 PDT 2023
Hi Tudor,
On 01/11/2023 13:04, Tudor Ambarus wrote:
> this is wrong, it should have been
> bool multi_die = nor->mtd.size != die_size;
I applied the following changes on top of v2:
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1067,12 +1067,17 @@ static int spi_nor_read_sr2(struct spi_nor *nor,
u8 *sr2)
*/
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;
+ bool multi_die = nor->mtd.size != die_size;
int ret;
- dev_dbg(nor->dev, " %lldKiB\n", (long long)(die_size >> 10));
+ dev_info(nor->dev, " %lldKiB\n", (long long)(die_size >> 10));
if (nor->spimem) {
+ dev_info(nor->dev, "***** nor->params->die_erase_opcode:
0x%x\n", nor->params->die_erase_opcode);
+ dev_info(nor->dev, "***** nor->addr_nbytes: %d\n",
nor->addr_nbytes);
+ dev_info(nor->dev, "***** addr 0x%llx\n", addr);
+ dev_info(nor->dev, "***** multi_die: %d\n", multi_die);
+
struct spi_mem_op op =
SPI_NOR_DIE_ERASE_OP(nor->params->die_erase_opcode,
nor->addr_nbytes, addr,
multi_die);
, but erase is still not working:
~# time flash_erase /dev/mtd0 0 0
Erasing 131072 Kibyte @ 0 -- 0 [ 14.733446] spi-nor spi0.0: 65536KiB
% complete [ 14.739932] spi-nor spi0.0: *****
nor->params->die_erase_opcode: 0xc4
[ 14.747311] spi-nor spi0.0: ***** nor->addr_nbytes: 4
[ 14.752402] spi-nor spi0.0: ***** addr 0x0
[ 14.756524] spi-nor spi0.0: ***** multi_die: 1
[ 14.761121] spi-nor spi0.0: 65536KiB
[ 14.764807] spi-nor spi0.0: ***** nor->params->die_erase_opcode: 0xc4
[ 14.771289] spi-nor spi0.0: ***** nor->addr_nbytes: 4
[ 14.776369] spi-nor spi0.0: ***** addr 0x4000000
[ 14.781004] spi-nor spi0.0: ***** multi_die: 1
Erasing 131072 Kibyte @ 0 -- 100 % complete
real 0m0.061s
user 0m0.006s
sys 0m0.053s
~# hexdump -C /dev/mtd0
00000000 d4 a1 8c 16 ad 4d b2 df 3d 2a af c2 ae 0a 8a c1
|.....M..=*......|
00000010 5f 2d 7a 17 9f c3 a4 46 cd f9 80 b8 1e 33 43 25
|_-z....F.....3C%|
....
Thanks
More information about the linux-arm-kernel
mailing list