[PATCH V2 09/11] mtd: nand: read ECC algorithm from the new field
Boris Brezillon
boris.brezillon at free-electrons.com
Sun Apr 17 11:59:38 PDT 2016
On Sun, 17 Apr 2016 19:11:42 +0200
Rafał Miłecki <zajec5 at gmail.com> wrote:
> Now we have all drivers properly setting this new field we can start
> using it. For a very short period of time we should support both values:
> NAND_ECC_SOFT and NAND_ECC_SOFT_BCH treating them the same. It's because
> of_get_nand_ecc_mode may still be setting NAND_ECC_SOFT_BCH.
>
> Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
> ---
> V2: Move SOFT-related code to separated functions
> Add missing checks for SOFT before checking Hamming vs. BCH
> ---
> drivers/mtd/nand/nand_base.c | 116 ++++++++++++++++++++++++++-----------------
> 1 file changed, 71 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
[...]
>
> @@ -4154,7 +4217,9 @@ int nand_scan_tail(struct mtd_info *mtd)
> /*
> * If no default placement scheme is given, select an appropriate one.
> */
> - if (!mtd->ooblayout && (ecc->mode != NAND_ECC_SOFT_BCH)) {
> + if (!mtd->ooblayout &&
> + (ecc->mode == NAND_ECC_SOFT || ecc->mode == NAND_ECC_SOFT_BCH) &&
> + ecc->algo != NAND_ECC_BCH) {
Sorry, I got this wrong in my previous review. It should be
if (!mtd->ooblayout &&
((ecc->mode != NAND_ECC_SOFT &&
ecc->mode != NAND_ECC_SOFT_BCH) ||
ecc->algo != NAND_ECC_BCH) {
otherwise we're only addressing the software ECC case, and IIRC, some
drivers rely on these default layouts for their HW ECC implementation.
The rest looks good to me.
Thanks,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
More information about the linux-mtd
mailing list