public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 00/41] mtd: spi-nor: clean the flash_info database up
@ 2023-08-22  7:09 Michael Walle
  2023-08-22  7:09 ` [PATCH v2 01/41] mtd: spi-nor: remove catalyst 'flashes' Michael Walle
                   ` (41 more replies)
  0 siblings, 42 replies; 78+ messages in thread
From: Michael Walle @ 2023-08-22  7:09 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra
  Cc: linux-kernel, linux-mtd, Michael Walle

The goal is to have slim entries for *new* entries and to have a
flexible macro to specify the flash ID and get rid of the former
INFOx() macros with the hardcoded ID length.

Here is are some examples how an entry of flash_info will look like
after the conversion:
  {
    .id = SNOR_ID(0xef, 0x80, 0x20),
    .name = "w25q512nwm",
    .otp = SNOR_OTP(256, 3, 0x1000, 0x1000),
  }

  {
    .id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x80),
    .name = "s25fl256s0",
    .size = SZ_32M,
    .sector_size = SZ_256K,
    .no_sfdp_flags = SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
    .mfr_flags = USE_CLSR,
  }

Please note that the second entry might even be slimmed down if the
flash supports SFDP, which is very likely. But apart from one
exception, this patchset shouldn't change any information in the
flash_info database.

The exception is the removal of very old SPI EEPROMs and a Fujitsu MRAM.
Both should use the at25 EEPROM driver. The latter even has device tree
bindings for the at25 driver.

To make the entries as slim as possible, we introduce sane default
values so the actual flash_info entries, doesn't need to specify them.
This mostly applies to old non-SFDP flashes anyway.

Patches 01-02 remove the old catalyst EEPROMs and the Fujitsu MRAM.

Patches 03-16 are preparation patches to either convert properties
(like .n_sectors) or to make properties optional. These patches will
also modify the old INFOx() macros. This is important because with this
we can actually make sure, the conversion doesn't have any unwanted
changes. We can compare the .rodata segment before and after the
conversion to make sure, there are no mistakes in the patches, because
they are impossible to review.

To make sure there are no changes you can compare the output of
  objdump -j.rodata -s drivers/mtd/spi-nor/built-in.a

(or individual objects like drivers/mtd/spi-nor/winbond.o) before and
after the conversion, that is before patch 17 and after patch 30.

FWIW, before the conversion it was impossible to use coccinelle, eg.
"spatch --parse-c winbond.c" flagged almost all lines in the flash_info
structure as bad.

Now after the conversion is completed, patches 31-39 sort the
entries by their IDs.

Patch 40 removes a duplicate entry in atmel which surfaced during the
sorting.

Patch 41 then finally removes the old INFOx() macros.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
Changes in v1:
- rebase to latest next, esp. include the sst26vf032b changes
- fixed the makefiles found by the kernel test robot
- fixed small typos and nitpicks noticed by Miquel
- collected Rb tags
- Link to v1: https://lore.kernel.org/r/20230807-mtd-flash-info-db-rework-v1-0-3d3d5bef4ba4@kernel.org

