linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/27] Introduce the generic ECC engine abstraction
@ 2019-02-21 10:01 Miquel Raynal
  2019-02-21 10:01 ` [RFC PATCH 01/27] mtd: nand: Move nand_device forward declaration to the top Miquel Raynal
                   ` (11 more replies)
  0 siblings, 12 replies; 36+ messages in thread
From: Miquel Raynal @ 2019-02-21 10:01 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Tudor Ambarus
  Cc: Vignesh R, Tudor Ambarus, Julien Su, Schrempf Frieder, linux-mtd,
	Thomas Petazzoni, Miquel Raynal, Mason Yang, linux-arm-kernel

As of today, only raw NAND controllers used to feature an integrated
ECC engine and so controller drivers always embedded some code to
enable/disable the correction.

This statement is no longer correct as SPI-NAND devices might not
embed an on-die ECC engine and must make use of an external ECC
engine. We figured there are three possible situations for (generic)
NAND device: either the engine is 'on-die' (most of the SPI-NANDs, a
few raw NANDs), or the engine is part of the host controller (most raw
NANDs), or the engine may be external (SPI controllers might feature
an ECC engine, or there are still the possibility to use software
correction).


To solve this situation, this is a proposal on how to make things
work. We want to create an ECC engine object which has simple
callbacks:
* init/cleanup its context
* prepare an I/O operation
* finish an I/O operation
Details about what is going to happen in these callbacks is described
in drivers/mtd/nand/ecc/engine.c.

The logic in this series is:
1/ Use the generic NAND core for all NAND devices (raw and SPI).
2/ Create the ECC engine interface in drivers/mtd/nand/ecc/
3/ Move code in driver/mtd/nand/ecc.
4/ Make both software engines (Hamming and BCH) generic, move them in
   the ecc/ directory, clean them a bit and instantiate ECC
   engines. Write raw NAND helpers to use these two new engines.
