[PATCH v2] mtd: rawnand: xway: No hardcoded ECC engine, use device tree setting

Jan Hoffmann jan at 3e8.eu
Sat Sep 18 14:26:48 PDT 2021


Hi Miquèl,

> Yes this was my understanding, that only software ECC engine was
> supported. The mainline driver shows absolutely no signs of hardware
> ECC engine support.
> 
> Perhaps however you mean that on-die ECC engine are not supported
> anymore because of the engine_type being set in attach_chip()?

Yes, this is exactly the issue.

> If yes then indeed there is something to do, perhaps checking if an
> engine has been already set is enough? You can try something like:
> 
> if (engine_type == unknown)
> 	engine_type = soft;

Checking for NAND_ECC_ENGINE_TYPE_INVALID doesn't work, as the engine
type is already set to NAND_ECC_ENGINE_TYPE_ON_HOST by rawnand_dt_init.
The code there seems to expect that chip->ecc.engine_type contains the
default value, which is no longer the case after commit 525914b5bd8
("mtd: rawnand: xway: Move the ECC initialization to ->attach_chip()").

The following in attach_chip works:

if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
	chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;

However, this will also silently use the software ECC engine if anyone
actually configures the on-host hardware ECC engine in the device tree
(which is of course unsupported for xway).

Thanks,
Jan



More information about the linux-mtd mailing list