---
Michael Walle (41):
      mtd: spi-nor: remove catalyst 'flashes'
      mtd: spi-nor: remove Fujitsu MB85RS1MT support
      mtd: spi-nor: xilinx: use SPI_NOR_ID() in S3AN_INFO()
      mtd: spi-nor: xilinx: remove addr_nbytes from S3AN_INFO()
      mtd: spi-nor: convert .n_sectors to .size
      mtd: spi-nor: default page_size to 256 bytes
      mtd: spi-nor: store .n_banks in struct spi_nor_flash_parameter
      mtd: spi-nor: default .n_banks to 1
      mtd: spi-nor: push 4k SE handling into spi_nor_select_uniform_erase()
      mtd: spi-nor: make sector_size optional
      mtd: spi-nor: drop .parse_sfdp
      mtd: spi-nor: introduce (temporary) INFO0()
      mtd: spi-nor: move the .id and .id_len into an own structure
      mtd: spi-nor: rename .otp_org to .otp and make it a pointer
      mtd: spi-nor: add SNOR_ID() and SNOR_OTP()
      mtd: spi-nor: remove or move flash_info comments
      mtd: spi-nor: atmel: convert flash_info to new format
      mtd: spi-nor: eon: convert flash_info to new format
      mtd: spi-nor: esmt: convert flash_info to new format
      mtd: spi-nor: everspin: convert flash_info to new format
      mtd: spi-nor: gigadevice: convert flash_info to new format
      mtd: spi-nor: intel: convert flash_info to new format
      mtd: spi-nor: issi: convert flash_info to new format
      mtd: spi-nor: macronix: convert flash_info to new format
      mtd: spi-nor: micron-st: convert flash_info to new format
      mtd: spi-nor: spansion: convert flash_info to new format
      mtd: spi-nor: sst: convert flash_info to new format
      mtd: spi-nor: winbond: convert flash_info to new format
      mtd: spi-nor: xilinx: use new macros in S3AN_INFO()
      mtd: spi-nor: xmc: convert flash_info to new format
      mtd: spi-nor: atmel: sort flash_info database
      mtd: spi-nor: eon: sort flash_info database
      mtd: spi-nor: gigadevice: sort flash_info database
      mtd: spi-nor: issi: sort flash_info database
      mtd: spi-nor: macronix: sort flash_info database
      mtd: spi-nor: micron-st: sort flash_info database
      mtd: spi-nor: spansion: sort flash_info database
      mtd: spi-nor: sst: sort flash_info database
      mtd: spi-nor: winbond: sort flash_info entries
      mtd: spi-nor: atmel: drop duplicate entry
      mtd: spi-nor: core: get rid of the INFOx() macros

 drivers/mtd/spi-nor/Makefile     |   2 -
 drivers/mtd/spi-nor/atmel.c      | 116 +++++++----
 drivers/mtd/spi-nor/catalyst.c   |  24 ---
 drivers/mtd/spi-nor/core.c       |  63 +++---
 drivers/mtd/spi-nor/core.h       | 136 ++++++-------
 drivers/mtd/spi-nor/eon.c        |  74 +++++--
 drivers/mtd/spi-nor/esmt.c       |  29 ++-
 drivers/mtd/spi-nor/everspin.c   |  34 +++-
 drivers/mtd/spi-nor/fujitsu.c    |  21 --
 drivers/mtd/spi-nor/gigadevice.c |  82 ++++----
 drivers/mtd/spi-nor/intel.c      |  23 ++-
 drivers/mtd/spi-nor/issi.c       | 118 +++++++----
 drivers/mtd/spi-nor/macronix.c   | 220 ++++++++++++++-------
 drivers/mtd/spi-nor/micron-st.c  | 411 ++++++++++++++++++++++++++-------------
 drivers/mtd/spi-nor/spansion.c   | 389 ++++++++++++++++++++++--------------
 drivers/mtd/spi-nor/sst.c        | 164 ++++++++++------
 drivers/mtd/spi-nor/swp.c        |  13 +-
 drivers/mtd/spi-nor/sysfs.c      |   6 +-
 drivers/mtd/spi-nor/winbond.c    | 286 +++++++++++++++++----------
 drivers/mtd/spi-nor/xilinx.c     |  32 ++-
 drivers/mtd/spi-nor/xmc.c        |  19 +-
 21 files changed, 1391 insertions(+), 871 deletions(-)
---
base-commit: 47d9bb711707d15b19fad18c8e2b4b027a264a3a
change-id: 20230807-mtd-flash-info-db-rework-8a52d60f0023


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

