mtd: rawnand: nand_base: Handle algorithm selection
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 8 Mar 2023 21:28:51 +0000 (22:28 +0100)
committerDario Binacchi <dario.binacchi@amarulasolutions.com>
Sun, 16 Apr 2023 10:25:36 +0000 (12:25 +0200)
commitff33d3c87c2a1ab576607c2f67a9cb7690a4e7ca
treeffa5b4c412490bae2279a12ea3980f2a0aad06a7
parent28b395ccc42cb7301733d8eb46a360189308bd71
mtd: rawnand: nand_base: Handle algorithm selection

For BRCMNAND with 1-bit BCH ECC (BCH-1) such as used on the
D-Link DIR-885L and DIR-890L routers, we need to explicitly
select the ECC like this in the device tree:

  nand-ecc-algo = "bch";
  nand-ecc-strength = <1>;
  nand-ecc-step-size = <512>;

This is handled by the Linux kernel but U-Boot core does
not respect this. Fix it up by parsing the algorithm and
preserve the behaviour using this property to select
software BCH as far as possible.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: William Zhang <william.zhang@broadcom.com>
Link: https://lore.kernel.org/all/20230308212851.370939-1-linus.walleij@linaro.org/
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
drivers/mtd/nand/raw/nand_base.c