mbox series

[v3,00/25] mtd: spi-nor: Clean params init

Message ID 20211029172633.886453-1-tudor.ambarus@microchip.com (mailing list archive)
Headers show
Series mtd: spi-nor: Clean params init | expand

Message

Tudor Ambarus Oct. 29, 2021, 5:26 p.m. UTC
Clean spi_nor_scan() and the flash parameters initialization code. 
Tested all the flashes from patch set. If someone can test the
locking ops on few flashes would be great. It seems that my flashes
have the non volatile bits weared out.

This patch set is split from:
https://lore.kernel.org/linux-mtd/20210727045222.905056-1-tudor.ambarus@microchip.com/
The ID collision series will be set in a dedicated patch set that will
depend on this one.

Changes in v3:
- move late_init() in struct spi_nor_fixups and update patches accordingly.     
R-b tags were dropped.
- new patch "mtd: spi-nor: sst: Get rid of SST_WRITE flash_info flag"
moves manufacturer specific flag out of the core.
- update methods description to make it clear who sets when
- introduce flash_info flag masks to make it clear when one should be set.
- rework "parse SFDP first idea".

Tudor Ambarus (25):
  mtd: spi-nor: core: Fix spi_nor_flash_parameter otp description
  mtd: spi-nor: core: Use container_of to get the pointer to struct
    spi_nor
  mtd: spi-nor: Introduce spi_nor_set_mtd_info()
  mtd: spi-nor: Get rid of nor->page_size
  mtd: spi-nor: core: Introduce the late_init() hook
  mtd: spi-nor: atmel: Use flash late_init() for locking
  mtd: spi-nor: sst: Use flash late_init() for locking
  mtd: spi-nor: winbond: Use manufacturer late_init() for OTP ops
  mtd: spi-nor: xilinx: Use manufacturer late_init() to set setup method
  mtd: spi-nor: sst: Use manufacturer late_init() to set _write()
  mtd: spi-nor: spansion: Use manufacturer late_init()
  mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is
    defined
  mtd: spi-nor: sst: Get rid of SST_WRITE flash_info flag
  mtd: spi-nor: Introduce flash_info flags masks
  mtd: spi-nor: Introduce spi_nor_nonsfdp_init_flags()
  mtd: spi-nor: Introduce spi_nor_init_fixup_flags()
  mtd: spi-nor: core: Introduce SPI_NOR_PARSE_SFDP
  mtd: spi-nor: core: Init flash params based on SFDP first for new
    flash additions
  mtd: spi-nor: core: Move spi_nor_set_addr_width() in spi_nor_setup()
  mtd: spi-nor: sst: sst26vf064b: Init flash based on SFDP
  mtd: spi-nor: winbond: w25q256jvm: Init flash based on SFDP
  mtd: spi-nor: spansion: s25fl256s0: Skip SFDP parsing
  mtd: spi-nor: gigadevice: gd25q256: Init flash based on SFDP
  mtd: spi-nor: issi: is25lp256: Init flash based on SFDP
  mtd: spi-nor: macronix: mx25l25635e: Init flash based on SFDP

 drivers/mtd/spi-nor/atmel.c      |   8 +-
 drivers/mtd/spi-nor/core.c       | 480 +++++++++++++++++--------------
 drivers/mtd/spi-nor/core.h       | 106 ++++---
 drivers/mtd/spi-nor/gigadevice.c |   7 +-
 drivers/mtd/spi-nor/issi.c       |   6 +-
 drivers/mtd/spi-nor/macronix.c   |  15 +-
 drivers/mtd/spi-nor/micron-st.c  |  20 +-
 drivers/mtd/spi-nor/otp.c        |   2 +-
 drivers/mtd/spi-nor/spansion.c   |  15 +-
 drivers/mtd/spi-nor/sst.c        | 105 ++++---
 drivers/mtd/spi-nor/swp.c        |   2 +-
 drivers/mtd/spi-nor/winbond.c    |   7 +-
 drivers/mtd/spi-nor/xilinx.c     |  21 +-
 include/linux/mtd/spi-nor.h      |   2 -
 14 files changed, 460 insertions(+), 336 deletions(-)

Comments

Tudor Ambarus Nov. 8, 2021, 10:15 a.m. UTC | #1
Hi,

