mtd: nand: ecc: Add infrastructure to support hardware engines
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 16 Dec 2021 11:16:38 +0000 (12:16 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Sun, 23 Jan 2022 11:36:23 +0000 (12:36 +0100)
commit96489c1c0b53131b0e1ec33e2060538379ad6152
tree29f7e598a55675522722d1b6d9f48e948a4a0c7e
parent1d46963d453770ac68d954e61f094eba6e42744f
mtd: nand: ecc: Add infrastructure to support hardware engines

Add the necessary helpers to register/unregister hardware ECC engines
that will be called from ECC engine drivers.

Also add helpers to get the right engine from the user
perspective. Keep a reference of the in use ECC engine in order to
prevent modules to be unloaded. Put the reference when the engine gets
retired.

A static list of hardware (only) ECC engines is setup to keep track of
the registered engines.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20211216111654.238086-13-miquel.raynal@bootlin.com
drivers/mtd/nand/core.c
drivers/mtd/nand/ecc.c
include/linux/mtd/nand.h