5/ Isolate SPI-NAND on-die ECC engine in its own driver.
6/ Make use from the SPI-NAND layer of all the ECC engines listed
   above (on user request, people can now make use of soft BCH if they
   don't have an ECC-engine).

This work is still WIP, I expect a few 0-day regressions, maybe the
naming is not perfect but it gives an idea of what I would like to
introduce. The next steps are:
1/ Migrate the raw NAND core to make a proper use of these ECC
   engines.
2/ Deprecate in the raw NAND subsystem the interfaces used until now
   (I expect we should get rid of a lot of boilerplate).
3/ Introduce an external hardware ECC engine driver.


Thanks,
Miquèl


Miquel Raynal (27):
  mtd: nand: Move nand_device forward declaration to the top
  mtd: nand: Compile in the NAND core by default
  mtd: nand: Introduce the ECC engine abstraction
  mtd: Fix typo in mtd_ooblayout_set_databytes() description
  mtd: nand: Move standard OOB layouts to the NAND core
  mtd: nand: Move ECC specific functions to ecc/engine.c
  mtd: nand: ecc: Move BCH code into the ecc/ directory
  mtd: nand: ecc: Use SPDX license identifier for the software BCH code
  mtd: nand: ecc: Turn the software BCH implementation generic
  mtd: rawnand: Get rid of chip->ecc.priv
  mtd: nand: ecc: Move Hamming code into the ecc/ directory
  mtd: nand: ecc: Use SPDX license identifier for the software Hamming
    code
  mtd: nand: ecc: Clarify the software Hamming introductory line
  mtd: nand: ecc: Turn the software Hamming implementation generic
  mtd: nand: Remove useless include about software Hamming ECC
  mtd: nand: ecc: Let the software BCH ECC engine be a module
  mtd: nand: ecc: Let the software Hamming ECC engine be unselected
  mtd: nand: ecc: Create the software BCH engine instance
  mtd: nand: ecc: Create the software Hamming engine instance
  mtd: nand: Let software ECC engines be retrieved from the NAND core
  mtd: spinand: Fix typo in comment
  mtd: spinand: Let the SPI-NAND core flag a SPI-NAND chip
  mtd: spinand: Move the ECC helper functions into a separate file
  mtd: spinand: Instantiate a SPI-NAND on-die ECC engine
  mtd: nand: Add helpers to manage ECC engines and configurations
  mtd: spinand: Use the external ECC engine logic
  mtd: spinand: Propagate ECC information to the MTD structure

 arch/arm/mach-s3c24xx/common-smdk.c           |   1 -
 arch/arm/mach-s3c24xx/mach-anubis.c           |   1 -
 arch/arm/mach-s3c24xx/mach-at2440evb.c        |   1 -
 arch/arm/mach-s3c24xx/mach-bast.c             |   1 -
 arch/arm/mach-s3c24xx/mach-gta02.c            |   1 -
 arch/arm/mach-s3c24xx/mach-jive.c             |   1 -
 arch/arm/mach-s3c24xx/mach-mini2440.c         |   1 -
 arch/arm/mach-s3c24xx/mach-osiris.c           |   1 -
 arch/arm/mach-s3c24xx/mach-qt2410.c           |   1 -
 arch/arm/mach-s3c24xx/mach-rx3715.c           |   1 -
 arch/arm/mach-s3c24xx/mach-vstms.c            |   1 -
 drivers/mtd/mtdcore.c                         |   2 +-
 drivers/mtd/nand/Kconfig                      |  13 +-
 drivers/mtd/nand/Makefile                     |   1 +
 drivers/mtd/nand/core.c                       | 270 ++++++++-
 drivers/mtd/nand/ecc/Kconfig                  |  32 ++
 drivers/mtd/nand/ecc/Makefile                 |   5 +
 drivers/mtd/nand/ecc/engine.c                 | 305 ++++++++++
 drivers/mtd/nand/ecc/sw-bch-engine.c          | 421 ++++++++++++++
 .../nand_ecc.c => ecc/sw-hamming-engine.c}    | 343 ++++++++---
 drivers/mtd/nand/onenand/Kconfig              |   1 -
 drivers/mtd/nand/raw/Kconfig                  |  24 +-
 drivers/mtd/nand/raw/Makefile                 |   2 -
 drivers/mtd/nand/raw/atmel/nand-controller.c  |  12 +-
 drivers/mtd/nand/raw/cs553x_nand.c            |   3 +-
 drivers/mtd/nand/raw/denali.c                 |   3 +
 drivers/mtd/nand/raw/denali_pci.c             |   1 -
 drivers/mtd/nand/raw/fsl_elbc_nand.c          |   1 -
 drivers/mtd/nand/raw/fsl_ifc_nand.c           |   1 -
 drivers/mtd/nand/raw/fsl_upm.c                |   1 -
 drivers/mtd/nand/raw/fsmc_nand.c              |   3 +-
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c    |  12 +-
 drivers/mtd/nand/raw/lpc32xx_mlc.c            |   1 -
 drivers/mtd/nand/raw/lpc32xx_slc.c            |   3 +-
 drivers/mtd/nand/raw/marvell_nand.c           |   7 +-
 drivers/mtd/nand/raw/mtk_nand.c               |   4 +-
 drivers/mtd/nand/raw/nand_base.c              | 536 ++++++------------
 drivers/mtd/nand/raw/nand_bch.c               | 232 --------
 drivers/mtd/nand/raw/nand_esmt.c              |  11 +-
 drivers/mtd/nand/raw/nand_hynix.c             |  41 +-
 drivers/mtd/nand/raw/nand_jedec.c             |   4 +-
 drivers/mtd/nand/raw/nand_micron.c            |  14 +-
 drivers/mtd/nand/raw/nand_onfi.c              |   8 +-
 drivers/mtd/nand/raw/nand_samsung.c           |  19 +-
 drivers/mtd/nand/raw/nand_toshiba.c           |  13 +-
 drivers/mtd/nand/raw/nandsim.c                |   3 +-
 drivers/mtd/nand/raw/ndfc.c                   |   3 +-
 drivers/mtd/nand/raw/omap2.c                  |  32 +-
 drivers/mtd/nand/raw/pasemi_nand.c            |   1 -
 drivers/mtd/nand/raw/s3c2410.c                |   1 -
 drivers/mtd/nand/raw/sharpsl.c                |   3 +-
 drivers/mtd/nand/raw/sunxi_nand.c             |  37 +-
 drivers/mtd/nand/raw/tegra_nand.c             |  12 +-
 drivers/mtd/nand/raw/tmio_nand.c              |   7 +-
 drivers/mtd/nand/raw/txx9ndfmc.c              |   5 +-
 drivers/mtd/nand/spi/Kconfig                  |   1 -
 drivers/mtd/nand/spi/Makefile                 |   2 +-
 drivers/mtd/nand/spi/core.c                   | 174 ++----
 drivers/mtd/nand/spi/macronix.c               |   6 +-
 drivers/mtd/nand/spi/on-die-ecc-engine.c      | 152 +++++
 drivers/mtd/nand/spi/toshiba.c                |   6 +-
 drivers/mtd/sm_ftl.c                          |  29 +-
 drivers/mtd/tests/mtd_nandecctest.c           |  31 +-
 include/linux/mtd/mtd.h                       |   5 +
 include/linux/mtd/nand-spi-on-die-engine.h    |  35 ++
 include/linux/mtd/nand-sw-bch-engine.h        |  80 +++
 include/linux/mtd/nand-sw-hamming-engine.h    | 101 ++++
 include/linux/mtd/nand.h                      | 160 +++++-
 include/linux/mtd/nand_bch.h                  |  69 ---
 include/linux/mtd/nand_ecc.h                  |  42 --
 include/linux/mtd/rawnand.h                   |  40 +-
 include/linux/mtd/sharpsl.h                   |   1 -
 include/linux/mtd/spinand.h                   |   5 +-
 include/uapi/mtd/mtd-abi.h                    |   1 +
 74 files changed, 2242 insertions(+), 1162 deletions(-)
 create mode 100644 drivers/mtd/nand/ecc/Kconfig
 create mode 100644 drivers/mtd/nand/ecc/Makefile
 create mode 100644 drivers/mtd/nand/ecc/engine.c
 create mode 100644 drivers/mtd/nand/ecc/sw-bch-engine.c
 rename drivers/mtd/nand/{raw/nand_ecc.c => ecc/sw-hamming-engine.c} (61%)
 delete mode 100644 drivers/mtd/nand/raw/nand_bch.c
 create mode 100644 drivers/mtd/nand/spi/on-die-ecc-engine.c
 create mode 100644 include/linux/mtd/nand-spi-on-die-engine.h
 create mode 100644 include/linux/mtd/nand-sw-bch-engine.h
 create mode 100644 include/linux/mtd/nand-sw-hamming-engine.h
 delete mode 100644 include/linux/mtd/nand_bch.h
 delete mode 100644 include/linux/mtd/nand_ecc.h

