[PATCH v5 00/32] mtd: spi-nor: move vendor specific code into vendor modules

Michael Walle posted 32 patches 4 years, 4 months ago
drivers/mtd/spi-nor/atmel.c      |  81 +++++-----
drivers/mtd/spi-nor/catalyst.c   |   6 +-
drivers/mtd/spi-nor/core.c       | 265 ++-----------------------------
drivers/mtd/spi-nor/core.h       |  70 ++++----
drivers/mtd/spi-nor/eon.c        |   6 +-
drivers/mtd/spi-nor/esmt.c       |   6 +-
drivers/mtd/spi-nor/everspin.c   |   6 +-
drivers/mtd/spi-nor/fujitsu.c    |   6 +-
drivers/mtd/spi-nor/gigadevice.c |   6 +-
drivers/mtd/spi-nor/intel.c      |   6 +-
drivers/mtd/spi-nor/issi.c       |  10 +-
drivers/mtd/spi-nor/macronix.c   |  14 +-
drivers/mtd/spi-nor/micron-st.c  | 259 ++++++++++++++++++++++++------
drivers/mtd/spi-nor/spansion.c   | 168 +++++++++++++++-----
drivers/mtd/spi-nor/sst.c        |  44 ++---
drivers/mtd/spi-nor/winbond.c    |  29 ++--
drivers/mtd/spi-nor/xilinx.c     |  97 +++++++++--
drivers/mtd/spi-nor/xmc.c        |   6 +-
include/linux/mtd/spi-nor.h      |  18 ---
19 files changed, 579 insertions(+), 524 deletions(-)
[PATCH v5 00/32] mtd: spi-nor: move vendor specific code into vendor modules
Posted by Michael Walle 4 years, 4 months ago
It turns out that most of the special status register handling is
specific for a particular vendor. I.e. Xilinx has some different
opcodes for the status register read, Micron has an additional FSR
register and Spansion has these flags integrated into the SR.

Create a callback to ready() where a flash chip can register its
own function. This will let us move all the vendor specific stuff
out of the core into the vendor modules.

As a preparation step, unify all function and object names in the
vendor modules. For the sake of consistency and better readability
of the code flow, I also converted the setup() callback to be
optional.

Please note that this is only compile-time tested.

Changes since v4:
 - corrected doc strings of spi_nor_sr_ready_and_clear/
   spansion_nor_sr_ready_and_clear and spi_nor_fsr_ready/
   micron_st_nor_ready
 - renamed micron_st_nor_fsr_ready() to micron_st_nor_ready()

Changes since v3:
 - fix spansion.c compilation, messed up the patch export. Sorry
   for the noise

Changes since v2:
 - use family_nor_ instead of just family_ prefix
 - fix function doc

Changes since v1:
 - rename/unify function names inside the vendor modules.
 - make local functions static
 - fix function doc typo
 - use late_init hook to set fsr_ready op
 - Use uppercase and period in comments
 - Add comments for the vendor flags
 - move coding style change in spi_nor_sr_ready() into own patch
 - new patch to add missing parenthesis in S3AN_INFO()
 - add missing function prefix rename patch for the spansion module

