This change supports nand-ecc-step-size and nand-ecc-strenght fields in brcmnand dt node to be optional. see: Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt If both nand-ecc-strength and nand-ecc-step-size are not specified in device tree node for NAND, nand_base driver does detect onfi ext ecc info from ONFI extended parameter page for parts using ONFI >= 2.1. In case of non-onfi NAND there could be a nand_id table entry with the ecc info. If there is a valid device tree entry for nand-ecc-strength and nand-ecc-step-size fields it still shall override the detected values. Signed-off-by: Kamal Dasu <kdasu.kdev@xxxxxxxxx> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index ce0b8ff..e967b30 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2144,6 +2144,16 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) return -EINVAL; } + if (!(chip->ecc.size > 0 && chip->ecc.strength > 0) && + (chip->base.eccreq.strength > 0 && + chip->base.eccreq.step_size > 0)) { + /* use detected ecc parameters */ + chip->ecc.size = chip->base.eccreq.step_size; + chip->ecc.strength = chip->base.eccreq.strength; + pr_info("Using detected nand-ecc-step-size %d, nand-ecc-strength %d\n", + chip->ecc.size, chip->ecc.strength); + } + switch (chip->ecc.size) { case 512: if (chip->ecc.algo == NAND_ECC_HAMMING) -- 1.9.0.138.g2de3478 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/