-- 
2.19.1


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

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

end of thread, other threads:[~2019-02-27 14:35 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 10:01 [RFC PATCH 00/27] Introduce the generic ECC engine abstraction Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 01/27] mtd: nand: Move nand_device forward declaration to the top Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 02/27] mtd: nand: Compile in the NAND core by default Miquel Raynal
2019-02-21 10:55   ` Boris Brezillon
2019-02-21 11:06     ` Miquel Raynal
2019-02-21 11:14       ` Boris Brezillon
2019-02-21 11:46         ` Miquel Raynal
2019-02-21 12:08           ` Boris Brezillon
2019-02-21 12:52             ` Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 03/27] mtd: nand: Introduce the ECC engine abstraction Miquel Raynal
2019-02-21 11:16   ` Boris Brezillon
2019-02-27  9:26     ` Miquel Raynal
2019-02-27  9:47       ` Boris Brezillon
2019-02-25 18:55   ` Boris Brezillon
2019-02-27 13:56     ` Miquel Raynal
2019-02-27 14:06       ` Boris Brezillon
2019-02-27 14:19         ` Miquel Raynal
2019-02-27 14:28           ` Boris Brezillon
2019-02-27 14:34             ` Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 04/27] mtd: Fix typo in mtd_ooblayout_set_databytes() description Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 05/27] mtd: nand: Move standard OOB layouts to the NAND core Miquel Raynal
2019-02-21 11:19   ` Boris Brezillon
2019-02-21 11:47     ` Miquel Raynal
2019-02-21 12:10       ` Boris Brezillon
2019-02-21 10:01 ` [RFC PATCH 06/27] mtd: nand: Move ECC specific functions to ecc/engine.c Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 07/27] mtd: nand: ecc: Move BCH code into the ecc/ directory Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 08/27] mtd: nand: ecc: Use SPDX license identifier for the software BCH code Miquel Raynal
2019-02-21 11:25   ` Boris Brezillon
2019-02-21 11:48     ` Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 09/27] mtd: nand: ecc: Turn the software BCH implementation generic Miquel Raynal
2019-02-21 12:26   ` Boris Brezillon
2019-02-21 12:53     ` Miquel Raynal
2019-02-21 10:01 ` [RFC PATCH 10/27] mtd: rawnand: Get rid of chip->ecc.priv Miquel Raynal
2019-02-21 13:01   ` Boris Brezillon
2019-02-21 10:02 ` [RFC PATCH 11/27] mtd: nand: ecc: Move Hamming code into the ecc/ directory Miquel Raynal
2019-02-21 10:02 ` [RFC PATCH 12/27] mtd: nand: ecc: Use SPDX license identifier for the software Hamming code Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).