On 10/29/21 8:26 PM, Tudor Ambarus wrote:
> Clean spi_nor_scan() and the flash parameters initialization code. 
> Tested all the flashes from patch set. If someone can test the
> locking ops on few flashes would be great. It seems that my flashes
> have the non volatile bits weared out.
> 
> This patch set is split from:
> https://lore.kernel.org/linux-mtd/20210727045222.905056-1-tudor.ambarus@microchip.com/
> The ID collision series will be set in a dedicated patch set that will
> depend on this one.
> 
> Changes in v3:
> - move late_init() in struct spi_nor_fixups and update patches accordingly.     
> R-b tags were dropped.
> - new patch "mtd: spi-nor: sst: Get rid of SST_WRITE flash_info flag"
> moves manufacturer specific flag out of the core.
> - update methods description to make it clear who sets when
> - introduce flash_info flag masks to make it clear when one should be set.
> - rework "parse SFDP first idea".
> 
> Tudor Ambarus (25):
>   mtd: spi-nor: core: Fix spi_nor_flash_parameter otp description
>   mtd: spi-nor: core: Use container_of to get the pointer to struct
>     spi_nor
>   mtd: spi-nor: Introduce spi_nor_set_mtd_info()
>   mtd: spi-nor: Get rid of nor->page_size
>   mtd: spi-nor: core: Introduce the late_init() hook
>   mtd: spi-nor: atmel: Use flash late_init() for locking
>   mtd: spi-nor: sst: Use flash late_init() for locking
>   mtd: spi-nor: winbond: Use manufacturer late_init() for OTP ops
>   mtd: spi-nor: xilinx: Use manufacturer late_init() to set setup method
>   mtd: spi-nor: sst: Use manufacturer late_init() to set _write()
>   mtd: spi-nor: spansion: Use manufacturer late_init()
>   mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is
>     defined
>   mtd: spi-nor: sst: Get rid of SST_WRITE flash_info flag
>   mtd: spi-nor: Introduce flash_info flags masks
>   mtd: spi-nor: Introduce spi_nor_nonsfdp_init_flags()
>   mtd: spi-nor: Introduce spi_nor_init_fixup_flags()
>   mtd: spi-nor: core: Introduce SPI_NOR_PARSE_SFDP
>   mtd: spi-nor: core: Init flash params based on SFDP first for new
>     flash additions
>   mtd: spi-nor: core: Move spi_nor_set_addr_width() in spi_nor_setup()
>   mtd: spi-nor: sst: sst26vf064b: Init flash based on SFDP
>   mtd: spi-nor: winbond: w25q256jvm: Init flash based on SFDP
>   mtd: spi-nor: spansion: s25fl256s0: Skip SFDP parsing
>   mtd: spi-nor: gigadevice: gd25q256: Init flash based on SFDP
>   mtd: spi-nor: issi: is25lp256: Init flash based on SFDP
>   mtd: spi-nor: macronix: mx25l25635e: Init flash based on SFDP
> 
>  drivers/mtd/spi-nor/atmel.c      |   8 +-
>  drivers/mtd/spi-nor/core.c       | 480 +++++++++++++++++--------------
>  drivers/mtd/spi-nor/core.h       | 106 ++++---
>  drivers/mtd/spi-nor/gigadevice.c |   7 +-
>  drivers/mtd/spi-nor/issi.c       |   6 +-
>  drivers/mtd/spi-nor/macronix.c   |  15 +-
>  drivers/mtd/spi-nor/micron-st.c  |  20 +-
>  drivers/mtd/spi-nor/otp.c        |   2 +-
>  drivers/mtd/spi-nor/spansion.c   |  15 +-
>  drivers/mtd/spi-nor/sst.c        | 105 ++++---
>  drivers/mtd/spi-nor/swp.c        |   2 +-
>  drivers/mtd/spi-nor/winbond.c    |   7 +-
>  drivers/mtd/spi-nor/xilinx.c     |  21 +-
>  include/linux/mtd/spi-nor.h      |   2 -
>  14 files changed, 460 insertions(+), 336 deletions(-)
> 

I would like to apply this when -rc1 is out. Can some of you run some tests
and check if everything is ok? I have done few tests on the flashes that I
mentioned in the cover letter, all should be ok. I'm particularly interested
in the locking support. I can test the unlock_all on sst26vf064b validating
the locking part, but it would be good if locking is tested on other flash
too.

