mtd: nand: allow to set only one of ECC size and ECC strength from DT
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Wed May 10 19:59:08 PDT 2017
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=9fe4b66efb77fec71a9c11de58e5e51c5c826190
Commit: 9fe4b66efb77fec71a9c11de58e5e51c5c826190
Parent: 33575b25fff26085c17675b5b63d60e889cfe959
Author: Masahiro Yamada <yamada.masahiro at socionext.com>
AuthorDate: Thu Mar 23 05:07:00 2017 +0900
Committer: Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Fri Mar 24 09:33:02 2017 +0100
mtd: nand: allow to set only one of ECC size and ECC strength from DT
Currently, it is valid to specify both "nand-ecc-step-size" and
"nand-ecc-strength", but not allowed to set only one of them.
This requirement has a conflict with "nand-ecc-maximize"; this flag
is used when you want the driver to choose the best ECC strength.
If "nand-ecc-maximize" is set, "nand-ecc-strength" is very likely to
be unset.
It would be possible to make the if-conditional more complex by
adding the check for the NAND_ECC_MAXIMIZE flag, but I chose to drop
the check entirely. I thought of the situation where the hardware
has a fixed ECC step size (so it can be hard-coded in the driver),
whereas the ECC strength is configurable by software. In that case,
we may want to only set "nand-ecc-strength" (or "nand-ecc-maximize")
in DT.
Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
drivers/mtd/nand/nand_base.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 685376d..d3545c9 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4225,12 +4225,6 @@ static int nand_dt_init(struct nand_chip *chip)
ecc_strength = of_get_nand_ecc_strength(dn);
ecc_step = of_get_nand_ecc_step_size(dn);
- if ((ecc_step >= 0 && !(ecc_strength >= 0)) ||
- (!(ecc_step >= 0) && ecc_strength >= 0)) {
- pr_err("must set both strength and step size in DT\n");
- return -EINVAL;
- }
-
if (ecc_mode >= 0)
chip->ecc.mode = ecc_mode;
More information about the linux-mtd-cvs
mailing list