diff mbox series

[5/5] mtd: spinand: Fill a default ECC provider/algorithm

Message ID 20200930154109.3922-6-miquel.raynal@bootlin.com
State Accepted
Headers show
Series Creation of a SPI-NAND ECC engine | expand

Commit Message

Miquel Raynal Sept. 30, 2020, 3:41 p.m. UTC
The SPI-NAND layer default is on-die ECC because until now it was the
only one supported. New SPI-NAND chip flavors might use something else
as ECC engine provider but this will always be the default if the user
does not choose explicitly something else.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/spi/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Miquel Raynal Oct. 30, 2020, 5:28 p.m. UTC | #1
On Wed, 2020-09-30 at 15:41:09 UTC, Miquel Raynal wrote:
> The SPI-NAND layer default is on-die ECC because until now it was the
> only one supported. New SPI-NAND chip flavors might use something else
> as ECC engine provider but this will always be the default if the user
> does not choose explicitly something else.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 668441d483e3..916335c510d3 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -309,7 +309,7 @@  static struct nand_ecc_engine_ops spinand_ondie_ecc_engine_ops = {
 	.finish_io_req = spinand_ondie_ecc_finish_io_req,
 };
 
-static __maybe_unused struct nand_ecc_engine spinand_ondie_ecc_engine = {
+static struct nand_ecc_engine spinand_ondie_ecc_engine = {
 	.ops = &spinand_ondie_ecc_engine_ops,
 };
 
@@ -1134,6 +1134,10 @@  static int spinand_init(struct spinand_device *spinand)
 	if (ret)
 		goto err_manuf_cleanup;
 
+	/* SPI-NAND default ECC engine is on-die */
+	nand->ecc.defaults.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE;
+	nand->ecc.ondie_engine = &spinand_ondie_ecc_engine;
+
 	/*
 	 * Right now, we don't support ECC, so let the whole oob
 	 * area available for the user.