^ permalink raw reply	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2023-09-07  9:46 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-22  7:09 [PATCH v2 00/41] mtd: spi-nor: clean the flash_info database up Michael Walle
2023-08-22  7:09 ` [PATCH v2 01/41] mtd: spi-nor: remove catalyst 'flashes' Michael Walle
2023-08-24  7:55   ` Tudor Ambarus
2023-08-24  8:33   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 02/41] mtd: spi-nor: remove Fujitsu MB85RS1MT support Michael Walle
2023-08-24  7:56   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 03/41] mtd: spi-nor: xilinx: use SPI_NOR_ID() in S3AN_INFO() Michael Walle
2023-08-24  7:59   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 04/41] mtd: spi-nor: xilinx: remove addr_nbytes from S3AN_INFO() Michael Walle
2023-08-24  8:13   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 05/41] mtd: spi-nor: convert .n_sectors to .size Michael Walle
2023-08-24  8:25   ` Tudor Ambarus
2023-09-01 11:00     ` Michael Walle
2023-08-22  7:09 ` [PATCH v2 06/41] mtd: spi-nor: default page_size to 256 bytes Michael Walle
2023-08-24  8:36   ` Tudor Ambarus
2023-09-01 11:03     ` Michael Walle
2023-08-22  7:09 ` [PATCH v2 07/41] mtd: spi-nor: store .n_banks in struct spi_nor_flash_parameter Michael Walle
2023-08-24  8:41   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 08/41] mtd: spi-nor: default .n_banks to 1 Michael Walle
2023-08-24  8:42   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 09/41] mtd: spi-nor: push 4k SE handling into spi_nor_select_uniform_erase() Michael Walle
2023-09-05 14:59   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 10/41] mtd: spi-nor: make sector_size optional Michael Walle
2023-09-06  5:44   ` Tudor Ambarus
2023-09-06  6:52     ` Michael Walle
2023-08-22  7:09 ` [PATCH v2 11/41] mtd: spi-nor: drop .parse_sfdp Michael Walle
2023-09-06  6:01   ` Tudor Ambarus
2023-09-06  6:55     ` Michael Walle
2023-09-06 14:55   ` Tudor Ambarus
2023-09-07  6:55     ` Michael Walle
2023-08-22  7:09 ` [PATCH v2 12/41] mtd: spi-nor: introduce (temporary) INFO0() Michael Walle
2023-09-06  6:04   ` Tudor Ambarus
2023-09-06  7:04     ` Michael Walle
2023-08-22  7:09 ` [PATCH v2 13/41] mtd: spi-nor: move the .id and .id_len into an own structure Michael Walle
2023-09-06  6:12   ` Tudor Ambarus
2023-09-06  7:13     ` Michael Walle
2023-09-06  7:15       ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 14/41] mtd: spi-nor: rename .otp_org to .otp and make it a pointer Michael Walle
2023-09-06  7:25   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 15/41] mtd: spi-nor: add SNOR_ID() and SNOR_OTP() Michael Walle
2023-09-06  7:28   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 16/41] mtd: spi-nor: remove or move flash_info comments Michael Walle
2023-09-06  7:28   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 17/41] mtd: spi-nor: atmel: convert flash_info to new format Michael Walle
2023-09-06  7:35   ` Tudor Ambarus
2023-09-06  7:38     ` Michael Walle
2023-09-07  8:13     ` Michael Walle
2023-09-07  9:45       ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 18/41] mtd: spi-nor: eon: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 19/41] mtd: spi-nor: esmt: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 20/41] mtd: spi-nor: everspin: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 21/41] mtd: spi-nor: gigadevice: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 22/41] mtd: spi-nor: intel: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 23/41] mtd: spi-nor: issi: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 24/41] mtd: spi-nor: macronix: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 25/41] mtd: spi-nor: micron-st: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 26/41] mtd: spi-nor: spansion: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 27/41] mtd: spi-nor: sst: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 28/41] mtd: spi-nor: winbond: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 29/41] mtd: spi-nor: xilinx: use new macros in S3AN_INFO() Michael Walle
2023-08-22  7:09 ` [PATCH v2 30/41] mtd: spi-nor: xmc: convert flash_info to new format Michael Walle
2023-08-22  7:09 ` [PATCH v2 31/41] mtd: spi-nor: atmel: sort flash_info database Michael Walle
2023-08-22  7:09 ` [PATCH v2 32/41] mtd: spi-nor: eon: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 33/41] mtd: spi-nor: gigadevice: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 34/41] mtd: spi-nor: issi: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 35/41] mtd: spi-nor: macronix: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 36/41] mtd: spi-nor: micron-st: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 37/41] mtd: spi-nor: spansion: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 38/41] mtd: spi-nor: sst: " Michael Walle
2023-08-22  7:09 ` [PATCH v2 39/41] mtd: spi-nor: winbond: sort flash_info entries Michael Walle
2023-09-06  7:36   ` Tudor Ambarus
2023-09-07  8:14     ` Michael Walle
2023-09-07  9:42       ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 40/41] mtd: spi-nor: atmel: drop duplicate entry Michael Walle
2023-09-06  7:39   ` Tudor Ambarus
2023-08-22  7:09 ` [PATCH v2 41/41] mtd: spi-nor: core: get rid of the INFOx() macros Michael Walle
2023-09-06  7:40   ` Tudor Ambarus
2023-09-06  7:43 ` [PATCH v2 00/41] mtd: spi-nor: clean the flash_info database up Tudor Ambarus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox