All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Fabio Estevam <festevam@denx.de>
Cc: michael@walle.cc, takahiro.kuwano@infineon.com,
	pratyush@kernel.org, linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, bacem.daassi@infineon.com,
	miquel.raynal@bootlin.com, richard@nod.at
Subject: Re: [PATCH v2 2/6] mtd: spi-nor: add erase die (chip) capability
Date: Wed, 1 Nov 2023 17:27:37 +0000	[thread overview]
Message-ID: <e3901646-c918-426f-b219-e1670dc1e854@linaro.org> (raw)
In-Reply-To: <216d99d671caa2465519fcc3360c5001@denx.de>



On 11/1/23 16:17, Fabio Estevam wrote:
> Hi Tudor,
> 

Hi!

> 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);

cool!

> , 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, Fabio. I can't tell what's happening and it's getting late here.
Die erase does not execute if either of the status register BP bits are
set to 1 (some sectors are locked), but that shouldn't be the case I
guess as you could erase the entire flash before. So maybe dump SR/FSR
before and after the chip erase op. Other idea is to dump the spi_mem_op
fields, after spi_nor_spimem_setup_op() is called, maybe I got something
wrong there, but on a short look it seems fine.

I'll re-read this tomorrow. Cheers,
ta

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Fabio Estevam <festevam@denx.de>
Cc: michael@walle.cc, takahiro.kuwano@infineon.com,
	pratyush@kernel.org, linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, bacem.daassi@infineon.com,
	miquel.raynal@bootlin.com, richard@nod.at
Subject: Re: [PATCH v2 2/6] mtd: spi-nor: add erase die (chip) capability
Date: Wed, 1 Nov 2023 17:27:37 +0000	[thread overview]
Message-ID: <e3901646-c918-426f-b219-e1670dc1e854@linaro.org> (raw)
In-Reply-To: <216d99d671caa2465519fcc3360c5001@denx.de>



On 11/1/23 16:17, Fabio Estevam wrote:
> Hi Tudor,
> 

Hi!

> 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);

cool!

> , 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, Fabio. I can't tell what's happening and it's getting late here.
Die erase does not execute if either of the status register BP bits are
set to 1 (some sectors are locked), but that shouldn't be the case I
guess as you could erase the entire flash before. So maybe dump SR/FSR
before and after the chip erase op. Other idea is to dump the spi_mem_op
fields, after spi_nor_spimem_setup_op() is called, maybe I got something
wrong there, but on a short look it seems fine.

