mtd: rawnand: nand_base: Handle algorithm selection
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 7 Apr 2023 13:40:05 +0000 (15:40 +0200)
committerDario Binacchi <dario.binacchi@amarulasolutions.com>
Sat, 22 Apr 2023 21:07:57 +0000 (23:07 +0200)
commit770e77051ec50b46c2aed4c4a355bd79054cf274
treeafdf8f326ec12a424201c38c36b0e3603fab040e
parentfee6b9b734950edf33128cbd76142bdf3d29637f
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.

Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm]
Link: https://lore.kernel.org/all/20230407134008.1939717-3-linus.walleij@linaro.org/
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
drivers/mtd/nand/raw/nand_base.c