Thanks,
ta
Michael Walle Nov. 8, 2021, 10:31 a.m. UTC | #2
Am 2021-11-08 11:15, schrieb Tudor.Ambarus@microchip.com:
> Hi,
> 
> On 10/29/21 8:26 PM, Tudor Ambarus wrote:
>> Clean spi_nor_scan() and the flash parameters initialization code.
>> Tested all the flashes from patch set. If someone can test the
>> locking ops on few flashes would be great. It seems that my flashes
>> have the non volatile bits weared out.
>> 
>> This patch set is split from:
>> https://lore.kernel.org/linux-mtd/20210727045222.905056-1-tudor.ambarus@microchip.com/
>> The ID collision series will be set in a dedicated patch set that will
>> depend on this one.
>> 
>> Changes in v3:
>> - move late_init() in struct spi_nor_fixups and update patches 
>> accordingly.
>> R-b tags were dropped.
>> - new patch "mtd: spi-nor: sst: Get rid of SST_WRITE flash_info flag"
>> moves manufacturer specific flag out of the core.
>> - update methods description to make it clear who sets when
>> - introduce flash_info flag masks to make it clear when one should be 
>> set.
>> - rework "parse SFDP first idea".
>> 
>> Tudor Ambarus (25):
>>   mtd: spi-nor: core: Fix spi_nor_flash_parameter otp description
>>   mtd: spi-nor: core: Use container_of to get the pointer to struct
>>     spi_nor
>>   mtd: spi-nor: Introduce spi_nor_set_mtd_info()
>>   mtd: spi-nor: Get rid of nor->page_size
>>   mtd: spi-nor: core: Introduce the late_init() hook
>>   mtd: spi-nor: atmel: Use flash late_init() for locking
>>   mtd: spi-nor: sst: Use flash late_init() for locking
>>   mtd: spi-nor: winbond: Use manufacturer late_init() for OTP ops
>>   mtd: spi-nor: xilinx: Use manufacturer late_init() to set setup 
>> method
>>   mtd: spi-nor: sst: Use manufacturer late_init() to set _write()
>>   mtd: spi-nor: spansion: Use manufacturer late_init()
>>   mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP 
>> is
>>     defined
>>   mtd: spi-nor: sst: Get rid of SST_WRITE flash_info flag
>>   mtd: spi-nor: Introduce flash_info flags masks
>>   mtd: spi-nor: Introduce spi_nor_nonsfdp_init_flags()
>>   mtd: spi-nor: Introduce spi_nor_init_fixup_flags()
>>   mtd: spi-nor: core: Introduce SPI_NOR_PARSE_SFDP
>>   mtd: spi-nor: core: Init flash params based on SFDP first for new
>>     flash additions
>>   mtd: spi-nor: core: Move spi_nor_set_addr_width() in spi_nor_setup()
>>   mtd: spi-nor: sst: sst26vf064b: Init flash based on SFDP
>>   mtd: spi-nor: winbond: w25q256jvm: Init flash based on SFDP
>>   mtd: spi-nor: spansion: s25fl256s0: Skip SFDP parsing
>>   mtd: spi-nor: gigadevice: gd25q256: Init flash based on SFDP
>>   mtd: spi-nor: issi: is25lp256: Init flash based on SFDP
>>   mtd: spi-nor: macronix: mx25l25635e: Init flash based on SFDP
>> 
>>  drivers/mtd/spi-nor/atmel.c      |   8 +-
>>  drivers/mtd/spi-nor/core.c       | 480 
>> +++++++++++++++++--------------
>>  drivers/mtd/spi-nor/core.h       | 106 ++++---
>>  drivers/mtd/spi-nor/gigadevice.c |   7 +-
>>  drivers/mtd/spi-nor/issi.c       |   6 +-
>>  drivers/mtd/spi-nor/macronix.c   |  15 +-
>>  drivers/mtd/spi-nor/micron-st.c  |  20 +-
>>  drivers/mtd/spi-nor/otp.c        |   2 +-
>>  drivers/mtd/spi-nor/spansion.c   |  15 +-
>>  drivers/mtd/spi-nor/sst.c        | 105 ++++---
>>  drivers/mtd/spi-nor/swp.c        |   2 +-
>>  drivers/mtd/spi-nor/winbond.c    |   7 +-
>>  drivers/mtd/spi-nor/xilinx.c     |  21 +-
>>  include/linux/mtd/spi-nor.h      |   2 -
>>  14 files changed, 460 insertions(+), 336 deletions(-)
>> 
> 
> I would like to apply this when -rc1 is out. Can some of you run some 
> tests
> and check if everything is ok? I have done few tests on the flashes 
> that I
> mentioned in the cover letter, all should be ok. I'm particularly 
> interested
> in the locking support. I can test the unlock_all on sst26vf064b 
> validating
> the locking part, but it would be good if locking is tested on other 
> flash
> too.
> 