I'll re-read this tomorrow. Cheers,
ta

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-11-01 17:28 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 14:58 [PATCH v2 0/6] mtd: spi-nor: introduce die erase Tudor Ambarus
2023-11-01 14:58 ` Tudor Ambarus
2023-11-01 14:58 ` [PATCH v2 1/6] mtd: spi-nor: use kernel sized types instead of c99 types Tudor Ambarus
2023-11-01 14:58   ` Tudor Ambarus
2023-11-01 14:58 ` [PATCH v2 2/6] mtd: spi-nor: add erase die (chip) capability Tudor Ambarus
2023-11-01 14:58   ` Tudor Ambarus
2023-11-01 16:04   ` Tudor Ambarus
2023-11-01 16:04     ` Tudor Ambarus
2023-11-01 16:17     ` Fabio Estevam
2023-11-01 16:17       ` Fabio Estevam
2023-11-01 17:27       ` Tudor Ambarus [this message]
2023-11-01 17:27         ` Tudor Ambarus
2023-11-02 16:43         ` Fabio Estevam
2023-11-02 16:43           ` Fabio Estevam
2023-11-02 17:36           ` Tudor Ambarus
2023-11-02 17:36             ` Tudor Ambarus
2023-11-02 17:40             ` Fabio Estevam
2023-11-02 17:40               ` Fabio Estevam
2023-11-02 17:47               ` Tudor Ambarus
2023-11-02 17:47                 ` Tudor Ambarus
2023-11-02 17:54                 ` Tudor Ambarus
2023-11-02 17:54                   ` Tudor Ambarus
2023-11-02 17:59                   ` Tudor Ambarus
2023-11-02 17:59                     ` Tudor Ambarus
2023-11-02 18:01                     ` Fabio Estevam
2023-11-02 18:01                       ` Fabio Estevam
2023-11-02 18:21                       ` Tudor Ambarus
2023-11-02 18:21                         ` Tudor Ambarus
2023-11-02 18:33                         ` Fabio Estevam
2023-11-02 18:33                           ` Fabio Estevam
2023-11-02 18:46                           ` Tudor Ambarus
2023-11-02 18:46                             ` Tudor Ambarus
2023-11-02 18:56                             ` Tudor Ambarus
2023-11-02 18:56                               ` Tudor Ambarus
2023-11-02 21:42                               ` Fabio Estevam
2023-11-02 21:42                                 ` Fabio Estevam
2023-11-03 11:47                                 ` Tudor Ambarus
2023-11-03 11:47                                   ` Tudor Ambarus
2023-11-03 12:30                                   ` Fabio Estevam
2023-11-03 12:30                                     ` Fabio Estevam
2023-11-03 12:53                                     ` Fabio Estevam
2023-11-03 12:53                                       ` Fabio Estevam
2023-11-03 13:26                                       ` Tudor Ambarus
2023-11-03 13:26                                         ` Tudor Ambarus
2023-11-03 13:37                                         ` Fabio Estevam
2023-11-03 13:37                                           ` Fabio Estevam
2023-11-03 13:48                                           ` Tudor Ambarus
2023-11-03 13:48                                             ` Tudor Ambarus
2023-11-03 14:16                                             ` Fabio Estevam
2023-11-03 14:16                                               ` Fabio Estevam
2023-11-03 14:37                                               ` Tudor Ambarus
2023-11-03 14:37                                                 ` Tudor Ambarus
2023-11-03 14:58                                                 ` Fabio Estevam
2023-11-03 14:58                                                   ` Fabio Estevam
2023-11-06 14:24                                                   ` Tudor Ambarus
2023-11-06 14:24                                                     ` Tudor Ambarus
2023-11-06  9:34                                             ` Michael Walle
2023-11-06  9:34                                               ` Michael Walle
2023-11-06 14:23                                               ` Tudor Ambarus
2023-11-06 14:23                                                 ` Tudor Ambarus
2023-11-06 14:56                                                 ` Tudor Ambarus
2023-11-06 14:56                                                   ` Tudor Ambarus
2023-11-09  9:09                                                 ` Michael Walle
2023-11-09  9:09                                                   ` Michael Walle
2023-11-15  7:06                                                   ` Tudor Ambarus
2023-11-15  7:06                                                     ` Tudor Ambarus
2023-11-08  8:06                             ` Takahiro Kuwano
2023-11-08  8:06                               ` Takahiro Kuwano
2023-11-08  8:54                               ` Tudor Ambarus
2023-11-08  8:54                                 ` Tudor Ambarus
2023-11-01 14:58 ` [PATCH v2 3/6] mtd: spi-nor: spansion: enable die erase for multi die flashes Tudor Ambarus
2023-11-01 14:58   ` Tudor Ambarus
2023-11-01 14:58 ` [PATCH v2 4/6] mtd: spi-nor: micron-st: " Tudor Ambarus
2023-11-01 14:58   ` Tudor Ambarus
2023-11-01 14:58 ` [PATCH v2 5/6] mtd: spi-nor: remove NO_CHIP_ERASE flag Tudor Ambarus
2023-11-01 14:58   ` Tudor Ambarus
2023-11-01 14:58 ` [PATCH v2 6/6] mtd: spi-nor: micron-st: Add support for mt25qu01g Tudor Ambarus
2023-11-01 14:58   ` Tudor Ambarus
2023-11-01 15:54 ` [PATCH v2 0/6] mtd: spi-nor: introduce die erase Fabio Estevam
2023-11-01 15:54   ` Fabio Estevam
2023-11-15  6:10 ` Re (subset): " Tudor Ambarus
2023-11-15  6:10   ` Tudor Ambarus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3901646-c918-426f-b219-e1670dc1e854@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=bacem.daassi@infineon.com \
    --cc=festevam@denx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=takahiro.kuwano@infineon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.