Michael Walle (32):
  mtd: spi-nor: atmel: unify function names
  mtd: spi-nor: catalyst: unify function names
  mtd: spi-nor: eon: unify function names
  mtd: spi-nor: esmt: unify function names
  mtd: spi-nor: everspin: unify function names
  mtd: spi-nor: fujitsu: unify function names
  mtd: spi-nor: gigadevice: unify function names
  mtd: spi-nor: intel: unify function names
  mtd: spi-nor: issi: unify function names
  mtd: spi-nor: macronix: unify function names
  mtd: spi-nor: micron-st: unify function names
  mtd: spi-nor: spansion: unify function names
  mtd: spi-nor: sst: unify function names
  mtd: spi-nor: winbond: unify function names
  mtd: spi-nor: xilinx: unify function names
  mtd: spi-nor: xmc: unify function names
  mtd: spi-nor: slightly refactor the spi_nor_setup()
  mtd: spi-nor: allow a flash to define its own ready() function
  mtd: spi-nor: export more function to be used in vendor modules
  mtd: spi-nor: guard _page_size parameter in S3AN_INFO()
  mtd: spi-nor: move all xilinx specifics into xilinx.c
  mtd: spi-nor: xilinx: rename vendor specific functions and defines
  mtd: spi-nor: xilinx: correct the debug message
  mtd: spi-nor: move all micron-st specifics into micron-st.c
  mtd: spi-nor: micron-st: convert USE_FSR to a manufacturer flag
  mtd: spi-nor: micron-st: rename vendor specific functions and defines
  mtd: spi-nor: spansion: slightly rework control flow in late_init()
  mtd: spi-nor: move all spansion specifics into spansion.c
  mtd: spi-nor: spansion: convert USE_CLSR to a manufacturer flag
  mtd: spi-nor: spansion: rename vendor specific functions and defines
  mtd: spi-nor: slightly change code style in spi_nor_sr_ready()
  mtd: spi-nor: renumber flags

 drivers/mtd/spi-nor/atmel.c      |  81 +++++-----
 drivers/mtd/spi-nor/catalyst.c   |   6 +-
 drivers/mtd/spi-nor/core.c       | 265 ++-----------------------------
 drivers/mtd/spi-nor/core.h       |  70 ++++----
 drivers/mtd/spi-nor/eon.c        |   6 +-
 drivers/mtd/spi-nor/esmt.c       |   6 +-
 drivers/mtd/spi-nor/everspin.c   |   6 +-
 drivers/mtd/spi-nor/fujitsu.c    |   6 +-
 drivers/mtd/spi-nor/gigadevice.c |   6 +-
 drivers/mtd/spi-nor/intel.c      |   6 +-
 drivers/mtd/spi-nor/issi.c       |  10 +-
 drivers/mtd/spi-nor/macronix.c   |  14 +-
 drivers/mtd/spi-nor/micron-st.c  | 259 ++++++++++++++++++++++++------
 drivers/mtd/spi-nor/spansion.c   | 168 +++++++++++++++-----
 drivers/mtd/spi-nor/sst.c        |  44 ++---
 drivers/mtd/spi-nor/winbond.c    |  29 ++--
 drivers/mtd/spi-nor/xilinx.c     |  97 +++++++++--
 drivers/mtd/spi-nor/xmc.c        |   6 +-
 include/linux/mtd/spi-nor.h      |  18 ---
 19 files changed, 579 insertions(+), 524 deletions(-)

-- 
2.30.2

Re: [PATCH v5 00/32] mtd: spi-nor: move vendor specific code into vendor modules
Posted by Tudor Ambarus 4 years, 3 months ago
On Wed, 23 Feb 2022 14:43:26 +0100, Michael Walle wrote:
> It turns out that most of the special status register handling is
> specific for a particular vendor. I.e. Xilinx has some different
> opcodes for the status register read, Micron has an additional FSR
> register and Spansion has these flags integrated into the SR.
> 
> Create a callback to ready() where a flash chip can register its
> own function. This will let us move all the vendor specific stuff
> out of the core into the vendor modules.
> 
> [...]

Applied to spi-nor/next, thanks!

[01/32] mtd: spi-nor: atmel: unify function names
        https://git.kernel.org/mtd/c/2394770bd6bb
[02/32] mtd: spi-nor: catalyst: unify function names
        https://git.kernel.org/mtd/c/9eb916e2523e
[03/32] mtd: spi-nor: eon: unify function names
        https://git.kernel.org/mtd/c/f5e7bd2768d7
[04/32] mtd: spi-nor: esmt: unify function names
        https://git.kernel.org/mtd/c/a7a3f09024b6