FWIW, I've quickly tested the series on a W25Q32JW (OTP only) and 
W25Q128 (OTP
and locking, OTP patch is not upstream).

Tested-by: Michael Walle <michael@walle.cc> #on w25q32jw and w25q128fw

-michael
Pratyush Yadav Nov. 16, 2021, 11:36 a.m. UTC | #3
On 29/10/21 08:26PM, Tudor Ambarus wrote:
> Clean spi_nor_scan() and the flash parameters initialization code. 
> Tested all the flashes from patch set. If someone can test the
> locking ops on few flashes would be great. It seems that my flashes
> have the non volatile bits weared out.
> 
> This patch set is split from:
> https://lore.kernel.org/linux-mtd/20210727045222.905056-1-tudor.ambarus@microchip.com/
> The ID collision series will be set in a dedicated patch set that will
> depend on this one.

I generated some random data (4 MiB), erased the flash, wrote the data 
to the flash, read the data back, and compared it with the original 
image. Works fine on Micron MT35XU512ABA, Micron N25Q128A13, Cypress 
S28HS512T.

Tested-by: Pratyush Yadav <p.yadav@ti.com> # mt35xu512aba, s28hs512t, n25q128a13
Michael Walle Nov. 16, 2021, 11:56 a.m. UTC | #4
Am 2021-11-16 12:36, schrieb Pratyush Yadav:
> On 29/10/21 08:26PM, Tudor Ambarus wrote:
>> Clean spi_nor_scan() and the flash parameters initialization code.
>> Tested all the flashes from patch set. If someone can test the
>> locking ops on few flashes would be great. It seems that my flashes
>> have the non volatile bits weared out.
>> 
>> This patch set is split from:
>> https://lore.kernel.org/linux-mtd/20210727045222.905056-1-tudor.ambarus@microchip.com/
>> The ID collision series will be set in a dedicated patch set that will
>> depend on this one.
> 
> I generated some random data (4 MiB), erased the flash, wrote the data
> to the flash, read the data back, and compared it with the original
> image. Works fine on Micron MT35XU512ABA, Micron N25Q128A13, Cypress
> S28HS512T.

Ahh btw. I've tested the locking with a custom patch which can dump the
status register. Haven't posted that yet, because it still uses sysfs 
and
I was thinking of converting it to debugfs.

-michael
Tudor Ambarus Nov. 17, 2021, 1:17 p.m. UTC | #5
On Fri, 29 Oct 2021 20:26:08 +0300, Tudor Ambarus wrote:
> Clean spi_nor_scan() and the flash parameters initialization code.
> Tested all the flashes from patch set. If someone can test the
> locking ops on few flashes would be great. It seems that my flashes
> have the non volatile bits weared out.
> 
> This patch set is split from:
> https://lore.kernel.org/linux-mtd/20210727045222.905056-1-tudor.ambarus@microchip.com/
> The ID collision series will be set in a dedicated patch set that will
> depend on this one.
> 
> [...]

Applied to spi-nor/next, thanks!

[01/25] mtd: spi-nor: core: Fix spi_nor_flash_parameter otp description
        https://git.kernel.org/mtd/c/a360ae43217c
[02/25] mtd: spi-nor: core: Use container_of to get the pointer to struct spi_nor
        https://git.kernel.org/mtd/c/7158c86e5607
[04/25] mtd: spi-nor: Get rid of nor->page_size
        https://git.kernel.org/mtd/c/5854d4a6cc35
[05/25] mtd: spi-nor: core: Introduce the late_init() hook
        https://git.kernel.org/mtd/c/dacc8cfee493
[06/25] mtd: spi-nor: atmel: Use flash late_init() for locking
        https://git.kernel.org/mtd/c/b0fa1db7d2f6
[07/25] mtd: spi-nor: sst: Use flash late_init() for locking
        https://git.kernel.org/mtd/c/7d4ff0613fb5
[08/25] mtd: spi-nor: winbond: Use manufacturer late_init() for OTP ops
        https://git.kernel.org/mtd/c/00947a964949
[09/25] mtd: spi-nor: xilinx: Use manufacturer late_init() to set setup method
        https://git.kernel.org/mtd/c/3fdad69e7fb2
[10/25] mtd: spi-nor: sst: Use manufacturer late_init() to set _write()
        https://git.kernel.org/mtd/c/f22a48dbd01b
[11/25] mtd: spi-nor: spansion: Use manufacturer late_init()
        https://git.kernel.org/mtd/c/d396e735ba0c

Best regards,