Skip to content

Commit f9801fd

Browse files
Abhishek Sahumiquelraynal
authored andcommitted
mtd: rawnand: denali: use helper function for ecc setup
Use the NAND core helper function nand_ecc_choose_conf to tune the ECC parameters instead of the function locally defined. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 181ace9 commit f9801fd

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

drivers/mtd/nand/raw/denali.c

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,33 +1120,6 @@ int denali_calc_ecc_bytes(int step_size, int strength)
11201120
}
11211121
EXPORT_SYMBOL(denali_calc_ecc_bytes);
11221122

1123-
static int denali_ecc_setup(struct mtd_info *mtd, struct nand_chip *chip,
1124-
struct denali_nand_info *denali)
1125-
{
1126-
int oobavail = mtd->oobsize - denali->oob_skip_bytes;
1127-
int ret;
1128-
1129-
/*
1130-
* If .size and .strength are already set (usually by DT),
1131-
* check if they are supported by this controller.
1132-
*/
1133-
if (chip->ecc.size && chip->ecc.strength)
1134-
return nand_check_ecc_caps(chip, denali->ecc_caps, oobavail);
1135-
1136-
/*
1137-
* We want .size and .strength closest to the chip's requirement
1138-
* unless NAND_ECC_MAXIMIZE is requested.
1139-
*/
1140-
if (!(chip->ecc.options & NAND_ECC_MAXIMIZE)) {
1141-
ret = nand_match_ecc_req(chip, denali->ecc_caps, oobavail);
1142-
if (!ret)
1143-
return 0;
1144-
}
1145-
1146-
/* Max ECC strength is the last thing we can do */
1147-
return nand_maximize_ecc(chip, denali->ecc_caps, oobavail);
1148-
}
1149-
11501123
static int denali_ooblayout_ecc(struct mtd_info *mtd, int section,
11511124
struct mtd_oob_region *oobregion)
11521125
{
@@ -1317,7 +1290,8 @@ int denali_init(struct denali_nand_info *denali)
13171290
chip->ecc.mode = NAND_ECC_HW_SYNDROME;
13181291
chip->options |= NAND_NO_SUBPAGE_WRITE;
13191292

1320-
ret = denali_ecc_setup(mtd, chip, denali);
1293+
ret = nand_ecc_choose_conf(chip, denali->ecc_caps,
1294+
mtd->oobsize - denali->oob_skip_bytes);
13211295
if (ret) {
13221296
dev_err(denali->dev, "Failed to setup ECC settings.\n");
13231297
goto disable_irq;

0 commit comments

Comments
 (0)