Skip to content

Commit

Permalink
mtd: nand: set ECC algorithm in nand_dt_init
Browse files Browse the repository at this point in the history
Use recently added of_get_nand_ecc_algo for that.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  • Loading branch information
Rafał Miłecki authored and Boris Brezillon committed Apr 19, 2016
1 parent dd2dcc0 commit 7908245
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3954,7 +3954,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
static int nand_dt_init(struct nand_chip *chip)
{
struct device_node *dn = nand_get_flash_node(chip);
int ecc_mode, ecc_strength, ecc_step;
int ecc_mode, ecc_algo, ecc_strength, ecc_step;

if (!dn)
return 0;
Expand All @@ -3966,6 +3966,7 @@ static int nand_dt_init(struct nand_chip *chip)
chip->bbt_options |= NAND_BBT_USE_FLASH;

ecc_mode = of_get_nand_ecc_mode(dn);
ecc_algo = of_get_nand_ecc_algo(dn);
ecc_strength = of_get_nand_ecc_strength(dn);
ecc_step = of_get_nand_ecc_step_size(dn);

Expand All @@ -3978,6 +3979,9 @@ static int nand_dt_init(struct nand_chip *chip)
if (ecc_mode >= 0)
chip->ecc.mode = ecc_mode;

if (ecc_algo >= 0)
chip->ecc.algo = ecc_algo;

if (ecc_strength >= 0)
chip->ecc.strength = ecc_strength;

Expand Down

0 comments on commit 7908245

Please sign in to comment.