[05/32] mtd: spi-nor: everspin: unify function names
        https://git.kernel.org/mtd/c/09ae8354c31d
[06/32] mtd: spi-nor: fujitsu: unify function names
        https://git.kernel.org/mtd/c/5410151931fa
[07/32] mtd: spi-nor: gigadevice: unify function names
        https://git.kernel.org/mtd/c/0ab828613c5a
[08/32] mtd: spi-nor: intel: unify function names
        https://git.kernel.org/mtd/c/536437aabb7a
[09/32] mtd: spi-nor: issi: unify function names
        https://git.kernel.org/mtd/c/cc5af02f6008
[10/32] mtd: spi-nor: macronix: unify function names
        https://git.kernel.org/mtd/c/0757201a1daa
[11/32] mtd: spi-nor: micron-st: unify function names
        https://git.kernel.org/mtd/c/c9d5cdf4bf9c
[12/32] mtd: spi-nor: spansion: unify function names
        https://git.kernel.org/mtd/c/fedd0cbf3e93
[13/32] mtd: spi-nor: sst: unify function names
        https://git.kernel.org/mtd/c/7e5b38ae4f23
[14/32] mtd: spi-nor: winbond: unify function names
        https://git.kernel.org/mtd/c/a7a0466f582f
[15/32] mtd: spi-nor: xilinx: unify function names
        https://git.kernel.org/mtd/c/45acce2099c5
[16/32] mtd: spi-nor: xmc: unify function names
        https://git.kernel.org/mtd/c/232e2830f525
[17/32] mtd: spi-nor: slightly refactor the spi_nor_setup()
        https://git.kernel.org/mtd/c/b44aa9ac6bb4
[18/32] mtd: spi-nor: allow a flash to define its own ready() function
        https://git.kernel.org/mtd/c/4cf1c7bdc55c
[19/32] mtd: spi-nor: export more function to be used in vendor modules
        https://git.kernel.org/mtd/c/66cf87c60014
[20/32] mtd: spi-nor: guard _page_size parameter in S3AN_INFO()
        https://git.kernel.org/mtd/c/9fb4beb1b051
[21/32] mtd: spi-nor: move all xilinx specifics into xilinx.c
        https://git.kernel.org/mtd/c/8b4195cd6dc3
[22/32] mtd: spi-nor: xilinx: rename vendor specific functions and defines
        https://git.kernel.org/mtd/c/8b7a2e00d117
[23/32] mtd: spi-nor: xilinx: correct the debug message
        https://git.kernel.org/mtd/c/56b852e8635b
[24/32] mtd: spi-nor: move all micron-st specifics into micron-st.c
        https://git.kernel.org/mtd/c/c770abe52d81
[25/32] mtd: spi-nor: micron-st: convert USE_FSR to a manufacturer flag
        https://git.kernel.org/mtd/c/8f938262a6f3
[26/32] mtd: spi-nor: micron-st: rename vendor specific functions and defines
        https://git.kernel.org/mtd/c/2b18a18ea7f8
[27/32] mtd: spi-nor: spansion: slightly rework control flow in late_init()
        https://git.kernel.org/mtd/c/6235ff040c13
[28/32] mtd: spi-nor: move all spansion specifics into spansion.c
        https://git.kernel.org/mtd/c/837d5181beef
[29/32] mtd: spi-nor: spansion: convert USE_CLSR to a manufacturer flag
        https://git.kernel.org/mtd/c/51c55506a7b1
[30/32] mtd: spi-nor: spansion: rename vendor specific functions and defines
        https://git.kernel.org/mtd/c/e8fd3b4b266b
[31/32] mtd: spi-nor: slightly change code style in spi_nor_sr_ready()
        https://git.kernel.org/mtd/c/e9d663a2a019
[32/32] mtd: spi-nor: renumber flags
        https://git.kernel.org/mtd/c/3c552889e431

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@microchip.com>