[PATCH v13 19/20] mtd: rawnand: Use the ECC framework user input parsing bits
Sascha Hauer
s.hauer at pengutronix.de
Mon Sep 21 05:36:03 EDT 2020
On Thu, Aug 27, 2020 at 10:52:07AM +0200, Miquel Raynal wrote:
> Many helpers are generic to all NAND chips, they should not be
> raw-NAND specific, so use the generic ones.
>
> To avoid moving all the raw NAND core "history" into the generic NAND
> layer, we keep a part of this parsing in the raw NAND core to ensure
> backward compatibility.
>
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
> ---
...
> -static int of_get_nand_ecc_step_size(struct device_node *np)
> +static void of_get_nand_ecc_legacy_user_config(struct nand_chip *chip)
> {
> - int ret;
> - u32 val;
> + struct device_node *dn = nand_get_flash_node(chip);
> + struct nand_ecc_props *user_conf = &chip->base.ecc.user_conf;
>
> - ret = of_property_read_u32(np, "nand-ecc-step-size", &val);
> - return ret ? ret : val;
> -}
> + if (user_conf->engine_type != NAND_ECC_ENGINE_TYPE_INVALID)
> + user_conf->engine_type = of_get_rawnand_ecc_engine_type_legacy(dn);
I think the intention is to set user_conf->engine_type when it's not set already,
so this should be == instead of !=
>
> -static int of_get_nand_ecc_strength(struct device_node *np)
> -{
> - int ret;
> - u32 val;
> + if (user_conf->algo != NAND_ECC_ALGO_UNKNOWN)
> + user_conf->algo = of_get_rawnand_ecc_algo_legacy(dn);
ditto
>
> - ret = of_property_read_u32(np, "nand-ecc-strength", &val);
> - return ret ? ret : val;
> + if (user_conf->placement != NAND_ECC_PLACEMENT_UNKNOWN)
> + user_conf->placement = of_get_rawnand_ecc_placement_legacy(dn);
ditto
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the linux-mtd
mailing list